Postie - Version 1.4.6

Version Description

(2012.12.06) = * Changed XSS check to only emit warning until a better solution can be developed * Fixed bug where authorized addresses were being checked with case sensitive rather than insensitive. * Started using PHP Simple HTML DOM Parser http://simplehtmldom.sourceforge.net/ * Started process of logging all error messages to the log as well as the page (where appropriate) * Fixed bug where "Preferred Text Type" was not displaying the saved value in settings page. * Fixed bug where Postie was wiping out all other cron schedules. * Fixed a number of missing internationalization strings (no translations added however) * Added documentation for the comments: command * Added feature to specify a custom post type in the subject line. Thanks to Raam Dev http://raamdev.com for his code. * Removed a number of deprecated WordPress functions. * Fixed numerous warning messages * Added phpUnit tests * Allow wp-config.php to be in alternate location as described here: http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php * Fix a bug that didn't replace the #img# tags correctly.

Download this release

Release Info

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

Code changes from version 1.4.5 to 1.4.6

Revision CHANGED
@@ -1,2 +1,2 @@
1
- Revision: 622321
2
- Last Changed Date: 2012-11-07 14:50:48 -0800 (Wed, 07 Nov 2012)
1
+ Revision: 634996
2
+ Last Changed Date: 2012-12-03 16:37:08 -0800 (Mon, 03 Dec 2012)
config_form.php CHANGED
@@ -21,7 +21,7 @@
21
  exit;
22
  break;
23
  case "runpostie":
24
- echo "Checking for mail manually\n";
25
  include('get_mail.php');
26
  exit;
27
  break;
@@ -37,17 +37,19 @@
37
  $config = get_option('postie-settings');
38
  if (empty($config))
39
  $config = ResetPostieConfig();
40
- if (defined('POSTIE_DEBUG'))
41
- var_dump($config);
 
42
  $arrays = get_arrayed_settings();
43
- // some fields are stored as arrays, because that makes back-end processing much easier
44
- // and we need to convert those fields to strings here, for the options form
45
  foreach ($arrays as $sep => $fields) {
46
  foreach ($fields as $field) {
47
  $config[$field] = implode($sep, $config[$field]);
48
  }
49
  }
50
  extract($config);
 
51
  if ($interval == 'manual') {
52
  wp_clear_scheduled_hook('check_postie_hook');
53
  }
@@ -73,7 +75,9 @@
73
  <?php _e("this will run a special script to test your configuration options", 'postie'); ?>
74
  </form>
75
  <form name="postie-options" method="post" action='options.php'>
76
- <?php settings_fields('postie-settings'); ?>
 
 
77
  <input type="hidden" name="action" value="config" />
78
  <div id="simpleTabs">
79
  <div class="simpleTabs-nav">
@@ -142,7 +146,7 @@
142
  <tr valign="top">
143
  <th scope="row"><?php _e('Mail Password:', 'postie') ?></th>
144
  <td>
145
- <input name='postie-settings[mail_password]' type="text" id='postie-settings-mail_password' value="<?php echo $mail_password; ?>" size="40" />
146
  </td>
147
  </tr>
148
  <tr><th>
@@ -184,13 +188,14 @@
184
  </select>
185
  </td>
186
  </tr>
187
- <?php echo BuildBooleanSelect("Delete email after posting", 'postie-settings[delete_mail_after_processing]', $delete_mail_after_processing, "Only set to no for testing purposes"); ?>
188
  </table>
189
  </div>
 
190
  <div id="simpleTabs-content-2" class="simpleTabs-content">
191
  <table class='form-table'>
192
 
193
- <?php echo BuildBooleanSelect("Allow Anyone To Post Via Email", "postie-settings[turn_authorization_off]", $turn_authorization_off, "Changing this to yes is NOT RECOMMEDED - anything that gets sent in will automatically be posted. This could make it easier to compromise your server - YOU HAVE BEEN WARNED."); ?>
194
  <tr>
195
  <th scope="row"><?php _e('Roles That Can Post:', 'postie') ?>
196
  <br />
@@ -200,7 +205,7 @@
200
  <tr><th>Administrator role can always post.</th>
201
  <?php
202
  foreach ($wp_roles->role_names as $roleId => $name) {
203
- $name = translate_with_context($name);
204
  $role = &$wp_roles->get_role($roleId);
205
  if ($roleId != "administrator") {
206
  ?>
@@ -223,26 +228,22 @@
223
  <select name='postie-settings[post_status]' id='postie-settings-post_status'>
224
  <option value="publish" <?php
225
  if ($post_status == "publish") {
226
- echo
227
- "selected";
228
  }
229
  ?>>Published</option>
230
  <option value="draft" <?php
231
  if ($post_status == "draft") {
232
- echo
233
- "selected";
234
  }
235
  ?>>Draft</option>
236
  <option value="pending" <?php
237
  if ($post_status == "pending") {
238
- echo
239
- "selected";
240
  }
241
  ?>>Pending Review</option>
242
  <option value="private" <?php
243
  if ($post_status == "private") {
244
- echo
245
- "selected";
246
  }
247
  ?>>Private</option>
248
  </select> </td>
@@ -257,10 +258,12 @@
257
  </tr>
258
  </table>
259
  </div>
260
- <div id="simpleTabs-content-3" class="simpleTabs-content">
261
- <table class='form-table'>
262
- <tr valign="top">
263
- <th scope="row"><?php _e('Default post by mail category:', 'postie') ?></th>
 
 
264
  <td>
265
  <?php
266
  $defaultCat = $default_post_category;
@@ -289,9 +292,9 @@
289
  <th width="33%" valign="top" scope="row"><?php _e('Preferred Text Type:', 'postie') ?> </th>
290
  <td>
291
  <select name='postie-settings[prefer_text_type]' id='postie-settings-prefer_text_type'>
292
- <option value="plain">plain</option>
293
- <option value="html" <?php ($prefer_text_type == "html") ? "selected" : "" ?>>html</option>
294
- </select><br />
295
  </td>
296
  </tr>
297
  <?php echo BuildBooleanSelect("Forward Rejected Mail", "postie-settings[forward_rejected_mail]", $forward_rejected_mail); ?>
@@ -327,8 +330,7 @@
327
  <?php _e("Send post confirmation e-mail to", 'postie') ?>
328
  </th>
329
  <td>
330
- <select name='postie-settings[confirmation_email]'
331
- id='postie-settings-confirmation_email'>
332
  <option value="sender" <?php echo($confirmation_email == "sender") ? "selected" : "" ?>><?php _e('sender', 'postie') ?></option>
333
  <option value="admin" <?php echo ($confirmation_email == "admin") ? "selected" : "" ?>><?php _e('administrator', 'postie') ?></option>
334
  <option value="both" <?php echo ($confirmation_email == "both") ? "selected" : "" ?>><?php _e('sender and administrator', 'postie') ?></option>
@@ -378,7 +380,7 @@
378
  </th>
379
  <td>
380
  <input type='hidden' id='postie-settings-selected_imagetemplate' name='postie-settings[selected_imagetemplate]'
381
- value="<?php echo attribute_escape($selected_imagetemplate) ?>" />
382
  <select name='imagetemplateselect' id='imagetemplateselect'
383
  onchange="changeStyle('imageTemplatePreview','postie-settings-imagetemplate',
384
  'imagetemplateselect', 'postie-settings-selected_imagetemplate','smiling.jpg');" >
@@ -396,7 +398,7 @@
396
  if ($key == 'custom')
397
  $value = $imagetemplate;
398
  echo '<option' . $select . 'value="' .
399
- attribute_escape($value) . '" >' . $key . '</option>';
400
  }
401
  }
402
  ?>
@@ -406,7 +408,7 @@
406
  <div id='imageTemplatePreview'></div>
407
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
408
  "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
409
- <?php echo attribute_escape($imagetemplate) ?>
410
  </textarea>
411
  </td>
412
  </tr>
@@ -426,7 +428,7 @@
426
  <?php $templateDir = get_option('siteurl') . '/' . PLUGINDIR . '/postie/templates'; ?>
427
  <td>
428
  <input type='hidden' id='postie-settings-selected_video1template' name='postie-settings[selected_video1template]'
429
- value="<?php echo attribute_escape($selected_video1template) ?>" />
430
  <select name='video1templateselect' id='video1templateselect'
431
  onchange="changeStyle('video1TemplatePreview','postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template','hi.mp4');" />
432
  <?php
@@ -443,7 +445,7 @@
443
  if ($key == 'custom')
444
  $value = $video1template;
445
  echo '<option' . $select . 'value="' .
446
- attribute_escape($value) . '" >' . $key . '</option>';
447
  }
448
  }
449
  ?>
@@ -453,7 +455,7 @@
453
  <div id='video1TemplatePreview'></div>
454
  <textarea onchange="changeStyle('video1TemplatePreview','postie-settings-video1template',
455
  'video1templateselect', 'postie-settings-selected_video1template','hi.mp4',true);" cols='70' rows='7' id='postie-settings-video1template'
456
- name='postie-settings[video1template]'><?php echo attribute_escape($video1template) ?></textarea>
457
  </td>
458
  </tr>
459
  <tr>
@@ -468,7 +470,7 @@
468
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span></th>
469
  <td>
470
  <input type='hidden' id='postie-settings-selected_video2template' name='postie-settings[selected_video2template]'
471
- value="<?php echo attribute_escape($selected_video2template) ?>" />
472
  <select name='video2templateselect' id='video2templateselect'
473
  onchange="changeStyle('video2TemplatePreview','postie-settings-video2template',
474
  'video2templateselect', 'postie-settings-selected_video2template','hi.flv');" >
@@ -485,7 +487,7 @@
485
  }
486
  if ($key == 'custom')
487
  $value = $video2template;
488
- echo '<option' . $select . 'value="' . attribute_escape($value) . '" >' . $key . '</option>';
489
  }
490
  }
491
  ?>
@@ -496,7 +498,7 @@
496
  <textarea onchange="changeStyle('video2TemplatePreview','postie-settings-video2template',
497
  'video2templateselect', 'postie-settings-selected_video2template','hi.flv',true);" cols='70' rows='7' id='postie-settings-video2template'
498
  name='postie-settings[video2template]'>
499
- <?php echo attribute_escape($video2template) ?>
500
  </textarea>
501
  </td>
502
  </tr>
@@ -512,7 +514,7 @@
512
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span></th>
513
  <td>
514
  <input type='hidden' id='postie-settings-selected_audiotemplate' name='postie-settings[selected_audiotemplate]'
515
- value="<?php echo attribute_escape($selected_audiotemplate) ?>" />
516
  <select name='audiotemplateselect' id='audiotemplateselect'
517
  onchange="changeStyle('audioTemplatePreview','postie-settings-audiotemplate',
518
  'audiotemplateselect', 'postie-settings-selected_audiotemplate','funky.mp3', false);" >
@@ -530,7 +532,7 @@
530
  if ($key == 'custom')
531
  $value = $audiotemplate;
532
  echo '<option' . $select . 'value="' .
533
- attribute_escape($value) . '" >' . $key . '</option>';
534
  }
535
  }
536
  ?>
@@ -540,7 +542,7 @@
540
  <div id='audioTemplatePreview'></div>
541
  <textarea onchange="changeStyle('audioTemplatePreview','postie-settings-audiotemplate',
542
  'audiotemplateselect', 'postie-settings-selected_audiotemplate','funky.mp3', true);" cols='70' rows='7' id='postie-settings-audiotemplate'
543
- name='postie-settings[audiotemplate]'><?php echo attribute_escape($audiotemplate) ?></textarea>
544
  </td>
545
  </tr>
546
  <tr>
@@ -563,7 +565,7 @@
563
  <th scope='row'><?php _e('Attachment icon set', 'postie') ?><br /></th>
564
  <td>
565
  <input type='hidden' id='postie-settings-icon_set' name='postie-settings[icon_set]'
566
- value="<?php echo attribute_escape($icon_set) ?>" />
567
 
568
  <?php
569
  $icon_sets = array('silver', 'black', 'white', 'custom', 'none');
@@ -580,7 +582,7 @@
580
  } else {
581
  $select = ' ';
582
  }
583
- echo '<option' . $select . 'value="' . attribute_escape($key) . '" >' . $key . '</option>';
584
  }
585
  }
586
  ?>
@@ -590,7 +592,7 @@
590
  <tr><th scope='row'><?php _e('Attachment icon size (in pixels)', 'postie') ?><br />
591
  <td>
592
  <input type='hidden' id='postie-settings-icon_size' name='postie-settings[icon_size]'
593
- value="<?php echo attribute_escape($icon_size) ?>" />
594
  <select name='icon_size_select' id='icon_size_select' onchange="changeIconSet(this, true);" >
595
  <?php
596
  $styleOptions = $icon_sizes;
@@ -602,7 +604,7 @@
602
  } else {
603
  $select = ' ';
604
  }
605
- echo '<option' . $select . 'value="' . attribute_escape($key) . '" >' . $key . '</option>';
606
  }
607
  }
608
  ?>
@@ -649,6 +651,7 @@
649
  });
650
 
651
  });
 
652
  function changeIconSet(selectBox, size) {
653
  var iconSet=document.getElementById('postie-settings-icon_set');
654
  var iconSize=document.getElementById('postie-settings-icon_size');
@@ -676,6 +679,7 @@
676
  iconDir + iconSet.value + '/doc' +
677
  '-' + iconSize.value + ".png' />Interesting document</a>";
678
  }
 
679
  function changeStyle(preview,template,select,selected,sample,custom) {
680
  var preview = document.getElementById(preview);
681
  var pageStyles = document.getElementById(select);
@@ -724,15 +728,10 @@
724
  arrow.innerHTML='&#9654;';
725
  }
726
  }
727
- changeStyle('imageTemplatePreview','postie-settings-imagetemplate', 'imagetemplateselect',
728
- 'postie-settings-selected_imagetemplate','smiling.jpg', false);
729
- changeStyle('audioTemplatePreview','postie-settings-audiotemplate',
730
- 'audiotemplateselect',
731
- 'postie-settings-selected_audiotemplate','funky.mp3', false);
732
- changeStyle('video1TemplatePreview','postie-settings-video1template', 'video1templateselect',
733
- 'postie-settings-selected_video1template','hi.mp4', false);
734
- changeStyle('video2TemplatePreview','postie-settings-video2template',
735
- 'video2templateselect',
736
- 'postie-settings-selected_video2template','hi.flv', false);
737
  changeIconSet(document.getElementById('icon_set_select'));
738
  </script>
21
  exit;
22
  break;
23
  case "runpostie":
24
+ EchoInfo("Checking for mail manually");
25
  include('get_mail.php');
26
  exit;
27
  break;
37
  $config = get_option('postie-settings');
38
  if (empty($config))
39
  $config = ResetPostieConfig();
40
+
41
+
42
+
43
  $arrays = get_arrayed_settings();
44
+ // some fields are stored as arrays, because that makes back-end processing much easier
45
+ // and we need to convert those fields to strings here, for the options form
46
  foreach ($arrays as $sep => $fields) {
47
  foreach ($fields as $field) {
48
  $config[$field] = implode($sep, $config[$field]);
49
  }
50
  }
51
  extract($config);
52
+
53
  if ($interval == 'manual') {
54
  wp_clear_scheduled_hook('check_postie_hook');
55
  }
75
  <?php _e("this will run a special script to test your configuration options", 'postie'); ?>
76
  </form>
77
  <form name="postie-options" method="post" action='options.php'>
78
+ <?php
79
+ settings_fields('postie-settings');
80
+ ?>
81
  <input type="hidden" name="action" value="config" />
82
  <div id="simpleTabs">
83
  <div class="simpleTabs-nav">
146
  <tr valign="top">
147
  <th scope="row"><?php _e('Mail Password:', 'postie') ?></th>
148
  <td>
149
+ <input name='postie-settings[mail_password]' type="password" id='postie-settings-mail_password' value="<?php echo $mail_password; ?>" size="40" />
150
  </td>
151
  </tr>
152
  <tr><th>
188
  </select>
189
  </td>
190
  </tr>
191
+ <?php echo BuildBooleanSelect(__("Delete email after posting"), 'postie-settings[delete_mail_after_processing]', $delete_mail_after_processing, __("Only set to no for testing purposes")); ?>
192
  </table>
193
  </div>
194
+
195
  <div id="simpleTabs-content-2" class="simpleTabs-content">
196
  <table class='form-table'>
197
 
198
+ <?php echo BuildBooleanSelect(__("Allow Anyone To Post Via Email"), "postie-settings[turn_authorization_off]", $turn_authorization_off, "Changing this to yes is NOT RECOMMEDED - anything that gets sent in will automatically be posted. This could make it easier to compromise your server - YOU HAVE BEEN WARNED."); ?>
199
  <tr>
200
  <th scope="row"><?php _e('Roles That Can Post:', 'postie') ?>
201
  <br />
205
  <tr><th>Administrator role can always post.</th>
206
  <?php
207
  foreach ($wp_roles->role_names as $roleId => $name) {
208
+ $name = translate_user_role($name);
209
  $role = &$wp_roles->get_role($roleId);
210
  if ($roleId != "administrator") {
211
  ?>
228
  <select name='postie-settings[post_status]' id='postie-settings-post_status'>
229
  <option value="publish" <?php
230
  if ($post_status == "publish") {
231
+ echo "selected";
 
232
  }
233
  ?>>Published</option>
234
  <option value="draft" <?php
235
  if ($post_status == "draft") {
236
+ echo "selected";
 
237
  }
238
  ?>>Draft</option>
239
  <option value="pending" <?php
240
  if ($post_status == "pending") {
241
+ echo "selected";
 
242
  }
243
  ?>>Pending Review</option>
244
  <option value="private" <?php
245
  if ($post_status == "private") {
246
+ echo "selected";
 
247
  }
248
  ?>>Private</option>
249
  </select> </td>
258
  </tr>
259
  </table>
260
  </div>
261
+
262
+ <div id = "simpleTabs-content-3" class = "simpleTabs-content">
263
+ <table class = 'form-table'>
264
+ <tr valign = "top">
265
+ <th scope = "row"><?php _e('Default post by mail category:', 'postie')
266
+ ?></th>
267
  <td>
268
  <?php
269
  $defaultCat = $default_post_category;
292
  <th width="33%" valign="top" scope="row"><?php _e('Preferred Text Type:', 'postie') ?> </th>
293
  <td>
294
  <select name='postie-settings[prefer_text_type]' id='postie-settings-prefer_text_type'>
295
+ <?php printf('<option value="plain" %s>plain</option>', ($prefer_text_type == "plain") ? "selected" : "") ?>
296
+ <?php printf('<option value="html" %s>html</option>', ($prefer_text_type == "html") ? "selected" : "") ?>
297
+ </select>
298
  </td>
299
  </tr>
300
  <?php echo BuildBooleanSelect("Forward Rejected Mail", "postie-settings[forward_rejected_mail]", $forward_rejected_mail); ?>
330
  <?php _e("Send post confirmation e-mail to", 'postie') ?>
331
  </th>
332
  <td>
333
+ <select name='postie-settings[confirmation_email]' id='postie-settings-confirmation_email'>
 
334
  <option value="sender" <?php echo($confirmation_email == "sender") ? "selected" : "" ?>><?php _e('sender', 'postie') ?></option>
335
  <option value="admin" <?php echo ($confirmation_email == "admin") ? "selected" : "" ?>><?php _e('administrator', 'postie') ?></option>
336
  <option value="both" <?php echo ($confirmation_email == "both") ? "selected" : "" ?>><?php _e('sender and administrator', 'postie') ?></option>
380
  </th>
381
  <td>
382
  <input type='hidden' id='postie-settings-selected_imagetemplate' name='postie-settings[selected_imagetemplate]'
383
+ value="<?php echo esc_attr($selected_imagetemplate) ?>" />
384
  <select name='imagetemplateselect' id='imagetemplateselect'
385
  onchange="changeStyle('imageTemplatePreview','postie-settings-imagetemplate',
386
  'imagetemplateselect', 'postie-settings-selected_imagetemplate','smiling.jpg');" >
398
  if ($key == 'custom')
399
  $value = $imagetemplate;
400
  echo '<option' . $select . 'value="' .
401
+ esc_attr($value) . '" >' . $key . '</option>';
402
  }
403
  }
404
  ?>
408
  <div id='imageTemplatePreview'></div>
409
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
410
  "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
411
+ <?php echo esc_attr($imagetemplate) ?>
412
  </textarea>
413
  </td>
414
  </tr>
428
  <?php $templateDir = get_option('siteurl') . '/' . PLUGINDIR . '/postie/templates'; ?>
429
  <td>
430
  <input type='hidden' id='postie-settings-selected_video1template' name='postie-settings[selected_video1template]'
431
+ value="<?php echo esc_attr($selected_video1template) ?>" />
432
  <select name='video1templateselect' id='video1templateselect'
433
  onchange="changeStyle('video1TemplatePreview','postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template','hi.mp4');" />
434
  <?php
445
  if ($key == 'custom')
446
  $value = $video1template;
447
  echo '<option' . $select . 'value="' .
448
+ esc_attr($value) . '" >' . $key . '</option>';
449
  }
450
  }
451
  ?>
455
  <div id='video1TemplatePreview'></div>
456
  <textarea onchange="changeStyle('video1TemplatePreview','postie-settings-video1template',
457
  'video1templateselect', 'postie-settings-selected_video1template','hi.mp4',true);" cols='70' rows='7' id='postie-settings-video1template'
458
+ name='postie-settings[video1template]'><?php echo esc_attr($video1template) ?></textarea>
459
  </td>
460
  </tr>
461
  <tr>
470
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span></th>
471
  <td>
472
  <input type='hidden' id='postie-settings-selected_video2template' name='postie-settings[selected_video2template]'
473
+ value="<?php echo esc_attr($selected_video2template) ?>" />
474
  <select name='video2templateselect' id='video2templateselect'
475
  onchange="changeStyle('video2TemplatePreview','postie-settings-video2template',
476
  'video2templateselect', 'postie-settings-selected_video2template','hi.flv');" >
487
  }
488
  if ($key == 'custom')
489
  $value = $video2template;
490
+ echo '<option' . $select . 'value="' . esc_attr($value) . '" >' . $key . '</option>';
491
  }
492
  }
493
  ?>
498
  <textarea onchange="changeStyle('video2TemplatePreview','postie-settings-video2template',
499
  'video2templateselect', 'postie-settings-selected_video2template','hi.flv',true);" cols='70' rows='7' id='postie-settings-video2template'
500
  name='postie-settings[video2template]'>
501
+ <?php echo esc_attr($video2template) ?>
502
  </textarea>
503
  </td>
504
  </tr>
514
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span></th>
515
  <td>
516
  <input type='hidden' id='postie-settings-selected_audiotemplate' name='postie-settings[selected_audiotemplate]'
517
+ value="<?php echo esc_attr($selected_audiotemplate) ?>" />
518
  <select name='audiotemplateselect' id='audiotemplateselect'
519
  onchange="changeStyle('audioTemplatePreview','postie-settings-audiotemplate',
520
  'audiotemplateselect', 'postie-settings-selected_audiotemplate','funky.mp3', false);" >
532
  if ($key == 'custom')
533
  $value = $audiotemplate;
534
  echo '<option' . $select . 'value="' .
535
+ esc_attr($value) . '" >' . $key . '</option>';
536
  }
537
  }
538
  ?>
542
  <div id='audioTemplatePreview'></div>
543
  <textarea onchange="changeStyle('audioTemplatePreview','postie-settings-audiotemplate',
544
  'audiotemplateselect', 'postie-settings-selected_audiotemplate','funky.mp3', true);" cols='70' rows='7' id='postie-settings-audiotemplate'
545
+ name='postie-settings[audiotemplate]'><?php echo esc_attr($audiotemplate) ?></textarea>
546
  </td>
547
  </tr>
548
  <tr>
565
  <th scope='row'><?php _e('Attachment icon set', 'postie') ?><br /></th>
566
  <td>
567
  <input type='hidden' id='postie-settings-icon_set' name='postie-settings[icon_set]'
568
+ value="<?php echo esc_attr($icon_set) ?>" />
569
 
570
  <?php
571
  $icon_sets = array('silver', 'black', 'white', 'custom', 'none');
582
  } else {
583
  $select = ' ';
584
  }
585
+ echo '<option' . $select . 'value="' . esc_attr($key) . '" >' . $key . '</option>';
586
  }
587
  }
588
  ?>
592
  <tr><th scope='row'><?php _e('Attachment icon size (in pixels)', 'postie') ?><br />
593
  <td>
594
  <input type='hidden' id='postie-settings-icon_size' name='postie-settings[icon_size]'
595
+ value="<?php echo esc_attr($icon_size) ?>" />
596
  <select name='icon_size_select' id='icon_size_select' onchange="changeIconSet(this, true);" >
597
  <?php
598
  $styleOptions = $icon_sizes;
604
  } else {
605
  $select = ' ';
606
  }
607
+ echo '<option' . $select . 'value="' . esc_attr($key) . '" >' . $key . '</option>';
608
  }
609
  }
610
  ?>
651
  });
652
 
653
  });
654
+
655
  function changeIconSet(selectBox, size) {
656
  var iconSet=document.getElementById('postie-settings-icon_set');
657
  var iconSize=document.getElementById('postie-settings-icon_size');
679
  iconDir + iconSet.value + '/doc' +
680
  '-' + iconSize.value + ".png' />Interesting document</a>";
681
  }
682
+
683
  function changeStyle(preview,template,select,selected,sample,custom) {
684
  var preview = document.getElementById(preview);
685
  var pageStyles = document.getElementById(select);
728
  arrow.innerHTML='&#9654;';
729
  }
730
  }
731
+
732
+ changeStyle('imageTemplatePreview','postie-settings-imagetemplate', 'imagetemplateselect', 'postie-settings-selected_imagetemplate','smiling.jpg', false);
733
+ changeStyle('audioTemplatePreview','postie-settings-audiotemplate', 'audiotemplateselect', 'postie-settings-selected_audiotemplate','funky.mp3', false);
734
+ changeStyle('video1TemplatePreview','postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template','hi.mp4', false);
735
+ changeStyle('video2TemplatePreview','postie-settings-video2template', 'video2templateselect', 'postie-settings-selected_video2template','hi.flv', false);
 
 
 
 
 
736
  changeIconSet(document.getElementById('icon_set_select'));
737
  </script>
deploy/_deploy.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ update version number in postie.php
2
+ update version number in docs\postie.txt
3
+ run deploy.cmd
4
+ commit
5
+ branch trunk to new version
deploy/deploy.cmd ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cd ..
2
+
3
+ @echo Update revision
4
+ svn info | findstr "Date Revision" > Revision
5
+
6
+ @echo Create readme.txt
7
+ copy /Y docs\Postie.txt+docs\Installation.txt+docs\Usage.txt+docs\FAQ.txt+docs\Changes.txt readme.txt
8
+
9
+ @echo Create readme.html & faq.html
10
+ curl -F "text=1" -F "readme_contents=<readme.txt" http://wordpress.org/extend/plugins/about/validator/ | perl deploy\stripParts.pl > readme.html
11
+
12
+ cd deploy
stripParts.pl → deploy/stripParts.pl RENAMED
File without changes
docs/Changes.txt ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ == Upgrade Notice ==
2
+ * Attachments are now processed in the order they were attached.
3
+ * XSS detection only issues a warning now
4
+
5
+ == CHANGELOG ==
6
+
7
+ = 1.4.6 (2012.12.06) =
8
+ * Changed XSS check to only emit warning until a better solution can be developed
9
+ * Fixed bug where authorized addresses were being checked with case sensitive rather than insensitive.
10
+ * Started using PHP Simple HTML DOM Parser http://simplehtmldom.sourceforge.net/
11
+ * Started process of logging all error messages to the log as well as the page (where appropriate)
12
+ * Fixed bug where "Preferred Text Type" was not displaying the saved value in settings page.
13
+ * Fixed bug where Postie was wiping out all other cron schedules.
14
+ * Fixed a number of missing internationalization strings (no translations added however)
15
+ * Added documentation for the comments: command
16
+ * Added feature to specify a custom post type in the subject line. Thanks to Raam Dev http://raamdev.com for his code.
17
+ * Removed a number of deprecated WordPress functions.
18
+ * Fixed numerous warning messages
19
+ * Added phpUnit tests
20
+ * Allow wp-config.php to be in alternate location as described here: http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php
21
+ * Fix a bug that didn't replace the #img# tags correctly.
22
+
23
+ = 1.4.5 (2012.11.14) =
24
+ * Fixed bug in XSS attack vulnerability code. Thanks to R Reid http://blog.strictly-software.com/2012/03/fixing-postie-plugin-for-wordpress-to.html
25
+ * Fixed bug where emails with multiple categories has the incorrect title
26
+ * Fixed bugs where PHP setting were not being changed correctly - thanks to Peter Chester http://tri.be/author/peter/
27
+ * New maintainer
28
+
29
+ = 1.4.4 (2012.08.10) =
30
+ * Fixed possible XSS attack vulnerability
31
+
32
+ = 1.4.3 =
33
+ * Removed get_user_by function to make compatible with wp 3.3 - now requires
34
+ 2.8+
35
+
36
+ = 1.4.2 (2011.01.29) =
37
+ * Fixed mailto link bug (thanks to Jason McNeil)
38
+ * Fixed bug with attachments with non-ascii characters in filename (thanks to
39
+ mtakada)
40
+ * checking for socket errors when checking mail (thanks elysian)
41
+ * fixed issue with multiple files not being inserted correctly
42
+ * Added support for ISO 8859-15 (thanks paolog)
43
+ * fixed sql injection problem (thanks Jose P. Espinal for pointing it out)
44
+ * Fixed namespace clashing for get_config function
45
+
46
+ = 1.4.1 (2010.06.18) =
47
+ * Images appear in correct order when using images append = false
48
+ * Fixed formatting problem with wordpress_default image template
49
+ * Captions now correctly work with wordpress >3.0 and <3.0
50
+ * Fixed auto_gallery feature
51
+ * Default port is now 110
52
+ * Added more configuration tests
53
+ * Added background color to settings page to make input boxes more visible
54
+ * Removed extra quote character in captions from #img# placeholders (thanks
55
+ SteelD for pointing out the error)
56
+ * Added support for big5 and gb-1232 encodings (thanks Chow)
57
+ * Fixed issue with configurations items stored as arrays, which caused
58
+ problems with validating authorized addresses
59
+ * Fixed bug with replaceImageCIDs function
60
+ * On hosts which allow it, we set max execution time to 300 seconds and
61
+ memory_limit to infinity to allow processing of large e-mails (especially
62
+ with large attachments)
63
+ * Images are sorted in order of filename before inserting into post
64
+
65
+ = 1.4 (2010.04.25) =
66
+ * Now using wordpress settings api (thanks for much help from Andrew S)
67
+ * Cronless postie is now integrated with postie instead of a separate plugin
68
+ * filterPostie.php moved to filterPostie.php.sample
69
+ * Can use fetchmails.php to fetch mail from multiple mailboxes
70
+ * Fixed problem with embedding youtube videos from html (richtext) e-mail
71
+ * Added support for embedding vimeo vidoes
72
+ * Fixed problem with selecting "none" as icon set for attachments (thanks
73
+ tonyvitali)
74
+ * Fixed problems with cronless postie settings
75
+ * Fixed bug with embedding youtube and vimeo videos whose ID contains a -
76
+ (thanks Jim Kehoe)
77
+ * Post_author is now included with attachments
78
+ * fixed confirmation_email settings so that now you can select between sender,
79
+ admin, both, or none (thanks to redsalmon for pointing out bug)
80
+ * Added option to automatically insert galleries
81
+ * Updated FAQ and readme
82
+
83
+ = 1.3.4 (2009.10.05) =
84
+ * Fixed problem with images not posting under cron
85
+ * Fixed issue with disappearing password
86
+
87
+ = 1.3.3 (2009.09.11) =
88
+ * Fixed problem with double titles
89
+ * Fixed error in wp-mu
90
+ * Cronless postie now correctly updates when changing the setting in the
91
+ postie settings
92
+ * Small fix in handling of names of attachments (thanks to Teejot)
93
+ * Fixed delay option (thanks to redbrandonk)
94
+ * Cronless option value is now correctly deleted when deactivating the
95
+ cronless postie plugin
96
+
97
+ = 1.3.2 (2009.08.27) =
98
+ * tags are now always an array, even if no default tags are set
99
+ * Subject is showing up again if you do not have the IMAP extension
100
+ installed
101
+ * More information on the IMAP extension and more user-friendly
102
+ installation
103
+ * Fixed problems with smtp server settings in 1.3.1
104
+ * Added russian translation (thanks to fatcow.com)
105
+
106
+ = 1.3.1 (2009.08.24) =
107
+ * Changed GetContent filter to postie_post
108
+ * Added database upgrade hook on activation
109
+ * Fixed bug where content would be empty if trying to remove signature,
110
+ and signature list was emtpy
111
+ * Updated FAQ and readme
112
+
113
+ = 1.3.0 (2009.08.14) =
114
+ * Features
115
+ * Added mpeg4 to default list of videotypes
116
+ * Added support for KOI8-R character set (cyrillic)
117
+ * Added support for iso-8859-2 character set (eastern european)
118
+ * Added option to include custom icons for attachments
119
+ * Added option to send confirmation message to sender
120
+ * Enhanced e-mails for unauthorized users
121
+ * Added option to send unauthorized e-mail back to sender
122
+ * Added option to only allow e-mails from a specified list of smtp
123
+ servers
124
+ * Added option to use shortcode for embedding videos (works with the
125
+ videos plugin http://www.daburna.de/download/videos-plugin.zip
126
+ * Better handling of comment authors (thanks to Petter for suggestion)
127
+ * Simplified message options (now includes an advanced options section)
128
+ * Added filter ability for post content
129
+ * Bug fixes
130
+ * No longer including wp-config.php
131
+ * If tmpdir is not writable, try a different tmpdir
132
+ * More subject encoding fixes
133
+ * Updated image templates, which were causing problems for cron
134
+ * Fixed in text captions
135
+ * Fixed SQL problems when updating options
136
+ * Fixed name clashes with other plugins
137
+ * Fixed custom image field
138
+
139
+ = 1.3.beta (2009.07.01) =
140
+ * Mores fixes for character issues in subject
141
+ * Now handling Windows-1256 (arabic) character set
142
+ * Fixed image uploading on windows servers
143
+ * Fixed replying to message adds comment
144
+ * Uploading pictures via MMS should now work
145
+ * Fixed some issues with e-mails from outloook 12
146
+ * Greatly reduced number of database queries
147
+ * No longer requiring config_handler.php
148
+
149
+ = 1.3.alpha (2009.06.05) =
150
+ * Now using default wordpress image and upload handling, which means:
151
+ * No more creating special directories for postie
152
+ * No more confusion about imagemagick
153
+ * Can now use the [gallery] feature of wordpress
154
+ * Attachments are now connected to posts in the database
155
+ * All image resizing uses wordpress's default settings (under media)
156
+ * Configuration, settings and documentation improvements
157
+ * Completely redesigned settings page (mostly thanks to Rainman)
158
+ * Reset configuration no longer deletes mailserver settings
159
+ * Now including help files and faq directly in settings page
160
+ * More media features
161
+ * Automatically turn links to youtube into an embedded player
162
+ * Added option to embed audio files with custom templates
163
+ * Video options are now template based
164
+ * Image options are now solely template based, with several new default
165
+ templates
166
+ * Bug fixes
167
+ * Uploading images from vodafone phones should now work
168
+ * Correctly handling Windows-1252 encoding
169
+ * Correctly handling non-ascii characters in subject line
170
+
171
+ = 1.2.3 (2009.05.17) =
172
+ * Fixed headers already sent bug
173
+ * Converted shortcode `<?` to proper `<?php` (thanks brack)
174
+ * Deleting mails after processing again
175
+
176
+ = 1.2.2 (2009.05.15) =
177
+ * Show empty categories for default category in options
178
+ * Image scaling fixed so that the smaller value of max image width and max
179
+ image height is used
180
+ * Fixed some issues with parsing html e-mail
181
+ * Got rid of stupid mime tag (thanks Jeroen)
182
+ * No longer adding slashes before calling wp_insert_post
183
+ * When using custom image field, each image has a unique key
184
+
185
+
186
+ = 1.2.1 (2009.05.07) =
187
+ * Got rid of stupid version checking
188
+ * Improved cronless postie instructions and configuration
189
+ * Internationalization is working now
190
+ * Dutch localization (thanks to gvmelle http://gvmelle.com )
191
+ * Fixed caption bug when using image magick
192
+ * Added option to not filter new lines (when using markdown syntax)
193
+ * Fixed autoplay option
194
+ * Can now use wildcards in excluding filenames
195
+ * Producing better quality thumbnails (thanks to robcarey)
196
+
197
+ = 1.2 (2009.04.22) =
198
+ * More video options:
199
+ * Can embed 3gp, mp4, mov videos
200
+ * Can specify video width, video height, player width, and player height
201
+ in the settings page
202
+ * Can specify custom image template
203
+ * Image handling improvements:
204
+ * Only downscale images, not up-scale (thanks Jarven)
205
+ * More custom image template options
206
+ * IPTC captions now also work when not resizing images
207
+ * Added option to use custom field for images (for Datapusher)
208
+ * Fixed some issues with image templates and line break handling
209
+ * Custom image template now works even when not resizing images
210
+ * Documentation improvements:
211
+ * Added links to settings, forum, and readme in plugin description
212
+ * Updated readme (thanks to Venkatraman Dhamodaran)
213
+ * Added better instructions on how to use cronless postie
214
+ * Text processing improvements:
215
+ * Added option to automatically convert urls into links
216
+ * Added feature to include a custom excerpt
217
+ * Miscellaneous improvements
218
+ * Improved internationalization (thanks to Håvard Broberg
219
+ (nanablag@nanablag.com))
220
+ * Bug Fixes
221
+ * Removed debugging info in get_mail.php (security issue) thanks to
222
+ [Jens]( http://svalgaard.net/jens/)
223
+ * No longer directly including pluggable.php (should
224
+ prevent conflicts with other plugins such as registerplus
225
+
226
+
227
+ = 1.1.5 (2009.03.10) =
228
+ * Added option to have postie posts be pending review, published, or draft
229
+ * Settings panel only shows up for administrators
230
+ * Need not be user "admin" to modify settings or to post from non-registered
231
+ users
232
+ * Can now set administrator name. Authorized e-mail addresses which don't
233
+ have a user get posted under this name
234
+ * Will use IPTC captions if available
235
+ * Added option to replace newline characters with <br />
236
+
237
+ = 1.1.4 (2009.03.06) =
238
+ * Added more image options (open in new window, custom image template)
239
+ * can now add captions to images
240
+ * Can now add tags (including default tag option)
241
+
242
+ = 1.1.3 (2009.02.20) =
243
+ * Fixed delayed posting
244
+ * updated readme some
245
+
246
+ = 1.1.2 (2008.07.12) =
247
+ * now maintained by Robert Felty
248
+ * allow negative delays
249
+ * will glean author information from forwarded or redirected e*mails
250
+ * replying to an e*mail adds a comment to a post
251
+ * fixed category handling to work with taxonomy
252
+ * fixed one syntax error
253
+ * added option to wrap posts and comments in <pre%gt; tags
254
+
255
+
256
+ = 1.1.1 =
257
+
258
+ Below is all the of the version information. As far as I can tell there once was a guy named John Blade. He took some of the original wp-mail.php code
259
+ and started hacking away on it. He actually got pretty far. About the time I discovered WordPress and his little hack - called WP-Mail at the time - he
260
+ went on a vacation or something. There were some problems with the script, and it was missing some features I wanted. I hacked away at it and got it
261
+ into a place where it did what I wanted. I started posting about it since I figured other people might want the features.
262
+
263
+ John didn't release any more versions at least up til July 2005. So I started accepting submissions and feature requests from people to help make the
264
+ code better. In June/July 2005 I discovered a little plugin by Chris J Davis (http://www.chrisjdavis.org/cjd-notepad/) called notepad. I added a small
265
+ feature to it (basically a bookmarklet). In the process I started looking at his code and realized how much you could do with the plugin system
266
+ available in Word Press.
267
+
268
+ So I decided to make an offical fork. I put up an article on my blog asking for new names. I picked Postie. I then modified the code to be a proper
269
+ plugin. And the rest is history :)
270
+
271
+ * BUGFIX -problem with subject
272
+ * BUGFIX -cronless postie typo
273
+
274
+ = 1.1 =
275
+ * FEATURE: Updated and tested with WordPress 2.1
276
+ * BUGFIX:Removed deprecated functions
277
+ * FEATURE: Cronless Postie now uses the WordPress native Psuedo Cron.
278
+
279
+ = 1.0 =
280
+ * BUGFIX: TestWPVersion broke with 2.1
281
+ * FEATURE: end: now marks the end of a message (Dan Cunningham)
282
+ * FEATURE: Better Readme (Michael Rasmussen)
283
+ * FEATURE: Smart Sharpen Option -EXPERIMENTAL- (Jonas Rhodin)
284
+ * BUGFIX: Issue with google imap fixed (Jim Hodgson)
285
+ * BUGFIX: Fixed espacing issue in subjects (Paul Clip)
286
+ * BUGFIX: Typo in Div fixed (phil)
287
+
288
+ = 0.9.9.3.2 =
289
+ * BUGFIX: Typo
290
+ = 0.9.9.3.1 =
291
+ * BUGFIX: Removed debugging code
292
+
293
+ = 0.9.9.3 =
294
+ * BUGFIX: If your email address matches an existing user - then it will post as that user - even if you allow anyone to post.
295
+ * BUGFIX: Replaced get_settings('home') with get_settings('siteurl')
296
+ * BUGFIX: Better handling for Japanese charactersets - Thanks to http://www.souzouzone.jp/blog/archives/009531.html
297
+ * BUGFIX: Better thumbnail window opening code - thanks to Gabi & Duntello!
298
+ * FEATURE: Added an option to set the MAX Height of an image - idea from Duntello
299
+ * BUGFIX: Modified the FilterNewLines for better flowed text handling - You now HAVE TO PUT TWO NEW LINES to end a paragraph.
300
+ * FEATURE: Added new CSS tags to support positioning images/attachments/3gp videos
301
+ * BUGFIX: Tries to use the date in the message (Thanks Ravan) I tried this once before and it never worked - hopefully this time it will.
302
+ * BUGFIX: Added a workaround to fix the problem with Subscribe2 - it will now notify on posts that are not set to show up in the future.
303
+
304
+
305
+
306
+ = 0.9.9.2 =
307
+ * BUGFIX: Looks for the NOOP error and disgards it
308
+ * FEATURE: Postie now detects the version of WordPress being used
309
+ * FEATURE: Smarter Parsing of VodaPhone
310
+ * FEATURE: Easy place to add new code to handle other brain-dead mail clients
311
+ * BUGFIX: Handles insertion of single quotes properly
312
+ * BUGFIX: Thumbnails should now link properly
313
+
314
+ = 0.9.9.1 =
315
+ * BUGFIX: Needed a strtolower in places to catch all iso-8859 - thx to Gitte Wange for the catch
316
+ * BUGFIX: Fixed issue with the category not being posted properly
317
+
318
+ = 0.9.9 =
319
+ * UPDATE TO WP 2.0
320
+ * BUGFIX: Config Page now works
321
+ * FEATURES: Supports role based posting
322
+ * BUGFIX: Posting updates the category counts.
323
+
324
+ = 0.9.8.6 =
325
+ * BUGFIX: Fixed problems with config page <%php became <?php
326
+ *
327
+ = 0.9.8.5 =
328
+ * BUGFIX: onClick changed to onclick
329
+ * BUGFIX: strolower added to test for iso - thanks daniele
330
+ * BUGFIX: Added a class to the 3gp video tags
331
+ * FEATURE: Added the option to put the images before the article
332
+ * BUGFIX: Added in selection for charsets - thanks Psykotik - this may cause problems for other encodings
333
+ * FEATURE: Added option to turn of quoted printable decoding
334
+ * FEATURE: :start tag - now postie looks for this tag before looking for you message - handy if your service provider prepends a message
335
+ * FEATURE: Template for translation now included
336
+ = 0.9.8.4 =
337
+ * BUGFIX: Fixed problem with config_form.php - select had "NULL" instead of ""
338
+ * BUGFIX: 3g2 now supported
339
+ * BUGFIX: More line break issues addressed
340
+ * BUGFIX: QuickTime controls are now visible even if the movie is done playing
341
+ * BUGFIX: Email addresses in the format <some@domain.com> (Full Name) supported
342
+ * BUGFIX: Some images that were not being resized - are now
343
+ * BUGFIX: HTML problems - if you posted plain text with HTML on it ignored all images
344
+ * BUGFIX: The test system blew up on the thumbnails
345
+ * BUGFIX: Selected HTML for preferred text is now shown in the config form properly
346
+ * BUGFIX: Postie now complains if it is not in its own directory
347
+ * BUGFIX: Postie doesn't include PEAR if it is already available
348
+ * BUGFIX: In Test mode rejected emails are simply dropped
349
+ * BUGFIX: Markdown messes up Postie - it will warn you if you turn it on.
350
+ *
351
+ = 0.9.8.3 =
352
+ * BUGFIX: Fixed issue with the line feed replacement
353
+ * BUGFIX: Added Banned File Config back in
354
+ * FEATURE: Added in a link around 3gp video embedded via QT
355
+ * BUGFIX: Email that has both Plain and HTML content will show the HTML content and not the plain if html is preferred
356
+
357
+ = 0.9.8.2 =
358
+ * BUGFIX: Fixed an extra new line after attachin non-image files.
359
+ * BUGFIX: The Test system now displays any missing gd functions
360
+ * BUGFIX: The test system was only using ImageMagick
361
+
362
+ = 0.9.8.1 =
363
+ * BUGFIX: The test images are now included in the zip
364
+
365
+ = 0.9.8 =
366
+ * BUGFIX: New Lines detected and handled properly in cases where the mail client doesn't put a space before the new line (Miss Distance)
367
+ * BUGFIX: 3gp mime type added (Paco Cotera)
368
+ * BUGFIX: Authorized Email Addresses are not case-insensitive
369
+ * FEATURE: The larger image now does a proper pop up
370
+ * BUGFIX: Fixed Timeing Issue - turns out it wasn't reading the db at all
371
+ * FEATURE: New Test Screen - to help track down problems
372
+
373
+ = 0.9.7 =
374
+ * BUGFIX: removed all short tags
375
+ * BUGFIX: There were spacing issues in the way I wrote the QT embed statements
376
+ * FEATURE: Added calls to WP-Cron - should work with that properly now if you activate Cronless Postie
377
+ * FEATURE: ImageMagick version works without any calls to GD
378
+ * BUGFIX: Postie now correctly handles cases wjere tjere are multiple blogs in one db
379
+ * BUGFIX: Turned off warnings when using without GD
380
+ * FEATURE: add the rotate:X to your message to rotate all images
381
+ * FEATURE: new filter_postie_thumbnail_with_full which makes it easy to show a thumbnail on the front page but full image on the single page - see FAQ
382
+
383
+ = 0.9.6 =
384
+ * BUGFIX: handles email addresses that are no name and just <email@email.com> (Steve Cooley Reported)
385
+ * FEATURE: Basic support for embedding flash files
386
+ * BUGFIX: Postie now handles creating the correct URL on non Unix platforms
387
+ * BUGFIX: Fixed problem with file attachments not being put in the right place.
388
+ * FEATURE: You can now choose to use imagemagick convert to handle making thumbnails
389
+ * BUGFIX: Rewrote Cronless Postie to use direct sockets
390
+ * BUGFIX: Time offset is now settable just for Postie - hopefully this will fix problems for cases where the normal time offset doesn't work properly.
391
+ * FEATURE: First draft of frame for a 3GP video
392
+ * FEATURE: Option to embed 3GP in QuickTime Controller.
393
+
394
+ = 0.9.5.2 =
395
+ * BUGFIX: gmt varialble not being set correctly
396
+ * BUGFIX: Changed the name of the Check Mail button to fix an issue with mod_security
397
+ * BUGFIX: Fixed issue with Cronless-Postie
398
+ * BUGFIX: There was an argument passed by reference incorrectly
399
+ * FEATURE: Added in Cronless Postie Readme
400
+ * FEATURE: Added in Postie Readme
401
+
402
+ = 0.9.5.1 =
403
+ * BUGFIX: Confirmed POP3-SSL on debian-3.0
404
+ * BUGFIX: Updated the plugin version
405
+ * BUGFIX: Stopped displaying the email account
406
+ *
407
+ = 0.9.5 =
408
+ * BUGFIX: Postie handles cases where you do not have GD
409
+ * FEATURE: You can now set the access level for posting - so other people can use the gate way
410
+ * BUGFIX: Fixed issue when admininstrator email is not tied to a user account.
411
+ * FEATURE: Can now reset all Postie configurations back to defaults
412
+ * BUGFIX: HTML Emails with embedded images are now handled properly.
413
+ * BUGFIX: The time difference should work correctly now
414
+ * BUGFIX: Postie's configs are completely seperate from Writing-By-Mail
415
+ * FEATURE: Warning if you use Gmail to make sure you turn on POP support
416
+ * BUGFIX: Manual Check Mail Button in interface
417
+ * BUGFIX: fixed issue of compatability with cjd-notepad
418
+ * BUGFIX: Windows Works Now
419
+
420
+
421
+ = 0.9.4 =
422
+ * BUGFIX: Cronless Postie - fixed the include statement
423
+ * BUGFIX: Authorized Addresses now supports a single address
424
+ * FEATURE: All configuration in Postie done in a single screen
425
+ * FEATURE: AUTHORIZATION can be completely overridden
426
+ * BUGFIX: line 1159 - didn't handle cases where the table didn't exist already very well
427
+ * FEATURE: Detects if you can do IMAP
428
+ * FEATURE: Added IMAP Support
429
+ * FEATURE: Added IMAP-SSL Support
430
+ * FEATURE: Added POP3-SSL Support
431
+
432
+ = 0.9.3 =
433
+ * Bug fixes for IIS
434
+ = 0.9.2 =
435
+ * Moved to more of a DIRECTORY_SEPARATOR structure
436
+ = 0.9.1 =
437
+ * Added a define to fix a problem with over including
438
+ = 0.9 =
439
+ * Converted to an honest to god plugin
440
+ * BUGFIX: If you put a single category:subject it now works
441
+ * BUGFIX: ? Special characters may be supported? The test post now shows a lot of umlats and accents?
442
+ * BUGFIX: The last ] in a subject with categories is now filtered out
443
+ * FEATURE: -1- subject - will put the post in category 1
444
+ = 0.312.13 =
445
+ * Code clean up - The main loop is finally readable by even non programmers
446
+ * FEATURE - You can now post to multiple categories at one time by using the [#],[Category Name], [Cat] in the subject
447
+ * FEATURE - You can now select a category by just including the begining characters [G] will select General
448
+ * if you don't have any other categories that start with g
449
+ * FEATURE - Jay Talbot - added a new feature so you can have multiple email addresses be allowed in
450
+ * Make multi category posting more obvious
451
+ * BUG FIX: Timezones of GMT+? should now work properly
452
+ * BUG FIX: Able to handle mis-mime typed images as long as they are named with .jpg/.gif/.png
453
+
454
+ = 0.312.12 =
455
+ * Code clean up - slowing shrinking the main to make it easiery to fix things
456
+ * FEATURE: Be able to turn on/off allowing comments in an email
457
+ * BUG FIX: AppleDouble now mostly supported
458
+ * BUG FIX: MIME handling improved.
459
+ * BUG FIX: Fix issue with timing delay
460
+ = 0.312.11 =
461
+ * FEATURE: Patterns to define where a sig starts are user configurable
462
+ * FEATURE: Add filter options for banned file names
463
+ * BUG FIX: Made it possible to turn off posting to the db for testing purposes
464
+ = 0.312.10 =
465
+ * FEATURE: Added in code to diplay the mime type of the file being linked to
466
+ * BUG FIX: It now tests for the existance of the directories and makes sure
467
+ * that the web server can write to them
468
+ = 0.312.9 =
469
+ * FEATURE:Should handle jpg as well as jpeg as the file type
470
+ * BUG FIX: Now correctly handles the subject in the message
471
+ * BUG FIX: Should handle Text preferences correctly
472
+ = 0.312.8 =
473
+ * Some general code tidying.
474
+ * FEATURE: Can now have email from invalid email addresses automatically forwared
475
+ * to the admin's email account. This forward includes all attachments.
476
+ * Props to David Luden for getting this started.
477
+ * Minor change: The system will continue if it runs into a message that doesn't have
478
+ * any content - it will also continue to process if it gets an email from
479
+ * someone not in the system. In the past this could result in deleted mail
480
+ * if your cron job didn't run often enough.
481
+ = 0.312.7 =
482
+ * Confirm the handling of 3gp video for cell phones o
483
+ * Added in new directive SUPPORTED_FILE_TYPES -if the mime type is listed here then the system will try to make a link to it without making a thumb nail.
484
+ = 0.312.6 =
485
+ * Bug Fix: Ok the last bug I fixed - actually caused another bug - man I should set up some unit tests. Now it handles mail from the nokia mail client correctly.
486
+ = 0.312.5 =
487
+ * Bug Fix : The system was accepting all test/* types. Now you can set a preference (defaults to text/plain)
488
+ * to use as the main text for the post.
489
+ = 0.312.4 =
490
+ * Added in sanitize_title call suggested by Jemima
491
+ * Added in ability to provide a subject in an mms - by using #Subject#
492
+ * Fixed an issue with the time stamp system so it now automatically uses the gmt_offset from WordPress
493
+ * Fixed issue with the delay:1d1h tag that prevented it from being removed from the body.
494
+ * Fixed issue with the delay tag that caused problems if it was the last thing before an image.
495
+
496
+ = 0.312.3-HEY (2005-05) =
497
+ * > Some changes and Bugfixes by Adrian Heydecker
498
+ * > Not (yet) in main development branch.
499
+ * Fixed bug: JPEG-thumbnails had a bigger filesize than full images caused by bad hardcoded compression value.
500
+ * Fixed bug: If images and signatures were present but no placeholder tags, the images were deleted together with the signature.
501
+ * Fixed bug: Generates valid postnames for users of mod_rewrite. Permalinks to posts should now work even when whitespaces are present in the subject line.
502
+ * Added support for Quoted Printable encoded mail.
503
+ * Added ability to encode Wordpress-posts in charset ISO-8859-1 instead of UTF-8.
504
+ * Added ability to choose JPEG-compression value for thumbnails.
505
+ * Added ability to add class="" and style="" to images.
506
+ * Added ability to use a different mailadress (eg. mobile) without setting up a new Wordpress-account.
507
+
508
+ = 0.312.2 =
509
+ * BUGFIX: It now removes the delay tag from the message
510
+ = 0.312.1 =
511
+ * Added modification for placeholder support for images (David Luden)
512
+ * Added in support to automatically scale down big images (Dirk Elmendorf)
513
+ * Fixed bug with multiple emails all getting the contents of the first image tag (Dirk Elmendorf)
514
+ * Added option to allow HTML in the body and subject of the email (Dirk Elmendorf)
515
+ * Switch config options to defines to reduce the number of global variables (Dirk Elmendorf)
516
+ * Added tests to make sure there is a trailing slash on the DIR definitions (Dirk Elmendorf)
517
+ * Add tests to see if they have gd installed (Dirk Elmendorf)
518
+ * Seperate the scaling out to a function for easier usage (Dirk Elmendorf)
519
+ * Add delay feature for future posting. (Dirk Elmendorf)
520
+ * Added in ability to use strtotime if it is available (Dirk ELmendorf)
521
+
522
+ * Todo
523
+ * Have option to have the email that is rejected forwarded on to another address.
524
+ * Fix bug that id still diplays the delay tag in the body
525
+ = 0.312 - 2005-03 =
526
+ * CHANGE FOR DEFAULT E-mail Categories, instead of [General] Subject you can now use General: Subject in the subject line. Less typing, and there must be a space after the colon.
527
+ * Fixed bugs with no default posting for categories and user
528
+ = 0.311 - 2005-01 =
529
+ * eep, major bug for pop3 server. Next time I test my code more before I released, fixed so that pop3 now works.`
530
+ = 0.31 - 2004-12 & 2005-01 =
531
+ * (Has it been this long, best get back into the swing of things... did most of this coding on my holiday as I didn't have a machine to play WoW on :)
532
+ * moved the deletion of pop3 emails into a check so that e-mails aren't deleted without proper checking.
533
+ * added HTML 'decoding' (basic support for Thunderbird & Outlook)
534
+ * updated the Category search so that it matches words as well as numbers (i.e. [General] Subjectname will work instead of just [1] Subjectname)
535
+ * Changed time function from time to strtotime (as per Senior Pez's suggestion), but found out that strtotime isn't in default php distro so removed...
536
+
537
+ = 0.3 - 2004-09 =
538
+ * Added UBB decoding support
539
+ * Added default title (when there is no subject assigned)
540
+ * Started doing a little code cleanup, been reading Advanced PHP Book :)
541
+ *
542
+ = 0.2 - 2004-08 =
543
+ * Stopped using pear body decoding in favour of own decoding (may be slower but more modifiable) because of enriched text decoding
544
+ * Added base64_decode checking (may help mobile phone users)
545
+ * Fixed Subject line for non-english users (htmlentities instead of just trim)
546
+ * Fixed error in some pop hanging -> more graceful exit on event on no emails in inbox ($pop3->quit)
547
+ * Added work around for email addresses with exta <> in field (ie: <blade@lansmash.com> instead of blade@lasmash.com
548
+ * Added some ===basic=== enriched text support
549
+ * Updated readme file for easier install
550
+ * Easy modify of globals (such as PHOTOSDIR and FILESDIR)
551
+ * Cleaned up some pear stuff in install
552
+ *
553
+ = 0.1 - 2004-06 =
554
+ * First release
docs/FAQ.txt ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ == Frequently Asked Questions ==
2
+
3
+ = Postie won't connect to my mailserver. Why Not? =
4
+
5
+ Make sure the port you are using is open. For example, bluehost seems to block
6
+ ports 993 and 995 (for pop3-ssl and imap-ssl) by default. I have heard that
7
+ you can request that they open them for you ( you might have to pay extra).
8
+
9
+ You can check for open ports with the following command on your server:
10
+ netstat -ln|grep -E ':::(993|995|143)'
11
+
12
+ If nothing shows up, then the ports are not open.
13
+
14
+ = How can I get postie to display inline images? =
15
+
16
+ Make sure that you send e-mail formatted as html (richtext), and set postie to
17
+ prefer html messages (in the message tab of the postie settings)
18
+
19
+ = Mail is not showing up right when I send html (rich formatted) e-mail! =
20
+
21
+ Make sure you set the preferred text type to html
22
+
23
+ = Do I need to any code to my theme for postie to work? =
24
+
25
+ No.
26
+
27
+ = I read somewhere to add an iframe to my footer. Should I do this? =
28
+
29
+ No. Do not add an iframe in your footer to get postie to check mail
30
+ periodically. To check e-mail periodically, either set-up a cron job, or use
31
+ cronless postie. See installation instructions
32
+
33
+ = My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl =
34
+
35
+ You must have php-imap installed on your server for this to work. Ask your
36
+ hosting provider about this.
37
+
38
+ = Can I use postie to check a gmail account? =
39
+
40
+ Yes. You can use either pop3-ssl or imap-ssl with a gmail account. Before
41
+ attempting to use with postie, make sure that you enable pop or imap in your
42
+ gmail preferences.
43
+
44
+ * Pop3 settings:
45
+ * protocol - pop3-ssl
46
+ * server - pop.gmail.com
47
+ * port - 995
48
+ * userid - your username (e.g. if your e-mail address is foo@gmail.com,
49
+ this would be just foo)
50
+ * password - your password
51
+ * IMAP settings:
52
+ * protocol - imap-ssl
53
+ * server - imap.gmail.com
54
+ * port - 993
55
+ * userid - your username (e.g. if your e-mail address is foo@gmail.com,
56
+ this would be just foo)
57
+ * password - your password
58
+
59
+ = My posts show up as being posted by 'admin' instead of me. Why? =
60
+
61
+ If your admin account is linked to bar@gmail.com, and you send mail from
62
+ bar@gmail.com, it will show up as being posted by admin. If you have a
63
+ wordpress user named "John Doe", which is linked to johndoe@gmail.com, make
64
+ sure that you send e-mails from johndoe@gmail.com. It doesn't matter which
65
+ e-mail address postie is checking. That is, if you send mail from
66
+ johndoe@gmail.com to foo@gmail.com, it gets posted as "John Doe".
67
+
68
+ If you send an e-mail to your postie address from an e-mail address that is no
69
+ t linked to a wordpress user, it will get posted as admin.
70
+
71
+ = Images aren't showing up at all? =
72
+
73
+ There are a couple possible reasons for this. First, check to see if you can
74
+ add an image through wordpress's normal posting mechanism. If not, then there
75
+ is probably 1 or 2 problems:
76
+ 1. Your server does not have the php-gd library installed. Ask your hosting
77
+ provider about this.
78
+
79
+ 2. Your wp-content/uploads directory is not writable by the webserver. Make
80
+ sure that it is
81
+
82
+ = Can I delete the wp-files directory needed by postie version <1.3.0? =
83
+
84
+ If you have posts published already by older versions of postie, getting rid
85
+ of those directories will delete any files you might have had associated with
86
+ those old posts. If you don't have any such posts, then you can safely delete
87
+ them.
88
+
89
+ = How can I get rid of stupid stuff my e-mail provider adds to my messages? =
90
+
91
+ To strip off stuff that they add at the beginning of a message, start your
92
+ post with :start
93
+
94
+ To strip off stuff that they add at the end of a message, end your
95
+ post with :end
96
+
97
+ = How can I add custom attachment icons? =
98
+
99
+ Simply upload the icons you want to the postie/icons/custom directory. You
100
+ must name the icons according to the following scheme:
101
+ `{filetype}-{size}.png`
102
+
103
+ For example, for word documents, you could use:
104
+
105
+ `doc-32.png`
106
+
107
+ for a 32x32 pixel icon. (You can actually create any size icon you want, but
108
+ if you name it 32, then it will only be used if you select to use size 32
109
+ icons)
110
+
111
+ See the other directories in icons for more examples.
112
+
113
+ Currently the following filetypes are supported:
114
+
115
+ * doc - microsoft word (including docx)
116
+ * ppt - microsoft powerpoint (including pptx)
117
+ * xls - microsoft excel (including xlsx)
118
+ * numbers - iWork numbres spreadsheet
119
+ * pages - iWork pages document
120
+ * key - iWork keynote presentation
121
+ * pdf - portable document format
122
+ * rtf - rich text format
123
+ * txt - plain text document
124
+
125
+ = Can I add special text to the body of the post when using postie? =
126
+
127
+ Yes. You can create your own function, and use the postie_post filter.
128
+ Two short examples are included in the filterPostie.php.sample file
129
+
130
+ = Can I add special text to the title of the post when using postie? =
131
+
132
+ Yes. You can create your own function, and use the postie_post filter.
133
+ Two short examples are included in the filterPostie.php.sample file
134
+
135
+ = Can I select tags or categories based on the content of the e-mail? =
136
+
137
+ Yes. You can create your own function, and use the postie_post filter.
138
+ See the filterPostie.php.sample file for examples.
139
+
140
+ = Is the IMAP extension required for postie? =
141
+
142
+ The IMAP extension is not required, but it is strongly recommended, especially
143
+ is you are using non-English text. There is more information on php.net about
144
+ installing the IMAP extension. If you have control over your server, it is
145
+ often not hard to install.
146
+
147
+ On Ubuntu, try
148
+ `sudo apt-get install php5-imap`
149
+
150
+ On Fedora, try
151
+ `sudo yuminstall php-imap`
152
+
153
+ The IMAP extension is known to be installed on the following popular webhosts:
154
+ * Dreamhost
155
+
156
+ = How can I embed youtube or vimeo videos? =
157
+
158
+ Simply put the url in the body of your e-mail. (Make sure that you have the
159
+ option to convert url into links turned on)
160
+
161
+ = Something is going wrong, how do I see what is happening? =
162
+
163
+ Add the following lines to your wp-config.php file
164
+ `define('WP_DEBUG', true);
165
+ define('WP_DEBUG_LOG', true);
166
+ define('POSTIE_DEBUG', true);`
167
+
168
+ Various errors, warning and informational will be written to the wp-content\debug.log
169
+ file. There may also be all sorts of warnings and messages in your site as well
170
+ depending on how well behaved your other plugins and themes are, so you will not
171
+ want to leave these settings set to true all the time.
172
+
173
+ = Why doesn't Postie automatically publish my emails when running manually works =
174
+
175
+ WordPress cron (which Postie relies on) doesn't run unless a page is accessed on the
176
+ site. So if you send an email, but nobody accesses the site for 3 days Postie won't
177
+ be given the chance to fetch the email and publish the post.
178
+
179
+ To ensure that Postie runs smoothly on a low or no volume site you need to ensure that
180
+ a page gets hit (any page is fine). Use something like cron + curl on Linux or install
181
+ curl on Windows and use the Scheduled Tasks control panel. If you are using a hosting company
182
+ that doesn't allow you access to cron you can use a service like
183
+ <a href="https://www.setcronjob.com/" target="_blank">SetCronJob</a>.
184
+
185
+ It is also possible to turn the WordPress cron off. Please make sure something like
186
+ define('DISABLE_WP_CRON', true); is not in your wp-config.php file.
docs/Installation.txt ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ == Installation ==
2
+ * Either:
3
+ * Put the postie.zip file in wp-content/plugins/ and unzip it
4
+ * Or:
5
+ * Use the automatic installer (WP 2.7+)
6
+ * Login to WordPress as an administrator
7
+ * Goto the Plugins tab in the WordPress Admin Site
8
+ * Activate "Postie"
9
+ * Goto to the "Settings" tab and click on the sub-tab "Postie" to configure it.
10
+ * Make sure you enter the mailserver information correctly, including the type
11
+ of connection and the port number. Common port configurations:
12
+ * pop3: 110
13
+ * pop3-ssl: 995
14
+ * imap: 143
15
+ * imap-ssl: 993
16
+ * (Postie ignores the settings under Settings->Writing->Writing-by-Email)
17
+
18
+ = Automating checking e-mail =
19
+
20
+ By default, postie checks for new e-mail every 30 minutes. You can select from
21
+ a number of different checking intervals in the settings page, under the
22
+ mailserver tab.
23
+
24
+ If you would prefer to have more fine-grained control of how postie checks
25
+ for mail, you can also set up a crontab. This is for advanced users only.
26
+ If your site runs on a UNIX/linux server, and you have shell access, you can
27
+ enable mail checking using cron; if you don't know anything about cron, skip
28
+ to the cronless postie section.
29
+
30
+ Setup a cronjob to pull down the get\_mail.php
31
+ Examples:
32
+
33
+ */5 * * * * /usr/bin/lynx --source http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php >/dev/null 2>&1
34
+
35
+ This fetches the mail every five minutes with lynx
36
+
37
+ */10 * * * * /usr/bin/wget -O /dev/null http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php >/dev/null 2>&1
38
+
39
+ This fetches the mail every ten minutes with wget
docs/Postie.txt ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Postie ===
2
+ Contributors: WayneAllen
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HPK99BJ88V4C2
4
+ Author URI: http://allens-home.com/
5
+ Plugin URI: http://PostiePlugin.com/
6
+ Tags: e-mail, email
7
+ Requires at least: 3.0
8
+ Tested up to: 3.4.2
9
+ Stable tag: 1.4.6
10
+ License: GPLv2 or later
11
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
+
13
+ The Postie plugin allows you to blog via e-mail, including many advanced
14
+ features not found in WordPress's default post by e-mail feature.
15
+
16
+ == Description ==
17
+ Postie offers many advanced features for posting to your blog via e-mail,
18
+ including the ability to assign categories by name, included pictures and
19
+ videos, and automatically strip off signatures. It also has support for both
20
+ imap and pop3, with the option for ssl with both. For usage notes, see the
21
+ [other notes](other_notes) page
22
+
23
+ == Screenshots ==
24
+
25
+ 1. Postie options (showing video and audio templates)
docs/Usage.txt ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ == Usage ==
2
+ * If you put in :start - the message processing won't start until it sees that string
3
+ * If you put in :end - the message processing will stop once it sees that string
4
+ * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
5
+ * delay:1d - 1 day
6
+ * delay:1h - 1 hour
7
+ * delay:1m - 1 minute
8
+ * delay:1d2h4m - 1 day 2 hours 4m
9
+ * By putting comments:X in your message you can control if comments are allowed
10
+ * comments:0 - means closed
11
+ * comments:1 - means open
12
+ * comments:2 - means registered only
13
+ * Replying to an e-mail gets posted as a comment.
14
+ * For example, you e-mailed a post with the subject line "foo".
15
+ If you then send an e-mail with the subject line "Re: foo", it will
16
+ get posted as a comment to the "foo" post. This works by the subject
17
+ line, so if you have two posts with titles "foo", then the comment
18
+ will get placed in the more recent post.
19
+ * Custom excerpt
20
+ * You can include a custom excerpt of an e-mail by putting it between
21
+ :excerptstart and :excerptend
22
+ * You can include images in the excerpt by using the shortcode #eimg1#,
23
+ #eimg2# etc.
24
+
25
+ = Post type =
26
+ You can specify the post type by including it as the first part of the subject
27
+ E.g. <post type>//<real subject>
28
+
29
+ = Category and tag handling =
30
+ * If you put a category name in the subject with a : it will be used
31
+ as the category for the post
32
+ * If you put a category id number in the subject with a : it will
33
+ be used as the category for the post
34
+ * If you put the first part of a category name it will be posted in
35
+ the first category that the system finds that matches - so if you put
36
+
37
+ Subject: Gen: New News
38
+
39
+ The system will post that in General.
40
+
41
+ * All of the above also applies if you put the category in brackets []
42
+ * Using [] or you can post to multiple categories at once
43
+
44
+ Subject: [1] [Mo] [Br] My Subject
45
+
46
+ On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
47
+
48
+ * Using - or you can post to multiple categories at once
49
+
50
+ Subject: -1- -Mo- -Br- My Subject
51
+
52
+ On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
53
+
54
+ = Tags =
55
+ * You can add tags by adding a line in the body of the message like so:
56
+ tags: foo, bar
57
+ * You can also set a default tag to be applied if no tags are included.
58
+
59
+ = Image Handling =
60
+ * Allows you to attach images to your email and automatically post
61
+ them to your blog
62
+ * You can publish images in the text of your message by using #img1#
63
+ #img2# - each one will be replaced with the HTML for the image
64
+ you attached
65
+ * Captions - you can also add a caption like so:
66
+
67
+ * #img1 caption='foo'#
68
+ * #img2 caption='bar'#
69
+
70
+ Or, if you use IPTC captions, this caption will be used (adding a caption
71
+ in many photo editing programs (for example Picasa), will add an IPTC caption)
72
+
73
+ Note that the images are processed in the order they are attached as of version
74
+ 1.4.6.
75
+
76
+ * Image templates
77
+ Postie now uses the default wordpress image template, but you can specify a
78
+ different one if you wish.
79
+
80
+ You can also specify a custom image template. I use the following custom
81
+ template:
82
+
83
+ `<div class='imageframe alignleft'><a href='{IMAGE}'><img src="{THUMBNAIL}"
84
+ alt="{CAPTION}" title="{CAPTION}"
85
+ class="attachment" /></a><div
86
+ class='imagecaption'>{CAPTION}</div></div>`
87
+
88
+ * {THUMBNAIL} gets replaced with the url to the thumbnail image
89
+ * {MEDIUM} gets replaced with the url to the medium-sized image
90
+ * {LARGE} gets replaced with the url to the large-sized image
91
+ * {FULL} gets replaced with the url to the full-sized image
92
+ * {FILENAME} gets replaced with the absolute path to the full-size image
93
+ * {RELFILENAME} gets replaced with the relative path to the full-size image
94
+ * {CAPTION} gets replaced with the caption you specified (if any)
95
+ * {WIDTH} gets replaced with width of the photo
96
+ * {HEIGHT} gets replaced with the height of the photo
97
+
98
+ = Interoperability =
99
+ * If your mail client doesn't support setting the subject (nokia) you
100
+ can do so by putting #your title here# at the beginning of your message
101
+ * POP3,POP3-SSL,IMAP,IMAP-SSL now supported - last three require
102
+ php-imap support
103
+ * The program understands enough about mime to not duplicate post
104
+ if you send an HTML and plain text message
105
+ * Automatically confirms that you are installed correctly
faq.html CHANGED
@@ -1,178 +1,220 @@
1
- <ul>
2
- <li id='question-0'><a href='#answer-0'>How can I get postie to display inline images?</a></li>
3
- <li id='question-1'><a href='#answer-1'>Mail is not showing up right when I send html (rich formatted) e-mail!</a></li>
4
- <li id='question-2'><a href='#answer-2'>Do I need to any code to my theme for postie to work?</a></li>
5
- <li id='question-3'><a href='#answer-3'>I read somewhere to add an iframe to my footer. Should I do this?</a></li>
6
- <li id='question-4'><a href='#answer-4'>My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl</a></li>
7
- <li id='question-5'><a href='#answer-5'>Can I use postie to check a gmail account?</a></li>
8
- <li id='question-6'><a href='#answer-6'>My posts show up as being posted by 'admin' instead of me. Why?</a></li>
9
- <li id='question-7'><a href='#answer-7'>Images aren't showing up at all?</a></li>
10
- <li id='question-8'><a href='#answer-8'>Can I delete the wp-files directory needed by postie version &lt;1.3.0?</a></li>
11
- <li id='question-9'><a href='#answer-9'>How can I get rid of stupid stuff my e-mail provider adds to my messages?</a></li>
12
- <li id='question-10'><a href='#answer-10'>How can I add custom attachment icons?</a></li>
13
- <li id='question-11'><a href='#answer-11'>Can I add special text to the body of the post when using postie?</a></li>
14
- <li id='question-12'><a href='#answer-12'>Can I add special text to the title of the post when using postie?</a></li>
15
- <li id='question-13'><a href='#answer-13'>Can I select tags or categories based on the content of the e-mail?</a></li>
16
- <li id='question-14'><a href='#answer-14'>Is the IMAP extension required for postie?</a></li>
17
- <li id='question-15'><a href='#answer-15'>How can I embed youtube or vimeo videos?</a></li>
18
- </ul>
19
- <h3>Frequently Asked Questions</h3>
20
- <h4 id='answer-0'>How can I get postie to display inline images?</h4>
21
-
22
- <p>Make sure that you send e-mail formatted as html (richtext), and set postie to
23
- prefer html messages (in the message tab of the postie settings)</p>
24
-
25
- <h4 id='answer-1'>Mail is not showing up right when I send html (rich formatted) e-mail!</h4>
26
-
27
- <p>Make sure you set the preferred text type to html</p>
28
-
29
- <h4 id='answer-2'>Do I need to any code to my theme for postie to work?</h4>
30
-
31
- <p>No.</p>
32
-
33
- <h4 id='answer-3'>I read somewhere to add an iframe to my footer. Should I do this?</h4>
34
-
35
- <p>No. Do not add an iframe in your footer to get postie to check mail
36
- periodically. To check e-mail periodically, either set-up a cron job, or use
37
- cronless postie. See installation instructions</p>
38
-
39
- <h4 id='answer-4'>My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl</h4>
40
-
41
- <p>You must have php-imap installed on your server for this to work. Ask your
42
- hosting provider about this.</p>
43
-
44
- <h4 id='answer-5'>Can I use postie to check a gmail account?</h4>
45
-
46
- <p>Yes. You can use either pop3-ssl or imap-ssl with a gmail account. Before
47
- attempting to use with postie, make sure that you enable pop or imap in your
48
- gmail preferences.</p>
49
-
50
- <ul>
51
- <li>Pop3 settings:
52
-
53
- <ul>
54
- <li>protocol - pop3-ssl</li>
55
- <li>server - pop.gmail.com</li>
56
- <li>port - 995</li>
57
- <li>userid - your username (e.g. if your e-mail address is <a href="mailto:foo@gmail.com">foo@gmail.com</a>,
58
- this would be just foo)</li>
59
- <li>password - your password </li>
60
- </ul></li>
61
- <li>IMAP settings:
62
-
63
- <ul>
64
- <li>protocol - imap-ssl</li>
65
- <li>server - imap.gmail.com</li>
66
- <li>port - 993</li>
67
- <li>userid - your username (e.g. if your e-mail address is <a href="mailto:foo@gmail.com">foo@gmail.com</a>,
68
- this would be just foo)</li>
69
- <li>password - your password </li>
70
- </ul></li>
71
- </ul>
72
-
73
- <h4 id='answer-6'>My posts show up as being posted by 'admin' instead of me. Why?</h4>
74
-
75
- <p>If your admin account is linked to <a href="mailto:bar@gmail.com">bar@gmail.com</a>, and you send mail from
76
- <a href="mailto:bar@gmail.com">bar@gmail.com</a>, it will show up as being posted by admin. If you have a
77
- wordpress user named "John Doe", which is linked to <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a>, make
78
- sure that you send e-mails from <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a>. It doesn't matter which
79
- e-mail address postie is checking. That is, if you send mail from
80
- <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a> to <a href="mailto:foo@gmail.com">foo@gmail.com</a>, it gets posted as "John Doe".</p>
81
-
82
- <p>If you send an e-mail to your postie address from an e-mail address that is no
83
- t linked to a wordpress user, it will get posted as admin.</p>
84
-
85
- <h4 id='answer-7'>Images aren't showing up at all?</h4>
86
-
87
- <p>There are a couple possible reasons for this. First, check to see if you can
88
- add an image through wordpress's normal posting mechanism. If not, then there
89
- is probably 1 or 2 problems:
90
- 1. Your server does not have the php-gd library installed. Ask your hosting
91
- provider about this.</p>
92
-
93
- <ol>
94
- <li>Your wp-content/uploads directory is not writable by the webserver. Make
95
- sure that it is</li>
96
- </ol>
97
-
98
- <h4 id='answer-8'>Can I delete the wp-files directory needed by postie version &lt;1.3.0?</h4>
99
-
100
- <p>If you have posts published already by older versions of postie, getting rid
101
- of those directories will delete any files you might have had associated with
102
- those old posts. If you don't have any such posts, then you can safely delete
103
- them.</p>
104
-
105
- <h4 id='answer-9'>How can I get rid of stupid stuff my e-mail provider adds to my messages?</h4>
106
-
107
- <p>To strip off stuff that they add at the beginning of a message, start your
108
- post with :start</p>
109
-
110
- <p>To strip off stuff that they add at the end of a message, end your
111
- post with :end</p>
112
-
113
- <h4 id='answer-10'>How can I add custom attachment icons?</h4>
114
-
115
- <p>Simply upload the icons you want to the postie/icons/custom directory. You
116
- must name the icons according to the following scheme:
117
- {filetype}-{size}.png</p>
118
-
119
- <p>For example, for word documents, you could use:</p>
120
-
121
- <pre><code>doc-32.png
122
- </code></pre>
123
-
124
- <p>for a 32x32 pixel icon. (You can actually create any size icon you want, but
125
- if you name it 32, then it will only be used if you select to use size 32
126
- icons)</p>
127
-
128
- <p>See the other directories in icons for more examples.</p>
129
-
130
- <p>Currently the following filetypes are supported:</p>
131
-
132
- <ul>
133
- <li>doc - microsoft word (including docx)</li>
134
- <li>ppt - microsoft powerpoint (including pptx)</li>
135
- <li>xls - microsoft excel (including xlsx)</li>
136
- <li>numbers - iWork numbres spreadsheet</li>
137
- <li>pages - iWork pages document</li>
138
- <li>key - iWork keynote presentation</li>
139
- <li>pdf - portable document format</li>
140
- <li>rtf - rich text format</li>
141
- <li>txt - plain text document</li>
142
- </ul>
143
-
144
- <h4 id='answer-11'>Can I add special text to the body of the post when using postie?</h4>
145
-
146
- <p>Yes. You can create your own function, and use the postie_post filter.
147
- Two short examples are included in the filterPostie.php.sample file</p>
148
-
149
- <h4 id='answer-12'>Can I add special text to the title of the post when using postie?</h4>
150
-
151
- <p>Yes. You can create your own function, and use the postie_post filter.
152
- Two short examples are included in the filterPostie.php.sample file</p>
153
-
154
- <h4 id='answer-13'>Can I select tags or categories based on the content of the e-mail?</h4>
155
-
156
- <p>Yes. You can create your own function, and use the postie_post filter.
157
- See the filterPostie.php.sample file for examples.</p>
158
-
159
- <h4 id='answer-14'>Is the IMAP extension required for postie?</h4>
160
-
161
- <p>The IMAP extension is not required, but it is strongly recommended, especially
162
- is you are using non-English text. There is more information on php.net about
163
- installing the IMAP extension. If you have control over your server, it is
164
- often not hard to install.</p>
165
-
166
- <p>On Ubuntu, try
167
- sudo apt-get install php5-imap</p>
168
-
169
- <p>On Fedora, try
170
- sudo yuminstall php-imap</p>
171
-
172
- <p>The IMAP extension is known to be installed on the following popular webhosts:
173
- * Dreamhost</p>
174
-
175
- <h4 id='answer-15'>How can I embed youtube or vimeo videos?</h4>
176
-
177
- <p>Simply put the url in the body of your e-mail. (Make sure that you have the
178
- option to convert url into links turned on)</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <li id='question-0'><a href='#answer-0'>Postie won't connect to my mailserver. Why Not?</a></li>
2
+ <li id='question-1'><a href='#answer-1'>How can I get postie to display inline images?</a></li>
3
+ <li id='question-2'><a href='#answer-2'>Mail is not showing up right when I send html (rich formatted) e-mail!</a></li>
4
+ <li id='question-3'><a href='#answer-3'>Do I need to any code to my theme for postie to work?</a></li>
5
+ <li id='question-4'><a href='#answer-4'>I read somewhere to add an iframe to my footer. Should I do this?</a></li>
6
+ <li id='question-5'><a href='#answer-5'>My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl</a></li>
7
+ <li id='question-6'><a href='#answer-6'>Can I use postie to check a gmail account?</a></li>
8
+ <li id='question-7'><a href='#answer-7'>My posts show up as being posted by 'admin' instead of me. Why?</a></li>
9
+ <li id='question-8'><a href='#answer-8'>Images aren't showing up at all?</a></li>
10
+ <li id='question-9'><a href='#answer-9'>Can I delete the wp-files directory needed by postie version &lt;1.3.0?</a></li>
11
+ <li id='question-10'><a href='#answer-10'>How can I get rid of stupid stuff my e-mail provider adds to my messages?</a></li>
12
+ <li id='question-11'><a href='#answer-11'>How can I add custom attachment icons?</a></li>
13
+ <li id='question-12'><a href='#answer-12'>Can I add special text to the body of the post when using postie?</a></li>
14
+ <li id='question-13'><a href='#answer-13'>Can I add special text to the title of the post when using postie?</a></li>
15
+ <li id='question-14'><a href='#answer-14'>Can I select tags or categories based on the content of the e-mail?</a></li>
16
+ <li id='question-15'><a href='#answer-15'>Is the IMAP extension required for postie?</a></li>
17
+ <li id='question-16'><a href='#answer-16'>How can I embed youtube or vimeo videos?</a></li>
18
+ <li id='question-17'><a href='#answer-17'>Something is going wrong, how do I see what is happening?</a></li>
19
+ <li id='question-18'><a href='#answer-18'>Why doesn't Postie automatically publish my emails when running manually works</a></li>
20
+ <h3>Frequently Asked Questions</h3>
21
+ <h4 id='answer-0'>Postie won't connect to my mailserver. Why Not?</h4>
22
+
23
+ <p>Make sure the port you are using is open. For example, bluehost seems to block
24
+ ports 993 and 995 (for pop3-ssl and imap-ssl) by default. I have heard that
25
+ you can request that they open them for you ( you might have to pay extra).</p>
26
+
27
+ <p>You can check for open ports with the following command on your server:
28
+ netstat -ln|grep -E ':::(993|995|143)'</p>
29
+
30
+ <p>If nothing shows up, then the ports are not open.</p>
31
+
32
+ <h4 id='answer-1'>How can I get postie to display inline images?</h4>
33
+
34
+ <p>Make sure that you send e-mail formatted as html (richtext), and set postie to
35
+ prefer html messages (in the message tab of the postie settings)</p>
36
+
37
+ <h4 id='answer-2'>Mail is not showing up right when I send html (rich formatted) e-mail!</h4>
38
+
39
+ <p>Make sure you set the preferred text type to html</p>
40
+
41
+ <h4 id='answer-3'>Do I need to any code to my theme for postie to work?</h4>
42
+
43
+ <p>No.</p>
44
+
45
+ <h4 id='answer-4'>I read somewhere to add an iframe to my footer. Should I do this?</h4>
46
+
47
+ <p>No. Do not add an iframe in your footer to get postie to check mail
48
+ periodically. To check e-mail periodically, either set-up a cron job, or use
49
+ cronless postie. See installation instructions</p>
50
+
51
+ <h4 id='answer-5'>My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl</h4>
52
+
53
+ <p>You must have php-imap installed on your server for this to work. Ask your
54
+ hosting provider about this.</p>
55
+
56
+ <h4 id='answer-6'>Can I use postie to check a gmail account?</h4>
57
+
58
+ <p>Yes. You can use either pop3-ssl or imap-ssl with a gmail account. Before
59
+ attempting to use with postie, make sure that you enable pop or imap in your
60
+ gmail preferences.</p>
61
+
62
+ <ul>
63
+ <li>Pop3 settings:
64
+
65
+ <ul>
66
+ <li>protocol - pop3-ssl</li>
67
+ <li>server - pop.gmail.com</li>
68
+ <li>port - 995</li>
69
+ <li>userid - your username (e.g. if your e-mail address is <a href="mailto:foo@gmail.com">foo@gmail.com</a>,
70
+ this would be just foo)</li>
71
+ <li>password - your password </li>
72
+ </ul></li>
73
+ <li>IMAP settings:
74
+
75
+ <ul>
76
+ <li>protocol - imap-ssl</li>
77
+ <li>server - imap.gmail.com</li>
78
+ <li>port - 993</li>
79
+ <li>userid - your username (e.g. if your e-mail address is <a href="mailto:foo@gmail.com">foo@gmail.com</a>,
80
+ this would be just foo)</li>
81
+ <li>password - your password </li>
82
+ </ul></li>
83
+ </ul>
84
+
85
+ <h4 id='answer-7'>My posts show up as being posted by 'admin' instead of me. Why?</h4>
86
+
87
+ <p>If your admin account is linked to <a href="mailto:bar@gmail.com">bar@gmail.com</a>, and you send mail from
88
+ <a href="mailto:bar@gmail.com">bar@gmail.com</a>, it will show up as being posted by admin. If you have a
89
+ wordpress user named "John Doe", which is linked to <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a>, make
90
+ sure that you send e-mails from <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a>. It doesn't matter which
91
+ e-mail address postie is checking. That is, if you send mail from
92
+ <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a> to <a href="mailto:foo@gmail.com">foo@gmail.com</a>, it gets posted as "John Doe".</p>
93
+
94
+ <p>If you send an e-mail to your postie address from an e-mail address that is no
95
+ t linked to a wordpress user, it will get posted as admin.</p>
96
+
97
+ <h4 id='answer-8'>Images aren't showing up at all?</h4>
98
+
99
+ <p>There are a couple possible reasons for this. First, check to see if you can
100
+ add an image through wordpress's normal posting mechanism. If not, then there
101
+ is probably 1 or 2 problems:
102
+ 1. Your server does not have the php-gd library installed. Ask your hosting
103
+ provider about this.</p>
104
+
105
+ <ol>
106
+ <li>Your wp-content/uploads directory is not writable by the webserver. Make
107
+ sure that it is</li>
108
+ </ol>
109
+
110
+ <h4 id='answer-9'>Can I delete the wp-files directory needed by postie version &lt;1.3.0?</h4>
111
+
112
+ <p>If you have posts published already by older versions of postie, getting rid
113
+ of those directories will delete any files you might have had associated with
114
+ those old posts. If you don't have any such posts, then you can safely delete
115
+ them.</p>
116
+
117
+ <h4 id='answer-10'>How can I get rid of stupid stuff my e-mail provider adds to my messages?</h4>
118
+
119
+ <p>To strip off stuff that they add at the beginning of a message, start your
120
+ post with :start</p>
121
+
122
+ <p>To strip off stuff that they add at the end of a message, end your
123
+ post with :end</p>
124
+
125
+ <h4 id='answer-11'>How can I add custom attachment icons?</h4>
126
+
127
+ <p>Simply upload the icons you want to the postie/icons/custom directory. You
128
+ must name the icons according to the following scheme:</p>
129
+
130
+ <pre><code>{filetype}-{size}.png</code></pre>
131
+
132
+ <p>For example, for word documents, you could use:</p>
133
+
134
+ <pre><code>doc-32.png</code></pre>
135
+
136
+ <p>for a 32x32 pixel icon. (You can actually create any size icon you want, but
137
+ if you name it 32, then it will only be used if you select to use size 32
138
+ icons)</p>
139
+
140
+ <p>See the other directories in icons for more examples.</p>
141
+
142
+ <p>Currently the following filetypes are supported:</p>
143
+
144
+ <ul>
145
+ <li>doc - microsoft word (including docx)</li>
146
+ <li>ppt - microsoft powerpoint (including pptx)</li>
147
+ <li>xls - microsoft excel (including xlsx)</li>
148
+ <li>numbers - iWork numbres spreadsheet</li>
149
+ <li>pages - iWork pages document</li>
150
+ <li>key - iWork keynote presentation</li>
151
+ <li>pdf - portable document format</li>
152
+ <li>rtf - rich text format</li>
153
+ <li>txt - plain text document</li>
154
+ </ul>
155
+
156
+ <h4 id='answer-12'>Can I add special text to the body of the post when using postie?</h4>
157
+
158
+ <p>Yes. You can create your own function, and use the postie_post filter.
159
+ Two short examples are included in the filterPostie.php.sample file</p>
160
+
161
+ <h4 id='answer-13'>Can I add special text to the title of the post when using postie?</h4>
162
+
163
+ <p>Yes. You can create your own function, and use the postie_post filter.
164
+ Two short examples are included in the filterPostie.php.sample file</p>
165
+
166
+ <h4 id='answer-14'>Can I select tags or categories based on the content of the e-mail?</h4>
167
+
168
+ <p>Yes. You can create your own function, and use the postie_post filter.
169
+ See the filterPostie.php.sample file for examples.</p>
170
+
171
+ <h4 id='answer-15'>Is the IMAP extension required for postie?</h4>
172
+
173
+ <p>The IMAP extension is not required, but it is strongly recommended, especially
174
+ is you are using non-English text. There is more information on php.net about
175
+ installing the IMAP extension. If you have control over your server, it is
176
+ often not hard to install.</p>
177
+
178
+ <p>On Ubuntu, try</p>
179
+
180
+ <pre><code>sudo apt-get install php5-imap</code></pre>
181
+
182
+ <p>On Fedora, try</p>
183
+
184
+ <pre><code>sudo yuminstall php-imap</code></pre>
185
+
186
+ <p>The IMAP extension is known to be installed on the following popular webhosts:
187
+ * Dreamhost</p>
188
+
189
+ <h4 id='answer-16'>How can I embed youtube or vimeo videos?</h4>
190
+
191
+ <p>Simply put the url in the body of your e-mail. (Make sure that you have the
192
+ option to convert url into links turned on)</p>
193
+
194
+ <h4 id='answer-17'>Something is going wrong, how do I see what is happening?</h4>
195
+
196
+ <p>Add the following lines to your wp-config.php file</p>
197
+
198
+ <pre><code>define(&#039;WP_DEBUG&#039;, true);
199
+ define(&#039;WP_DEBUG_LOG&#039;, true);
200
+ define(&#039;POSTIE_DEBUG&#039;, true);</code></pre>
201
+
202
+ <p>Various errors, warning and informational will be written to the wp-content\debug.log
203
+ file. There may also be all sorts of warnings and messages in your site as well
204
+ depending on how well behaved your other plugins and themes are, so you will not
205
+ want to leave these settings set to true all the time.</p>
206
+
207
+ <h4 id='answer-18'>Why doesn't Postie automatically publish my emails when running manually works</h4>
208
+
209
+ <p>WordPress cron (which Postie relies on) doesn't run unless a page is accessed on the
210
+ site. So if you send an email, but nobody accesses the site for 3 days Postie won't
211
+ be given the chance to fetch the email and publish the post.</p>
212
+
213
+ <p>To ensure that Postie runs smoothly on a low or no volume site you need to ensure that
214
+ a page gets hit (any page is fine). Use something like cron + curl on Linux or install
215
+ curl on Windows and use the Scheduled Tasks control panel. If you are using a hosting company
216
+ that doesn't allow you access to cron you can use a service like
217
+ <a href="https://www.setcronjob.com/">SetCronJob</a>.</p>
218
+
219
+ <p>It is also possible to turn the WordPress cron off. Please make sure something like
220
+ define('DISABLE_WP_CRON', true); is not in your wp-config.php file.</p>
fetchmails.php DELETED
@@ -1,119 +0,0 @@
1
- <?php
2
-
3
- //if ($_POST['fetchmails']) {
4
- include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php");
5
- require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . '../postie/mimedecode.php');
6
- require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . '../postie/postie-functions.php');
7
- init();
8
- fetch_mails();
9
- exit;
10
-
11
- //}
12
- function init() {
13
- /* Sets up database table if it doesn't already exist */
14
- global $wpdb, $aandcpostie_version;
15
- $table_name = $wpdb->prefix . 'postie_addresses';
16
- if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
17
- echo "creating table\n";
18
- $sql = "CREATE TABLE " . $table_name . " (
19
- id mediumint(9) NOT NULL AUTO_INCREMENT,
20
- server text NOT NULL,
21
- port smallint(4) DEFAULT '110' NOT NULL,
22
- email text NOT NULL,
23
- passwd VARCHAR(64) NOT NULL,
24
- protocol text NOT NULL,
25
- offset text NOT NULL,
26
- category mediumint(9) NOT NULL,
27
- UNIQUE KEY id (id)
28
- );";
29
-
30
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
31
- dbDelta($sql);
32
- }
33
- $addresses = array(
34
- 0 => array(
35
- 'server' => 'yourserver.com',
36
- 'port' => '993',
37
- 'email' => 'youruser',
38
- 'passwd' => 'yourpword',
39
- 'protocol' => 'imap-ssl',
40
- 'offset' => '-5',
41
- 'category' => 5
42
- )
43
- # 1=> array(
44
- # 'server'=>'another.com',
45
- # 'port' =>'993',
46
- # 'email' => 'anotheruser',
47
- # 'passwd' => 'anotherpasswd',
48
- # 'protocol' => 'imap-ssl',
49
- # 'offset' => '-5'
50
- # )
51
- );
52
- insert_new_addresses($table_name, $addresses);
53
- }
54
-
55
- function insert_new_addresses($table_name, $addresses) {
56
- /* insert addresses into table */
57
- global $wpdb;
58
- $fetch_query = 'SELECT email, server FROM ' . $table_name;
59
- $existingAddresses = $wpdb->get_results($fetch_query);
60
- $existingArray = array();
61
- foreach ($existingAddresses as $existAdd) {
62
- array_push($existingArray, $existAdd->email . '@' . $existAdd->server);
63
- }
64
- foreach ($addresses as $address) {
65
- extract($address);
66
- $emailAddress = "$email@$server";
67
- if (!in_array($emailAddress, $existingArray)) {
68
- $query = "INSERT INTO " . $table_name .
69
- " (server, port, email, passwd, protocol, offset, category) " .
70
- "VALUES ('$server', $port, '$email', '$passwd', '$protocol', '$offset', '$category')";
71
- } else {
72
- echo "updating\n";
73
- $query = "UPDATE $table_name set server='$server', port='$port',
74
- email='$email', passwd='$passwd',
75
- protocol='$protocol', offset='$offset', category='$category' WHERE
76
- email='$email' AND server='$server'";
77
- }
78
- $results = $wpdb->query($wpdb->prepare($query));
79
- }
80
- }
81
-
82
- function fetch_mails() {
83
- global $wpdb;
84
- /* checks mail from various mailboxes and posts those e-mails */
85
- //Load up some usefull libraries
86
- //Retreive emails
87
- $fetch_query = 'SELECT * FROM ' . $wpdb->prefix . 'postie_addresses';
88
- $mailboxes = $wpdb->get_results($fetch_query);
89
- print_r($mailboxes);
90
- $config = get_config();
91
- foreach ($mailboxes as $mailbox) {
92
- $emails = FetchMail($mailbox->server, $mailbox->port, $mailbox->email, $mailbox->passwd, $mailbox->protocol);
93
- //loop through messages
94
- foreach ($emails as $email) {
95
- //sanity check to see if there is any info in the message
96
- if ($email == NULL) {
97
- print 'Dang, message is empty!';
98
- continue;
99
- }
100
-
101
- $mimeDecodedEmail = DecodeMimeMail($email);
102
-
103
- //Check poster to see if a valid person
104
- $poster = ValidatePoster($mimeDecodedEmail, $config);
105
- if (!empty($poster)) {
106
- if ($config['TEST_EMAIL'])
107
- DebugEmailOutput($email, $mimeDecodedEmail);
108
- if ($mailbox->category)
109
- $config['DEFAULT_POST_CATEGORY'] = $mailbox->category;
110
- PostEmail($poster, $mimeDecodedEmail, $config);
111
- }
112
- else {
113
- print("<p>Ignoring email - not authorized.\n");
114
- }
115
- } // end looping over messages
116
- }
117
- }
118
-
119
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
get_mail.php CHANGED
@@ -1,52 +1,74 @@
1
  <?php
2
 
3
- include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php");
 
 
 
 
 
 
 
4
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mimedecode.php');
5
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-functions.php');
 
 
 
 
 
 
 
6
 
7
- print("<pre>\n");
8
- print("This is the postie plugin\n");
9
- print("time:" . time() . "\n");
10
  include('Revision');
 
 
11
  $config = get_option('postie-settings');
12
  extract($config);
13
  $emails = FetchMail($mail_server, $mail_server_port, $mail_userid, $mail_password, $input_protocol, $time_offset, $test_email, $delete_mail_after_processing);
14
  $message = 'Done.';
 
 
 
 
 
 
15
  //loop through messages
16
  foreach ($emails as $email) {
17
- if (function_exists('memory_get_usage'))
18
- echo "memory at start of e-mail processing:" . memory_get_usage() . "\n";
19
  //sanity check to see if there is any info in the message
20
  if ($email == NULL) {
21
  $message = __('Dang, message is empty!', 'postie');
22
  continue;
23
  } else if ($email == 'already read') {
24
- $message = "\n" . __("There does not seem to be any new mail.", 'postie') .
25
- "\n";
26
- continue;
27
- }
28
- // check for XSS attacks - we disallow any javascript, meta, onload, or base64
29
- if (preg_match("@((%3C|<)/?script|<meta|document\.|\.cookie|\.createElement|onload\s*=|(eval|base64)\()@is", $email)) {
30
- echo "possible XSS attack - ignoring email\n";
31
  continue;
32
  }
33
 
34
  $mimeDecodedEmail = DecodeMIMEMail($email, true);
35
 
 
 
 
 
 
 
 
 
36
  //Check poster to see if a valid person
37
  $poster = ValidatePoster($mimeDecodedEmail, $config);
38
  if (!empty($poster)) {
39
- if ($test_email)
40
- DebugEmailOutput($email, $mimeDecodedEmail);
41
  PostEmail($poster, $mimeDecodedEmail, $config);
 
 
42
  }
43
- else {
44
- print("<p>Ignoring email - not authorized.\n");
45
- }
46
- if (function_exists('memory_get_usage'))
47
- echo "memory at end of e-mail processing:" . memory_get_usage() . "\n";
48
- } // end looping over messages
49
- print $message;
50
- print("</pre>\n");
51
 
 
 
 
52
  ?>
1
  <?php
2
 
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
+ } else {
8
+ include_once (dirname($wp_config_path)) . DIRECTORY_SEPARATOR . "wp-config.php";
9
+ }
10
+
11
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mimedecode.php');
12
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-functions.php');
13
+ require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'simple_html_dom.php');
14
+
15
+ if (!ini_get('safe_mode')) {
16
+ $original_mem_limit = ini_get('memory_limit');
17
+ ini_set('memory_limit', -1);
18
+ ini_set('max_execution_time', 300);
19
+ }
20
 
21
+ EchoInfo("Starting mail fetch");
22
+ EchoInfo("Time: " . date('Y-m-d H:i:s', time()) . " GMT");
 
23
  include('Revision');
24
+
25
+ $test_email = null;
26
  $config = get_option('postie-settings');
27
  extract($config);
28
  $emails = FetchMail($mail_server, $mail_server_port, $mail_userid, $mail_password, $input_protocol, $time_offset, $test_email, $delete_mail_after_processing);
29
  $message = 'Done.';
30
+
31
+ EchoInfo(sprintf(__("There are %d messages to process", "postie"), count($emails)));
32
+
33
+ if (function_exists('memory_get_usage'))
34
+ EchoInfo(__("memory at start of e-mail processing:") . memory_get_usage());
35
+
36
  //loop through messages
37
  foreach ($emails as $email) {
 
 
38
  //sanity check to see if there is any info in the message
39
  if ($email == NULL) {
40
  $message = __('Dang, message is empty!', 'postie');
41
  continue;
42
  } else if ($email == 'already read') {
43
+ $message = __("There does not seem to be any new mail.", 'postie');
 
 
 
 
 
 
44
  continue;
45
  }
46
 
47
  $mimeDecodedEmail = DecodeMIMEMail($email, true);
48
 
49
+ DebugEmailOutput($email, $mimeDecodedEmail);
50
+
51
+ // check for XSS attacks - we disallow any javascript, meta, onload, or base64
52
+ if (preg_match("@((%3C|<)/?script|<meta|document\.|\.cookie|\.createElement|onload\s*=|(eval|base64)\()@is", $email, $matches)) {
53
+ EchoInfo("Warning: possible XSS attack");
54
+ DebugDump($matches);
55
+ }
56
+
57
  //Check poster to see if a valid person
58
  $poster = ValidatePoster($mimeDecodedEmail, $config);
59
  if (!empty($poster)) {
 
 
60
  PostEmail($poster, $mimeDecodedEmail, $config);
61
+ } else {
62
+ EchoInfo("Ignoring email - not authorized.");
63
  }
64
+ }
65
+
66
+ if (function_exists('memory_get_usage'))
67
+ EchoInfo("memory at end of e-mail processing:" . memory_get_usage());
68
+
69
+ EchoInfo($message);
 
 
70
 
71
+ if (!ini_get('safe_mode')) {
72
+ ini_set('memory_limit', $original_mem_limit);
73
+ }
74
  ?>
mimedecode.php CHANGED
@@ -52,7 +52,7 @@
52
  * @author Sean Coates <sean@php.net>
53
  * @copyright 2003-2006 PEAR <pear-group@php.net>
54
  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
55
- * @version CVS: $Id: mimeDecode.php,v 1.48 2006/12/03 13:43:33 cipri Exp $
56
  * @link http://pear.php.net/package/Mail_mime
57
  */
58
 
@@ -147,6 +147,15 @@ class Mail_mimeDecode extends PEAR
147
  */
148
  var $_decode_headers;
149
 
 
 
 
 
 
 
 
 
 
150
  /**
151
  * Constructor.
152
  *
@@ -165,6 +174,7 @@ class Mail_mimeDecode extends PEAR
165
  $this->_body = $body;
166
  $this->_decode_bodies = false;
167
  $this->_include_bodies = true;
 
168
  }
169
 
170
  /**
@@ -187,7 +197,7 @@ class Mail_mimeDecode extends PEAR
187
  function decode($params = null)
188
  {
189
  // determine if this method has been called statically
190
- $isStatic = !(isset($this) && get_class($this) == __CLASS__);
191
 
192
  // Have we been called statically?
193
  // If so, create an object and pass details to that.
@@ -208,6 +218,8 @@ class Mail_mimeDecode extends PEAR
208
  $params['decode_bodies'] : false;
209
  $this->_decode_headers = isset($params['decode_headers']) ?
210
  $params['decode_headers'] : false;
 
 
211
 
212
  $structure = $this->_decode($this->_header, $this->_body);
213
  if ($structure === false) {
@@ -235,6 +247,7 @@ class Mail_mimeDecode extends PEAR
235
  $headers = $this->_parseHeaders($headers);
236
 
237
  foreach ($headers as $value) {
 
238
  if (isset($return->headers[strtolower($value['name'])]) AND !is_array($return->headers[strtolower($value['name'])])) {
239
  $return->headers[strtolower($value['name'])] = array($return->headers[strtolower($value['name'])]);
240
  $return->headers[strtolower($value['name'])][] = $value['value'];
@@ -247,8 +260,8 @@ class Mail_mimeDecode extends PEAR
247
  }
248
  }
249
 
250
- reset($headers);
251
- while (list($key, $value) = each($headers)) {
252
  $headers[$key]['name'] = strtolower($headers[$key]['name']);
253
  switch ($headers[$key]['name']) {
254
 
@@ -261,7 +274,7 @@ class Mail_mimeDecode extends PEAR
261
  }
262
 
263
  if (isset($content_type['other'])) {
264
- while (list($p_name, $p_value) = each($content_type['other'])) {
265
  $return->ctype_parameters[$p_name] = $p_value;
266
  }
267
  }
@@ -271,7 +284,7 @@ class Mail_mimeDecode extends PEAR
271
  $content_disposition = $this->_parseHeaderValue($headers[$key]['value']);
272
  $return->disposition = $content_disposition['value'];
273
  if (isset($content_disposition['other'])) {
274
- while (list($p_name, $p_value) = each($content_disposition['other'])) {
275
  $return->d_parameters[$p_name] = $p_value;
276
  }
277
  }
@@ -303,6 +316,7 @@ class Mail_mimeDecode extends PEAR
303
  case 'multipart/alternative':
304
  case 'multipart/related':
305
  case 'multipart/mixed':
 
306
  if(!isset($content_type['other']['boundary'])){
307
  $this->_error = 'No boundary found for ' . $content_type['value'] . ' part';
308
  return false;
@@ -321,7 +335,11 @@ class Mail_mimeDecode extends PEAR
321
  break;
322
 
323
  case 'message/rfc822':
324
- $obj = &new Mail_mimeDecode($body);
 
 
 
 
325
  $return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies,
326
  'decode_bodies' => $this->_decode_bodies,
327
  'decode_headers' => $this->_decode_headers));
@@ -401,6 +419,11 @@ class Mail_mimeDecode extends PEAR
401
  if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) {
402
  return array($match[1], $match[2]);
403
  }
 
 
 
 
 
404
  $this->_error = 'Could not split header and body';
405
  return false;
406
  }
@@ -419,7 +442,12 @@ class Mail_mimeDecode extends PEAR
419
  if ($input !== '') {
420
  // Unfold the input
421
  $input = preg_replace("/\r?\n/", "\r\n", $input);
 
 
 
 
422
  $input = preg_replace("/\r\n(\t| )+/", ' ', $input);
 
423
  $headers = explode("\r\n", trim($input));
424
 
425
  foreach ($headers as $value) {
@@ -430,7 +458,7 @@ class Mail_mimeDecode extends PEAR
430
 
431
  $return[] = array(
432
  'name' => $hdr_name,
433
- 'value' => $this->_decode_headers ? $this->_decodeHeader($hdr_value) : $hdr_value
434
  );
435
  }
436
  } else {
@@ -454,41 +482,161 @@ class Mail_mimeDecode extends PEAR
454
  function _parseHeaderValue($input)
455
  {
456
 
457
- if (($pos = strpos($input, ';')) !== false) {
 
 
 
 
 
 
458
 
459
- $return['value'] = trim(substr($input, 0, $pos));
460
- $input = trim(substr($input, $pos+1));
 
 
461
 
462
- if (strlen($input) > 0) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
 
464
- // This splits on a semi-colon, if there's no preceeding backslash
465
- // Now works with quoted values; had to glue the \; breaks in PHP
466
- // the regex is already bordering on incomprehensible
467
- $splitRegex = '/([^;\'"]*[\'"]([^\'"]*([^\'"]*)*)[\'"][^;\'"]*|([^;]+))(;|$)/';
468
- preg_match_all($splitRegex, $input, $matches);
469
- $parameters = array();
470
- for ($i=0; $i<count($matches[0]); $i++) {
471
- $param = $matches[0][$i];
472
- while (substr($param, -2) == '\;') {
473
- $param .= $matches[0][++$i];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474
  }
475
- $parameters[] = $param;
 
 
 
 
476
  }
477
 
478
- for ($i = 0; $i < count($parameters); $i++) {
479
- $param_name = trim(substr($parameters[$i], 0, $pos = strpos($parameters[$i], '=')), "'\";\t\\ ");
480
- $param_value = trim(str_replace('\;', ';', substr($parameters[$i], $pos + 1)), "'\";\t\\ ");
481
- if ($param_value[0] == '"') {
482
- $param_value = substr($param_value, 1, -1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  }
484
- $return['other'][$param_name] = $param_value;
485
- $return['other'][strtolower($param_name)] = $param_value;
486
  }
 
 
 
 
 
487
  }
488
- } else {
489
- $return['value'] = trim($input);
490
  }
491
-
 
 
 
 
492
  return $return;
493
  }
494
 
@@ -510,13 +658,19 @@ class Mail_mimeDecode extends PEAR
510
  if ($boundary == $bs_check) {
511
  $boundary = $bs_possible;
512
  }
 
513
 
514
- $tmp = explode('--' . $boundary, $input);
515
-
516
- for ($i = 1; $i < count($tmp) - 1; $i++) {
517
- $parts[] = $tmp[$i];
 
 
 
 
 
 
518
  }
519
-
520
  return $parts;
521
  }
522
 
@@ -719,7 +873,7 @@ class Mail_mimeDecode extends PEAR
719
  case "to":
720
  case "cc":
721
  case "bcc":
722
- $to = ",".$item['value'];
723
  default:
724
  break;
725
  }
52
  * @author Sean Coates <sean@php.net>
53
  * @copyright 2003-2006 PEAR <pear-group@php.net>
54
  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
55
+ * @version CVS: $Id: mimeDecode.php 305875 2010-12-01 07:17:10Z alan_k $
56
  * @link http://pear.php.net/package/Mail_mime
57
  */
58
 
147
  */
148
  var $_decode_headers;
149
 
150
+ /**
151
+ * Flag to determine whether to include attached messages
152
+ * as body in the returned object. Depends on $_include_bodies
153
+ *
154
+ * @var boolean
155
+ * @access private
156
+ */
157
+ var $_rfc822_bodies;
158
+
159
  /**
160
  * Constructor.
161
  *
174
  $this->_body = $body;
175
  $this->_decode_bodies = false;
176
  $this->_include_bodies = true;
177
+ $this->_rfc822_bodies = false;
178
  }
179
 
180
  /**
197
  function decode($params = null)
198
  {
199
  // determine if this method has been called statically
200
+ $isStatic = empty($this) || !is_a($this, __CLASS__);
201
 
202
  // Have we been called statically?
203
  // If so, create an object and pass details to that.
218
  $params['decode_bodies'] : false;
219
  $this->_decode_headers = isset($params['decode_headers']) ?
220
  $params['decode_headers'] : false;
221
+ $this->_rfc822_bodies = isset($params['rfc_822bodies']) ?
222
+ $params['rfc_822bodies'] : false;
223
 
224
  $structure = $this->_decode($this->_header, $this->_body);
225
  if ($structure === false) {
247
  $headers = $this->_parseHeaders($headers);
248
 
249
  foreach ($headers as $value) {
250
+ $value['value'] = $this->_decode_headers ? $this->_decodeHeader($value['value']) : $value['value'];
251
  if (isset($return->headers[strtolower($value['name'])]) AND !is_array($return->headers[strtolower($value['name'])])) {
252
  $return->headers[strtolower($value['name'])] = array($return->headers[strtolower($value['name'])]);
253
  $return->headers[strtolower($value['name'])][] = $value['value'];
260
  }
261
  }
262
 
263
+
264
+ foreach ($headers as $key => $value) {
265
  $headers[$key]['name'] = strtolower($headers[$key]['name']);
266
  switch ($headers[$key]['name']) {
267
 
274
  }
275
 
276
  if (isset($content_type['other'])) {
277
+ foreach($content_type['other'] as $p_name => $p_value) {
278
  $return->ctype_parameters[$p_name] = $p_value;
279
  }
280
  }
284
  $content_disposition = $this->_parseHeaderValue($headers[$key]['value']);
285
  $return->disposition = $content_disposition['value'];
286
  if (isset($content_disposition['other'])) {
287
+ foreach($content_disposition['other'] as $p_name => $p_value) {
288
  $return->d_parameters[$p_name] = $p_value;
289
  }
290
  }
316
  case 'multipart/alternative':
317
  case 'multipart/related':
318
  case 'multipart/mixed':
319
+ case 'application/vnd.wap.multipart.related':
320
  if(!isset($content_type['other']['boundary'])){
321
  $this->_error = 'No boundary found for ' . $content_type['value'] . ' part';
322
  return false;
335
  break;
336
 
337
  case 'message/rfc822':
338
+ if ($this->_rfc822_bodies) {
339
+ $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit';
340
+ $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body);
341
+ }
342
+ $obj = new Mail_mimeDecode($body);
343
  $return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies,
344
  'decode_bodies' => $this->_decode_bodies,
345
  'decode_headers' => $this->_decode_headers));
419
  if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) {
420
  return array($match[1], $match[2]);
421
  }
422
+ // bug #17325 - empty bodies are allowed. - we just check that at least one line
423
+ // of headers exist..
424
+ if (count(explode("\n",$input))) {
425
+ return array($input, '');
426
+ }
427
  $this->_error = 'Could not split header and body';
428
  return false;
429
  }
442
  if ($input !== '') {
443
  // Unfold the input
444
  $input = preg_replace("/\r?\n/", "\r\n", $input);
445
+ //#7065 - wrapping.. with encoded stuff.. - probably not needed,
446
+ // wrapping space should only get removed if the trailing item on previous line is a
447
+ // encoded character
448
+ $input = preg_replace("/=\r\n(\t| )+/", '=', $input);
449
  $input = preg_replace("/\r\n(\t| )+/", ' ', $input);
450
+
451
  $headers = explode("\r\n", trim($input));
452
 
453
  foreach ($headers as $value) {
458
 
459
  $return[] = array(
460
  'name' => $hdr_name,
461
+ 'value' => $hdr_value
462
  );
463
  }
464
  } else {
482
  function _parseHeaderValue($input)
483
  {
484
 
485
+ if (($pos = strpos($input, ';')) === false) {
486
+ $input = $this->_decode_headers ? $this->_decodeHeader($input) : $input;
487
+ $return['value'] = trim($input);
488
+ return $return;
489
+ }
490
+
491
+
492
 
493
+ $value = substr($input, 0, $pos);
494
+ $value = $this->_decode_headers ? $this->_decodeHeader($value) : $value;
495
+ $return['value'] = trim($value);
496
+ $input = trim(substr($input, $pos+1));
497
 
498
+ if (!strlen($input) > 0) {
499
+ return $return;
500
+ }
501
+ // at this point input contains xxxx=".....";zzzz="...."
502
+ // since we are dealing with quoted strings, we need to handle this properly..
503
+ $i = 0;
504
+ $l = strlen($input);
505
+ $key = '';
506
+ $val = false; // our string - including quotes..
507
+ $q = false; // in quote..
508
+ $lq = ''; // last quote..
509
+
510
+ while ($i < $l) {
511
+
512
+ $c = $input[$i];
513
+ //var_dump(array('i'=>$i,'c'=>$c,'q'=>$q, 'lq'=>$lq, 'key'=>$key, 'val' =>$val));
514
 
515
+ $escaped = false;
516
+ if ($c == '\\') {
517
+ $i++;
518
+ if ($i == $l-1) { // end of string.
519
+ break;
520
+ }
521
+ $escaped = true;
522
+ $c = $input[$i];
523
+ }
524
+
525
+
526
+ // state - in key..
527
+ if ($val === false) {
528
+ if (!$escaped && $c == '=') {
529
+ $val = '';
530
+ $key = trim($key);
531
+ $i++;
532
+ continue;
533
+ }
534
+ if (!$escaped && $c == ';') {
535
+ if ($key) { // a key without a value..
536
+ $key= trim($key);
537
+ $return['other'][$key] = '';
538
+ $return['other'][strtolower($key)] = '';
539
+ }
540
+ $key = '';
541
+ }
542
+ $key .= $c;
543
+ $i++;
544
+ continue;
545
+ }
546
+
547
+ // state - in value.. (as $val is set..)
548
+
549
+ if ($q === false) {
550
+ // not in quote yet.
551
+ if ((!strlen($val) || $lq !== false) && $c == ' ' || $c == "\t") {
552
+ $i++;
553
+ continue; // skip leading spaces after '=' or after '"'
554
+ }
555
+ if (!$escaped && ($c == '"' || $c == "'")) {
556
+ // start quoted area..
557
+ $q = $c;
558
+ // in theory should not happen raw text in value part..
559
+ // but we will handle it as a merged part of the string..
560
+ $val = !strlen(trim($val)) ? '' : trim($val);
561
+ $i++;
562
+ continue;
563
+ }
564
+ // got end....
565
+ if (!$escaped && $c == ';') {
566
+
567
+ $val = trim($val);
568
+ $added = false;
569
+ if (preg_match('/\*[0-9]+$/', $key)) {
570
+ // this is the extended aaa*0=...;aaa*1=.... code
571
+ // it assumes the pieces arrive in order, and are valid...
572
+ $key = preg_replace('/\*[0-9]+$/', '', $key);
573
+ if (isset($return['other'][$key])) {
574
+ $return['other'][$key] .= $val;
575
+ if (strtolower($key) != $key) {
576
+ $return['other'][strtolower($key)] .= $val;
577
+ }
578
+ $added = true;
579
+ }
580
+ // continue and use standard setters..
581
+ }
582
+ if (!$added) {
583
+ $return['other'][$key] = $val;
584
+ $return['other'][strtolower($key)] = $val;
585
  }
586
+ $val = false;
587
+ $key = '';
588
+ $lq = false;
589
+ $i++;
590
+ continue;
591
  }
592
 
593
+ $val .= $c;
594
+ $i++;
595
+ continue;
596
+ }
597
+
598
+ // state - in quote..
599
+ if (!$escaped && $c == $q) { // potential exit state..
600
+
601
+ // end of quoted string..
602
+ $lq = $q;
603
+ $q = false;
604
+ $i++;
605
+ continue;
606
+ }
607
+
608
+ // normal char inside of quoted string..
609
+ $val.= $c;
610
+ $i++;
611
+ }
612
+
613
+ // do we have anything left..
614
+ if (strlen(trim($key)) || $val !== false) {
615
+
616
+ $val = trim($val);
617
+ $added = false;
618
+ if ($val !== false && preg_match('/\*[0-9]+$/', $key)) {
619
+ // no dupes due to our crazy regexp.
620
+ $key = preg_replace('/\*[0-9]+$/', '', $key);
621
+ if (isset($return['other'][$key])) {
622
+ $return['other'][$key] .= $val;
623
+ if (strtolower($key) != $key) {
624
+ $return['other'][strtolower($key)] .= $val;
625
  }
626
+ $added = true;
 
627
  }
628
+ // continue and use standard setters..
629
+ }
630
+ if (!$added) {
631
+ $return['other'][$key] = $val;
632
+ $return['other'][strtolower($key)] = $val;
633
  }
 
 
634
  }
635
+ // decode values.
636
+ foreach($return['other'] as $key =>$val) {
637
+ $return['other'][$key] = $this->_decode_headers ? $this->_decodeHeader($val) : $val;
638
+ }
639
+ //print_r($return);
640
  return $return;
641
  }
642
 
658
  if ($boundary == $bs_check) {
659
  $boundary = $bs_possible;
660
  }
661
+ $tmp = preg_split("/--".preg_quote($boundary, '/')."((?=\s)|--)/", $input);
662
 
663
+ $len = count($tmp) -1;
664
+ for ($i = 1; $i < $len; $i++) {
665
+ if (strlen(trim($tmp[$i]))) {
666
+ $parts[] = $tmp[$i];
667
+ }
668
+ }
669
+
670
+ // add the last part on if it does not end with the 'closing indicator'
671
+ if (!empty($tmp[$len]) && strlen(trim($tmp[$len])) && $tmp[$len][0] != '-') {
672
+ $parts[] = $tmp[$len];
673
  }
 
674
  return $parts;
675
  }
676
 
873
  case "to":
874
  case "cc":
875
  case "bcc":
876
+ $to .= ",".$item['value'];
877
  default:
878
  break;
879
  }
postie-functions.php CHANGED
@@ -1,5 +1,23 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  function postie_disable_revisions($restore = false) {
4
  global $_wp_post_type_features, $_postie_revisions;
5
 
@@ -37,24 +55,6 @@ function postie_increase_memory($restore = false) {
37
  }
38
  }
39
 
40
- //include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR."wp-admin" . DIRECTORY_SEPARATOR . "upgrade-functions.php");
41
- /*
42
- $Id: postie-functions.php 625325 2012-11-14 19:29:41Z WayneAllen $
43
- */
44
-
45
- /* TODO
46
- * html purify
47
- * USE built-in php message decoding to improve speed
48
- * Add custom fields
49
- * support for flexible upload plugin
50
- * iso 8859-2 support
51
- * add private post function
52
- http://forum.robfelty.com/topic/how-to-private-posts-from-postie?replies=2#post-1515
53
- * category per e-mail address
54
- */
55
-
56
- //include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php");
57
-
58
  /* this function is necessary for wildcard matching on non-posix systems */
59
  if (!function_exists('fnmatch')) {
60
 
@@ -68,6 +68,30 @@ if (!function_exists('fnmatch')) {
68
 
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  /**
72
  * This is the main handler for all of the processing
73
  */
@@ -82,42 +106,35 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
82
  "cids" => array(), //holds the cids for HTML email
83
  "image_files" => array() //holds the files for each image
84
  );
85
- print("<p>Message Id is :" .
86
- htmlentities($mimeDecodedEmail->headers["message-id"]) . "</p><br/>\n");
87
- if (defined('POSTIE_DEBUG')) {
88
- foreach ($mimeDecodedEmail->parts as $parts) {
89
- print("<p>" . $parts->ctype_primary . " " . $parts->ctype_secondary) . "</p>\n";
90
- }
91
- echo "<p>Email is:</p>";
92
- var_dump($mimeDecodedEmail);
93
- }
94
  FilterTextParts($mimeDecodedEmail, $prefer_text_type);
95
- $tmpPost = array('post_title' => 'tmptitle',
96
- 'post_content' => 'tmpPost');
97
  /* in order to do attachments correctly, we need to associate the
98
  attachments with a post. So we add the post here, then update it
99
  */
100
  $post_id = wp_insert_post($tmpPost);
101
- if (defined('POSTIE_DEBUG')) {
102
- echo "the id is $post_id\n";
103
- }
104
  $content = GetContent($mimeDecodedEmail, $attachments, $post_id, $poster, $config);
105
- if (defined('POSTIE_DEBUG')) {
106
- echo "the content is $content\n";
107
- }
108
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
109
- if (defined('POSTIE_DEBUG')) {
110
- echo "the subject is $subject, right after calling GetSubject\n";
111
- }
112
  $customImages = SpecialMessageParsing($content, $attachments, $config);
113
  $post_excerpt = GetPostExcerpt($content, $filternewlines, $convertnewline);
114
  $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail);
115
  $message_date = NULL;
116
- if (array_key_exists("date", $mimeDecodedEmail->headers)
117
- && !empty($mimeDecodedEmail->headers["date"])) {
118
- $message_date = HandleMessageEncoding(
119
- $mimeDecodedEmail->headers["content-transfer-encoding"], $mimeDecodedEmail->ctype_parameters["charset"], $mimeDecodedEmail->headers["date"], $message_encoding, $message_dequote);
120
- //$message_date = $mimeDecodedEmail->headers['date'];
 
 
 
 
 
121
  }
122
  list($post_date, $post_date_gmt, $delay) = DeterminePostDate($content, $message_date, $time_offset);
123
  ubb2HTML($content);
@@ -125,8 +142,6 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
125
  if ($converturls)
126
  $content = clickableLink($content, $shortcode);
127
 
128
- //$content = FixEmailQuotes($content);
129
-
130
  $id = checkReply($subject);
131
  $post_categories = GetPostCategories($subject, $default_post_category);
132
  $post_tags = postie_get_tags($content, $default_post_tags);
@@ -149,14 +164,12 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
149
  }
150
  }
151
  } else {
 
152
  $isReply = true;
153
  // strip out quoted content
154
  $lines = explode("\n", $content);
155
- //$lines=preg_split('/([\r\n]|<br \/>)/',$content);
156
  $newContents = '';
157
  foreach ($lines as $line) {
158
- //$match=preg_match("/^>.*/i",$line);
159
- //echo "line=$line, match=$match";
160
  if (preg_match("/^>.*/i", $line) == 0 &&
161
  preg_match("/^(from|subject|to|date):.*?/i", $line) == 0 &&
162
  preg_match("/^-+.*?(from|subject|to|date).*?/i", $line) == 0 &&
@@ -171,13 +184,14 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
171
  if ($filternewlines)
172
  $content = FilterNewLines($content, $convertnewline);
173
 
174
-
175
  if ($delay != 0 && $post_status == 'publish') {
176
  $post_status = 'future';
177
  } else {
178
  $post_status = $post_status;
179
  }
180
- // DEBUG
 
 
181
  $details = array(
182
  'post_author' => $poster,
183
  'comment_author' => $postAuthorDetails['author'],
@@ -185,12 +199,10 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
185
  'user_ID' => $postAuthorDetails['user_ID'],
186
  'email_author' => $postAuthorDetails['email'],
187
  'post_date' => $post_date,
188
- // 'post_date_gmt' => $post_date_gmt,
189
- // 'post_content' => apply_filters('content_save_pre',$content),
190
  'post_content' => $content,
191
  'post_title' => $subject,
192
- // 'post_modified' => $post_date,
193
- // 'post_modified_gmt' => $post_date_gmt,
194
  'ping_status' => get_option('default_ping_status'),
195
  'post_category' => $post_categories,
196
  'tags_input' => $post_tags,
@@ -229,18 +241,51 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
229
  }
230
 
231
  /** FUNCTIONS * */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  function clickableLink($text, $shortcode = false) {
233
- # this functions deserves credit to the fine folks at phpbb.com
234
- # It turns urls into links, and video urls into embedded players
235
 
236
  $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
237
 
238
- // pad it with a space so we can match things at the start of the 1st line.
239
  $ret = ' ' . $text;
240
  if (strpos($ret, 'youtube') !== false) {
241
- // try to embed youtube videos
242
  $youtube = "#(^|[\n ]|>)[\w]+?://(www\.)?youtube\.com/watch\?v=([_a-zA-Z0-9-]+).*?([ \n]|$|<)#is";
243
- #$youtube="#(^|[\n ]|<p[^<]*>)[\w]+?://(www\.)?youtube\.com/watch\?v=([_a-zA-Z0-9]+).*?([ \n]|$|</p>)#is";
244
  if ($shortcode) {
245
  $youtube_replace = "\\1[youtube \\3]\\4";
246
  } else {
@@ -250,10 +295,10 @@ function clickableLink($text, $shortcode = false) {
250
  }
251
 
252
  if (strpos($ret, 'vimeo') !== false) {
253
- // try to embed vimeo videos
254
  # : http://vimeo.com/6348141
255
  $vimeo = "#(^|[\n ]|>)[\w]+?://(www\.)?vimeo\.com/([_a-zA-Z0-9-]+).*?([ \n]|$|<)#is";
256
- #$youtube="#(^|[\n ]|<p[^<]*>)[\w]+?://(www\.)?youtube\.com/watch\?v=([_a-zA-Z0-9]+).*?([ \n]|$|</p>)#is";
257
  if ($shortcode) {
258
  $vimeo_replace = "\\1[vimeo \\3]\\4";
259
  } else {
@@ -270,22 +315,22 @@ function clickableLink($text, $shortcode = false) {
270
  $ret = preg_replace($vimeo, $vimeo_replace, $ret);
271
  }
272
 
273
- // matches an "xxxx://yyyy" URL at the start of a line, or after a space.
274
- // xxxx can only be alpha characters.
275
- // yyyy is anything up to the first space, newline, comma, double quote or <
276
  $ret = preg_replace("#(^|[\n ])<?([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)>?#is", "\\1<a href=\"\\2\" >\\2</a>", $ret);
277
 
278
- // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
279
- // Must contain at least 2 dots. xxxx contains either alphanum, or "-"
280
- // zzzz is optional.. will contain everything up to the first space, newline,
281
- // comma, double quote or <.
282
  $ret = preg_replace("#(^|[\n ])<?((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)>?#is", "\\1<a href=\"http://\\2\" >\\2</a>", $ret);
283
 
284
- // matches an email@domain type address at the start of a line, or after a space.
285
- // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
286
  $ret = preg_replace(
287
  "#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
288
- // Remove our padding..
289
  $ret = substr($ret, 1);
290
  return $ret;
291
  }
@@ -296,7 +341,7 @@ function getPostAuthorDetails(&$subject, &$content, &$mimeDecodedEmail) {
296
  * Otherwise we get them from the headers
297
  */
298
  global $wpdb;
299
- // see if subject starts with Fwd:
300
  if (preg_match("/(^Fwd:) (.*)/", $subject, $matches)) {
301
  $subject = trim($matches[2]);
302
  if (preg_match("/\nfrom:(.*?)\n/i", $content, $matches)) {
@@ -355,6 +400,9 @@ function checkReply(&$subject) {
355
  */
356
 
357
  global $wpdb;
 
 
 
358
  // see if subject starts with Re:
359
  if (preg_match("/(^Re:) (.*)/i", $subject, $matches)) {
360
  $subject = trim($matches[2]);
@@ -376,11 +424,9 @@ function checkReply(&$subject) {
376
  if (is_array($id)) {
377
  $id = $id[count($id) - 1];
378
  }
379
- } else {
380
- $id = NULL;
381
  }
382
  }
383
- return($id);
384
  }
385
 
386
  function postie_read_me() {
@@ -393,7 +439,7 @@ function postie_read_me() {
393
  function PostieMenu() {
394
  if (function_exists('add_options_page')) {
395
  if (current_user_can('manage_options')) {
396
- add_options_page("Postie", "Postie", 0, POSTIE_ROOT . "/postie.php", "ConfigurePostie");
397
  }
398
  }
399
  }
@@ -412,10 +458,11 @@ function ConfigurePostie() {
412
  function FetchMail($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true) {
413
  $emails = array();
414
  if (!$server || !$port || !$email) {
415
- die("Missing Configuration For Mail Server\n");
 
416
  }
417
  if ($server == "pop.gmail.com") {
418
- print("\nMAKE SURE POP IS TURNED ON IN SETTING AT Gmail\n");
419
  }
420
  switch (strtolower($protocol)) {
421
  case 'smtp': //direct
@@ -430,36 +477,18 @@ function FetchMail($server = NULL, $port = NULL, $email = NULL, $password = NULL
430
  case 'imap':
431
  case 'imap-ssl':
432
  case 'pop3-ssl':
433
- HasIMAPSupport(false);
434
- if ($test) {
435
- $emails = TestIMAPMessageFetch();
436
  } else {
437
  $emails = IMAPMessageFetch($server, $port, $email, $password, $protocol, $offset, $test, $deleteMessages);
438
  }
439
  break;
440
  case 'pop3':
441
  default:
442
- if ($test) {
443
- $emails = TestPOP3MessageFetch();
444
- } else {
445
- $emails = POP3MessageFetch($server, $port, $email, $password, $protocol, $offset, $test, $deleteMessages);
446
- }
447
  }
448
- if (!$emails)
449
- die("\n" . __('There does not seem to be any new mail.', 'postie') . "\n");
450
- return($emails);
451
- }
452
 
453
- /**
454
- * Handles fetching messages from an imap server
455
- */
456
- function TestIMAPMessageFetch() {
457
- print("**************RUNING IN TESTING MODE************\n");
458
- $config = get_postie_config();
459
- extract($config);
460
- $email = $test_email_account;
461
- $password = $test_email_password;
462
- return(IMAPMessageFetch($mail_server, $mail_server_port, $email, $password, $input_protocol, $time_offset, $test_email));
463
  }
464
 
465
  /**
@@ -467,20 +496,18 @@ function TestIMAPMessageFetch() {
467
  */
468
  function IMAPMessageFetch($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true) {
469
  require_once("postieIMAP.php");
470
-
471
- $mail_server = &PostieIMAP::Factory($protocol);
472
- print("\nConnecting to $server:$port ($protocol) \n");
473
- if (!$mail_server->connect($server, $port, $email, $password)) {
474
- print("Mail Connection Time Out\n
475
- Common Reasons: \n
476
- Server Down \n
477
- Network Issue \n
478
- Port/Protocol MisMatch \n
479
- ");
480
- die("The Server said:" . $mail_server->error() . "\n");
481
- }
482
- $msg_count = $mail_server->getNumberOfMessages();
483
  $emails = array();
 
 
 
 
 
 
 
 
 
 
 
484
  // loop through messages
485
  for ($i = 1; $i <= $msg_count; $i++) {
486
  $emails[$i] = $mail_server->fetchEmail($i);
@@ -496,42 +523,28 @@ function IMAPMessageFetch($server = NULL, $port = NULL, $email = NULL, $password
496
  return $emails;
497
  }
498
 
499
- function TestPOP3MessageFetch() {
500
- print("**************RUNING IN TESTING MODE************\n");
501
- $config = get_postie_config();
502
- extract($config);
503
- $email = $test_email_account;
504
- $password = $test_email_password;
505
- return(POP3MessageFetch($mail_server, $mail_server_port, $email, $password, $input_protocol, $time_offset, $test_email));
506
- }
507
-
508
  /**
509
  * Retrieves email via POP3
510
  */
511
  function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true) {
512
  require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
513
- $pop3 = &new POP3();
514
- print("\nConnecting to $server:$port ($protocol)) \n");
515
- if (!$pop3->connect($server, $port)) {
 
 
 
 
 
 
 
 
 
516
  if (strpos($pop3->ERROR, "POP3: premature NOOP OK, NOT an RFC 1939 Compliant server") === false) {
517
- print("Mail Connection Time Out\n
518
- Common Reasons: \n
519
- Server Down \n
520
- Network Issue \n
521
- Port/Protocol MisMatch \n
522
- ");
523
- die("The Server Said $pop3->ERROR \n");
524
  }
525
- }
526
-
527
- //Check to see if there is any mail, if not die
528
- $msg_count = $pop3->login($email, $password);
529
- if ($msg_count === false) {
530
- $pop3->quit();
531
- // we should die if $msg_count is false, but the core wordpress pop3 needs
532
- // to be fixed before we can do that
533
- // die("there was a problem logging in. Please check username and password.");
534
- return(array());
535
  }
536
 
537
  // loop through messages
@@ -539,14 +552,10 @@ function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password
539
  $emails[$i] = implode('', $pop3->get($i));
540
  if ($deleteMessages) {
541
  if (!$pop3->delete($i)) {
542
- echo 'Oops ' . $pop3->ERROR . '\n';
543
  $pop3->reset();
544
  exit;
545
- } else {
546
- echo "Mission complete, message $i deleted.\n";
547
  }
548
- } else {
549
- print("Not deleting messages!\n");
550
  }
551
  }
552
  //clean up
@@ -561,7 +570,6 @@ function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password
561
  */
562
  function PostToDB($details, $isReply, $postToDb = true, $customImageField = false) {
563
  if ($postToDb) {
564
- //$_POST['publish'] = true; //Added to make subscribe2 work - it will only handle it if the global varilable _POST is set
565
  if (!$isReply) {
566
  $post_ID = wp_insert_post($details);
567
  } else {
@@ -607,28 +615,28 @@ function BannedFileName($filename, $bannedFiles) {
607
  return false;
608
  foreach ($bannedFiles as $bannedFile) {
609
  if (fnmatch($bannedFile, $filename)) {
610
- print("<p>Ignoring $filename - it is on the banned files list.");
611
- return(true);
612
  }
613
  }
614
- return(false);
615
  }
616
 
617
  //tear apart the meta part for useful information
618
  function GetContent($part, &$attachments, $post_id, $poster, $config) {
619
  extract($config);
620
  global $charset, $encoding;
621
- /*
622
- if (!function_exists(imap_mime_header_decode))
623
- echo "you need to install the php-imap extension for full functionality, including mime header decoding\n";
624
- */
625
  $meta_return = NULL;
626
- echo "primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary . "\n";
 
627
  DecodeBase64Part($part);
628
- if (BannedFileName($part->ctype_parameters['name'], $banned_files_list))
629
- return(NULL);
630
- if ($part->ctype_primary == "application"
631
- && $part->ctype_secondary == "octet-stream") {
 
 
632
  if ($part->disposition == "attachment") {
633
  $image_endings = array("jpg", "png", "gif", "jpeg", "pjpeg");
634
  foreach ($image_endings as $type) {
@@ -646,8 +654,7 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
646
  }
647
  }
648
  }
649
- if ($part->ctype_primary == "multipart"
650
- && $part->ctype_secondary == "appledouble") {
651
  $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body);
652
  FilterTextParts($mimeDecodedEmail, $prefer_text_type);
653
  FilterAppleFile($mimeDecodedEmail);
@@ -656,7 +663,10 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
656
  }
657
  } else {
658
  // fix filename (remove non-standard characters)
659
- $filename = preg_replace("/[^\x9\xA\xD\x20-\x7F]/", "", $part->ctype_parameters['name']);
 
 
 
660
  switch (strtolower($part->ctype_primary)) {
661
  case 'multipart':
662
  FilterTextParts($part, $prefer_text_type);
@@ -668,11 +678,19 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
668
  $tmpcharset = trim($part->ctype_parameters['charset']);
669
  if ($tmpcharset != '')
670
  $charset = $tmpcharset;
671
- $tmpencoding = trim($part->headers['content-transfer-encoding']);
672
- if ($tmpencoding != '')
673
- $encoding = $tmpencoding;
 
 
 
 
674
 
675
- $part->body = HandleMessageEncoding($part->headers["content-transfer-encoding"], $part->ctype_parameters["charset"], $part->body, $message_encoding, $message_dequote);
 
 
 
 
676
 
677
  //go through each sub-section
678
  if ($part->ctype_secondary == 'enriched') {
@@ -680,11 +698,10 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
680
  $meta_return .= etf2HTML($part->body) . "\n";
681
  } elseif ($part->ctype_secondary == 'html') {
682
  //strip excess HTML
683
- //$meta_return .= HTML2HTML($part->body ) . "\n";
684
- $meta_return .= $part->body . "\n";
685
  } else {
686
  //regular text, so just strip the pgp signature
687
- if (ALLOW_HTML_IN_BODY) {
688
  $meta_return .= $part->body . "\n";
689
  } else {
690
  $meta_return .= htmlentities($part->body) . "\n";
@@ -696,14 +713,15 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
696
  case 'image':
697
  $file_id = postie_media_handle_upload($part, $post_id, $poster);
698
  $file = wp_get_attachment_url($file_id);
699
-
700
- $cid = trim($part->headers["content-id"], "<>");
 
 
701
  ; //cids are in <cid>
702
  $the_post = get_post($file_id);
703
  $attachments["html"][$filename] = parseTemplate($file_id, $part->ctype_primary, $imagetemplate);
704
  if ($cid) {
705
- $attachments["cids"][$cid] = array($file,
706
- count($attachments["html"]) - 1);
707
  }
708
  break;
709
  case 'audio':
@@ -746,21 +764,19 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
746
  $cid = trim($part->headers["content-id"], "<>");
747
  ; //cids are in <cid>
748
  $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $icon_set, $icon_size);
749
- $attachments["html"][$filename] = "<a href='$file'>" .
750
- $icon . $filename . '</a>' . "\n";
751
  if ($cid) {
752
- $attachments["cids"][$cid] = array($file,
753
- count($attachments["html"]) - 1);
754
  }
755
  }
756
  break;
757
  }
758
  }
759
- return($meta_return);
760
  }
761
 
762
  function ubb2HTML(&$text) {
763
- // Array of tags with opening and closing
764
  $tagArray['img'] = array('open' => '<img src="', 'close' => '">');
765
  $tagArray['b'] = array('open' => '<b>', 'close' => '</b>');
766
  $tagArray['i'] = array('open' => '<i>', 'close' => '</i>');
@@ -772,7 +788,7 @@ function ubb2HTML(&$text) {
772
  $tagArray['color=(.*)'] = array('open' => '<font color="', 'close' => '">\\2</font>');
773
  $tagArray['size=(.*)'] = array('open' => '<font size="', 'close' => '">\\2</font>');
774
  $tagArray['font=(.*)'] = array('open' => '<font face="', 'close' => '">\\2</font>');
775
- // Array of tags with only one part
776
  $sTagArray['br'] = array('tag' => '<br>');
777
  $sTagArray['hr'] = array('tag' => '<hr>');
778
 
@@ -826,46 +842,21 @@ function etf2HTML($content) {
826
  '',
827
  ''
828
  );
829
- // strip extra line breaks
830
  $content = preg_replace($search, $replace, $content);
831
  return trim($content);
832
  }
833
 
834
  // This function cleans up HTML in the e-mail
835
  function HTML2HTML($content) {
836
- $search = array(
837
- '/<html [^<]*>/is',
838
- '/<\/html>/i',
839
- '/<\/?title>/i',
840
- '/<body[^<]*>/i',
841
- '/<\/body>/i',
842
- '/<\/?head>/i',
843
- '/<meta[^<]*>/i',
844
- '/<style[^<]*>.*<\/style>/is',
845
- '/<!--.*?-->/is',
846
- '/<\/?o:[^<]*>/i',
847
- '/<!DOCTYPE[^<]*>/',
848
- //'/<img src=[\'"][^<]*>/'
849
- // '/<img src="cid:(.*)" .*>/'
850
- );
851
-
852
- $replace = array(
853
- '',
854
- '',
855
- '',
856
- '',
857
- '',
858
- '',
859
- '',
860
- '',
861
- '',
862
- '',
863
- '',
864
- ''
865
- );
866
- // strip extra line breaks
867
- $content = preg_replace($search, $replace, trim($content));
868
- return ($content);
869
  }
870
 
871
  /**
@@ -877,42 +868,37 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
877
  global $wpdb;
878
  $poster = NULL;
879
  $from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"]));
880
- $resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["resent-from"]));
881
- /*
882
- if ( empty($from) ) {
883
- echo 'Invalid Sender - Emtpy! ';
884
- return;
885
- }
886
- */
887
 
888
  //See if the email address is one of the special authorized ones
889
- print("Confirming Access For $from \n");
890
  $sql = 'SELECT id FROM ' . $wpdb->users . ' WHERE user_email=\'' . addslashes($from) . "' LIMIT 1;";
891
  $user_ID = $wpdb->get_var($sql);
892
  if (!empty($user_ID)) {
893
  $user = new WP_User($user_ID);
894
  if ($user->has_cap("post_via_postie")) {
895
  $poster = $user_ID;
896
- echo "posting as user $poster";
897
  } else {
898
  $poster = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE
899
  user_login = '$admin_username'");
900
  }
901
- } elseif ($turn_authorization_off ||
902
- CheckEmailAddress($from, $authorized_addresses) ||
903
- CheckEmailAddress($resentFrom, $authorized_addresses)) {
904
- $poster = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE
905
- user_login = '$admin_username'");
906
  }
907
  $validSMTP = checkSMTP($mimeDecodedEmail, $smtp);
908
  if (!$poster || !$validSMTP) {
909
- echo 'Invalid sender: ' . htmlentities($from) . "! Not adding email!\n";
910
  if ($forward_rejected_mail) {
911
  $admin_email = get_option("admin_email");
912
  if (MailToRecipients($mimeDecodedEmail, $test_email, array($admin_email), $return_to_sender)) {
913
- echo "A copy of the message has been forwarded to the administrator.\n";
914
  } else {
915
- echo "The message was unable to be forwarded to the adminstrator.\n";
916
  }
917
  }
918
  return;
@@ -921,10 +907,10 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
921
  }
922
 
923
  function post_as_admin($admin_username) {
924
- print("$from is authorized to post as the administrator\n");
925
- //$from = get_option("admin_email");
926
- //$adminUser=$admin_username;
927
- //echo "adminUser='$adminUser'";
928
  return $poster;
929
  }
930
 
@@ -947,6 +933,7 @@ function checkSMTP($mimeDecodedEmail, $smtpservers) {
947
  * @param string
948
  */
949
  function StartFilter(&$content, $start) {
 
950
  $pos = strpos($content, $start);
951
  if ($pos === false) {
952
  return($content);
@@ -966,12 +953,9 @@ function remove_signature($content, $filterList) {
966
  $arrcontent = explode("\n", $content);
967
  $strcontent = '';
968
  $pattern = '/^(' . implode('|', $filterList) . ')/';
969
- for ($i = 0; $i <= count($arrcontent); $i++) {
970
  $line = trim($arrcontent[$i]);
971
- $nextline = $arrcontent[$i + 1];
972
  if (preg_match($pattern, trim($line))) {
973
- //if (!strpos(trim($line), $pattern)==0) {
974
- //print("<p>Found in $line");
975
  break;
976
  }
977
  $strcontent .= $line . "\n";
@@ -985,7 +969,8 @@ function remove_signature($content, $filterList) {
985
  * @param string
986
  * @param filter
987
  */
988
- function EndFilter(&$content, $end) {
 
989
  $pos = strpos($content, $end);
990
  if ($pos === false)
991
  return $content;
@@ -1008,41 +993,15 @@ function FilterNewLines($content, $convertNewLines = false) {
1008
  'ACTUAL_NEW_LINE',
1009
  'LINEBREAK'
1010
  );
1011
- // strip extra line breaks, and replace double line breaks with paragraph
1012
- // tags
1013
  $result = preg_replace($search, $replace, $content);
1014
- //$newContent='<p>' . preg_replace('/ACTUAL_NEW_LINE/',"</p>\n<p>",$result);
1015
 
1016
- $newContent = preg_replace('/(ACTUAL_NEW_LINE|LINEBREAK\s*LINEBREAK)/', "\n\n", $result);
1017
- //$newContent=preg_replace('/<p>LINEBREAK$/', '', $newContent);
1018
  if ($convertNewLines) {
1019
- $newContent = preg_replace('/LINEBREAK/', "<br />\n", $newContent);
1020
- if (defined('POSTIE_DEBUG')) {
1021
- echo "converting newlines\n";
1022
- }
1023
  } else {
1024
- $newContent = preg_replace('/LINEBREAK/', " ", $newContent);
1025
- if (defined('POSTIE_DEBUG')) {
1026
- echo "not converting newlines\n";
1027
- }
1028
  }
1029
- return($newContent);
1030
- }
1031
-
1032
- function FixEmailQuotes($content) {
1033
- # place e-mails quotes (indicated with >) in blockquote and pre tags
1034
- $search = array(
1035
- "/^>/"
1036
- );
1037
- $replace = array(
1038
- '<br />&gt;'
1039
- );
1040
- // strip extra line breaks, and replace double line breaks with paragraph
1041
- // tags
1042
- $result = preg_replace($search, $replace, $content);
1043
- //return('<p>' . preg_replace('/ACTUAL_NEW_LINE/',"<\/p>\n<p>",$result)
1044
- //. '</p>');
1045
- return($result);
1046
  }
1047
 
1048
  //strip pgp stuff
@@ -1055,47 +1014,48 @@ function StripPGP($content) {
1055
  ' ',
1056
  ''
1057
  );
1058
- // strip extra line breaks
1059
  $return = preg_replace($search, $replace, $content);
1060
  return $return;
1061
  }
1062
 
1063
- function ConvertToISO_8859_1($encoding, $charset, $body, $blogEncoding) {
1064
- $charset = strtolower($charset);
1065
- $encoding = strtolower($encoding);
1066
- if (strtolower($blogEncoding == "iso-8859-1") && (strtolower($charset) != 'iso-8859-1')) {
1067
- if ($encoding == 'base64' || $encoding == 'quoted-printable') {
1068
  $body = utf8_decode($body);
1069
  }
 
 
 
1070
  }
1071
- return($body);
1072
  }
1073
 
1074
- function HandleMessageEncoding($encoding, $charset, $body, $blogEncoding = 'utf-8', $dequote = true) {
1075
  $charset = strtolower($charset);
1076
- $encoding = strtolower($encoding);
1077
- /*
1078
- if ($encoding == '') {
1079
- $encoding = '7bit';
1080
- }
1081
- */
1082
- if ($dequote && strtolower($encoding) == 'quoted-printable') {
1083
- //echo "handling quoted printable";
1084
- $body = quoted_printable_decode($body);
1085
- //echo "now body is:\n\n $body\n\n";
1086
- }
1087
- //HandleQuotedPrintable($encoding, $body, $dequote);
1088
- if ($blogEncoding == 'iso-8859-1') {
1089
- $text = ConvertToISO_8859_1($encoding, $charset, $body, $blogEncoding);
1090
- } else {
1091
- $text = ConvertToUTF_8($encoding, $charset, $body);
1092
  }
1093
- return($text);
 
 
 
 
 
 
1094
  }
1095
 
1096
- function ConvertToUTF_8($encoding, $charset, $body) {
1097
  $charset = strtolower($charset);
1098
- $encoding = strtolower($encoding);
1099
 
1100
  switch ($charset) {
1101
  case "iso-8859-1":
@@ -1104,12 +1064,10 @@ function ConvertToUTF_8($encoding, $charset, $body) {
1104
  case "iso-2022-jp":
1105
  $body = iconv("ISO-2022-JP", "UTF-8//TRANSLIT", $body);
1106
  break;
1107
- case ($charset == "windows-1252" || $charset == "cp-1252" ||
1108
- $charset == "cp 1252"):
1109
  $body = cp1252_to_utf8($body);
1110
  break;
1111
- case ($charset == "windows-1256" || $charset == "cp-1256" ||
1112
- $charset == "cp 1256"):
1113
  $body = iconv("Windows-1256", "UTF-8//TRANSLIT", $body);
1114
  break;
1115
  case 'koi8-r':
@@ -1127,8 +1085,11 @@ function ConvertToUTF_8($encoding, $charset, $body) {
1127
  case "iso-8859-15":
1128
  $body = iconv("iso-8859-15", "UTF-8//TRANSLIT", $body);
1129
  break;
 
 
 
1130
  }
1131
- return($body);
1132
  }
1133
 
1134
  /* this function will convert windows-1252 (also known as cp-1252 to utf-8 */
@@ -1170,15 +1131,11 @@ function cp1252_to_utf8($str) {
1170
  * This function handles decoding base64 if needed
1171
  */
1172
  function DecodeBase64Part(&$part) {
1173
- if (strtolower($part->headers['content-transfer-encoding']) == 'base64') {
1174
- $part->body = base64_decode($part->body);
1175
- }
1176
- }
1177
-
1178
- function HandleQuotedPrintable($encoding, &$body, $dequote = true) {
1179
- if ($dequote && strtolower($encoding) == 'quoted-printable') {
1180
- echo "handling quoted printable";
1181
- $body = quoted_printable_decode($body);
1182
  }
1183
  }
1184
 
@@ -1187,9 +1144,10 @@ function HandleQuotedPrintable($encoding, &$body, $dequote = true) {
1187
  * @return boolean
1188
  */
1189
  function AllowCommentsOnPost(&$content) {
1190
- $comments_allowed = get_option('default_comment_status');
1191
- if (eregi("comments:([0|1|2])", $content, $matches)) {
1192
- $content = ereg_replace("comments:$matches[1]", "", $content);
 
1193
  if ($matches[1] == "1") {
1194
  $comments_allowed = "open";
1195
  } else if ($matches[1] == "2") {
@@ -1198,7 +1156,7 @@ function AllowCommentsOnPost(&$content) {
1198
  $comments_allowed = "closed";
1199
  }
1200
  }
1201
- return($comments_allowed);
1202
  }
1203
 
1204
  /**
@@ -1206,28 +1164,30 @@ function AllowCommentsOnPost(&$content) {
1206
  */
1207
  function DeterminePostDate(&$content, $message_date = NULL, $offset = 0) {
1208
  $delay = 0;
1209
- if (defined('POSTIE_DEBUG')) {
1210
- echo "inside Determine Post Date, message_date = $message_date\n";
1211
- }
1212
- if (eregi("delay:(-?[0-9dhm]+)", $content, $matches)
1213
- && trim($matches[1])) {
1214
- if (eregi("(-?[0-9]+)d", $matches[1], $dayMatches)) {
1215
  $days = $dayMatches[1];
1216
  }
1217
- if (eregi("(-?[0-9]+)h", $matches[1], $hourMatches)) {
1218
  $hours = $hourMatches[1];
1219
  }
1220
- if (eregi("(-?[0-9]+)m", $matches[1], $minuteMatches)) {
1221
  $minutes = $minuteMatches[1];
1222
  }
1223
  $delay = (($days * 24 + $hours) * 60 + $minutes) * 60;
1224
- $content = ereg_replace("delay:$matches[1]", "", $content);
1225
  }
1226
- if (!empty($message_date) && $delay == 0) {
1227
- $dateInSeconds = strtotime($message_date);
1228
  } else {
1229
- $dateInSeconds = time() + $delay;
1230
  }
 
 
1231
  $post_date = gmdate('Y-m-d H:i:s', $dateInSeconds + ($offset * 3600));
1232
  $post_date_gmt = gmdate('Y-m-d H:i:s', $dateInSeconds);
1233
 
@@ -1237,7 +1197,7 @@ function DeterminePostDate(&$content, $message_date = NULL, $offset = 0) {
1237
  echo "post_date=$post_date\n";
1238
  echo "--------------------DELAY------------\n";
1239
  */
1240
- return(array($post_date, $post_date_gmt, $delay));
1241
  }
1242
 
1243
  /**
@@ -1245,7 +1205,7 @@ function DeterminePostDate(&$content, $message_date = NULL, $offset = 0) {
1245
  */
1246
  function ParseInMessageSubject($content, $defaultTitle) {
1247
  if (substr($content, 0, 1) != "#") {
1248
- //print("<p>Didn't start with # '".substr(ltrim($content),0,10)."'");
1249
  return(array($defaultTitle, $content));
1250
  }
1251
  $subjectEndIndex = strpos($content, "#", 1);
@@ -1268,6 +1228,7 @@ function FilterAppleFile(&$mimeDecodedEmail) {
1268
  for ($i = 0; $i < count($mimeDecodedEmail->parts); $i++) {
1269
  if ($mimeDecodedEmail->parts[$i]->ctype_secondary == "applefile") {
1270
  $found = true;
 
1271
  } else {
1272
  $newParts[] = &$mimeDecodedEmail->parts[$i];
1273
  }
@@ -1279,8 +1240,8 @@ function FilterAppleFile(&$mimeDecodedEmail) {
1279
 
1280
  function postie_media_handle_upload($part, $post_id, $poster, $post_data = array()) {
1281
  $overrides = array('test_form' => false);
1282
- //$overrides = array('test_form'=>false, 'test_size'=>false,
1283
- // 'test_type'=>false);
1284
  $tmpFile = tempnam(getenv('TEMP'), 'postie');
1285
  if (!is_writable($tmpFile)) {
1286
  $uploadDir = wp_upload_dir();
@@ -1291,7 +1252,7 @@ function postie_media_handle_upload($part, $post_id, $poster, $post_data = array
1291
  fwrite($fp, $part->body);
1292
  fclose($fp);
1293
  } else {
1294
- echo "could not write to temp file: '$tmpFile' ";
1295
  }
1296
  if ($part->ctype_parameters['name'] == '') {
1297
  if ($part->d_parameters['filename'] != '') {
@@ -1317,16 +1278,18 @@ function postie_media_handle_upload($part, $post_id, $poster, $post_data = array
1317
  }
1318
 
1319
  $time = current_time('mysql');
1320
- if ($post = get_post($post_id)) {
1321
- if (substr($post->post_date, 0, 4) > 0)
1322
- $time = $post->post_date;
1323
- }
1324
 
1325
  $file = postie_handle_upload($the_file, $overrides, $time);
1326
  //unlink($tmpFile);
1327
 
1328
- if (isset($file['error']))
 
1329
  return new WP_Error('upload_error', $file['error']);
 
1330
 
1331
  $url = $file['url'];
1332
  $type = $file['type'];
@@ -1446,6 +1409,7 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
1446
  // Move the file to the uploads dir
1447
  $new_file = $uploads['path'] . "/$filename";
1448
  if (false === @ rename($file['tmp_name'], $new_file)) {
 
1449
  return $upload_error_handler($file, sprintf(__('The uploaded file could not be moved to %s.'), $uploads['path']));
1450
  }
1451
 
@@ -1502,6 +1466,7 @@ function FilterTextParts(&$mimeDecodedEmail, $preferTextType) {
1502
  }
1503
  if ($found && $newParts) {
1504
  //This is now the filtered list of just the preferred type.
 
1505
  $mimeDecodedEmail->parts = $newParts;
1506
  }
1507
  }
@@ -1519,7 +1484,7 @@ function MailToRecipients(&$mail_content, $testEmail = false, $recipients = arra
1519
  $myemailadd = get_option("admin_email");
1520
  $blogname = get_option("blogname");
1521
  $blogurl = get_option("siteurl");
1522
- //array_push($recipients, $myemailadd);
1523
  if (count($recipients) == 0) {
1524
  return false;
1525
  }
@@ -1537,7 +1502,7 @@ function MailToRecipients(&$mail_content, $testEmail = false, $recipients = arra
1537
  $headers .= "Cc: " . $recipient . "\r\n";
1538
  }
1539
  }
1540
- // Set email subject
1541
  if ($reject) {
1542
  $alert_subject = $blogname . ": Unauthorized Post Attempt from $from";
1543
  if ($mail_content->ctype_parameters['boundary']) {
@@ -1545,7 +1510,7 @@ function MailToRecipients(&$mail_content, $testEmail = false, $recipients = arra
1545
  } else {
1546
  $boundary = uniqid("B_");
1547
  }
1548
- // Set sender details
1549
  /*
1550
  if (isset($mail_content->headers["mime-version"])) {
1551
  $headers .= "Mime-Version: ". $mail_content->headers["mime-version"] . "\r\n";
@@ -1556,8 +1521,8 @@ function MailToRecipients(&$mail_content, $testEmail = false, $recipients = arra
1556
  */
1557
 
1558
  $headers.="Content-Type:multipart/alternative; boundary=\"$boundary\"\r\n";
1559
- // SDM 20041123
1560
- // construct mail message
1561
  $message = "An unauthorized message has been sent to $blogname.\n";
1562
  $message .= "Sender: $from\n";
1563
  $message .= "Subject: $subject\n";
@@ -1594,7 +1559,7 @@ function MailToRecipients(&$mail_content, $testEmail = false, $recipients = arra
1594
  }
1595
 
1596
 
1597
- // Send message
1598
  mail($myemailadd, $alert_subject, $mailtext, $headers);
1599
 
1600
  return true;
@@ -1611,8 +1576,8 @@ function DecodeMIMEMail($email, $decodeHeaders = false) {
1611
  $params['decode_bodies'] = false;
1612
  $params['decode_headers'] = $decodeHeaders;
1613
  $params['input'] = $email;
1614
- //$decoded = imap_mime_header_decode($email);
1615
- $decoded = Mail_mimeDecode::decode($params);
1616
  if (empty($decoded->parts))
1617
  $decoded->parts = array(); // have an empty array at minimum, so that it is safe for "foreach"
1618
  return $decoded;
@@ -1623,7 +1588,7 @@ function DecodeMIMEMail($email, $decodeHeaders = false) {
1623
  */
1624
  function DisplayMIMEPartTypes($mimeDecodedEmail) {
1625
  foreach ($mimeDecodedEmail->parts as $part) {
1626
- print("<p>" . $part->ctype_primary . " / " . $part->ctype_secondary . "/ " . $part->headers['content-transfer-encoding'] . "\n");
1627
  }
1628
  }
1629
 
@@ -1633,12 +1598,19 @@ function DisplayMIMEPartTypes($mimeDecodedEmail) {
1633
  * @return boolean
1634
  */
1635
  function CheckEmailAddress($address, $authorized) {
1636
- $isAuthorized = in_array(strtolower($address), $authorized);
1637
- return $isAuthorized;
 
 
 
 
 
 
 
1638
  }
1639
 
1640
  /**
1641
- * This method works around a problemw with email address with extra <> in the email address
1642
  * @param string
1643
  * @return string
1644
  */
@@ -1658,14 +1630,17 @@ function RemoveExtraCharactersInEmailAddress($address) {
1658
  * it just returns the username (everything before @)
1659
  */
1660
  function GetNameFromEmail($address) {
 
1661
  $matches = array();
1662
  if (preg_match('/^([^<>]+)<([^<> ()]+)>$/', $address, $matches)) {
1663
  $name = $matches[1];
1664
  } else if (preg_match('/<([^<>@ ()]+)>/', $address, $matches)) {
1665
  $name = $matches[1];
 
 
1666
  }
1667
 
1668
- return($name);
1669
  }
1670
 
1671
  /**
@@ -1784,7 +1759,7 @@ function parseTemplate($id, $type, $template, $size = 'medium') {
1784
  } elseif (!preg_match("/$attachment->post_title/i", $fileName)) {
1785
  $template = str_replace('{CAPTION}', $attachment->post_title, $template);
1786
  } else {
1787
- //$template=str_replace('{CAPTION}', '', $template);
1788
  }
1789
  return($template . '<br />');
1790
  }
@@ -1821,49 +1796,53 @@ function ReplaceImageCIDs(&$content, &$attachments) {
1821
  */
1822
  function ReplaceImagePlaceHolders(&$content, $attachments, $config) {
1823
  extract($config);
1824
- ($start_image_count_at_zero ? $startIndex = 0 : $startIndex = 1);
1825
  if (!empty($attachments) && $auto_gallery) {
1826
- $value = '[gallery]';
1827
  if ($images_append) {
1828
- $content .= $value;
1829
  } else {
1830
- $content = "$value\n" . $content;
1831
  }
 
1832
  return;
1833
  }
1834
- $pictures = array();
1835
- ksort($attachments);
1836
- foreach ($attachments as $i => $value) {
 
1837
  // looks for ' #img1# ' etc... and replaces with image
1838
  $img_placeholder_temp = str_replace("%", intval($startIndex + $i), $image_placeholder);
1839
  $eimg_placeholder_temp = str_replace("%", intval($startIndex + $i), "#eimg%#");
1840
  $img_placeholder_temp = rtrim($img_placeholder_temp, '#');
1841
  $eimg_placeholder_temp = rtrim($eimg_placeholder_temp, '#');
1842
- if (stristr($content, $img_placeholder_temp) ||
1843
- stristr($content, $eimg_placeholder_temp)) {
1844
  // look for caption
1845
  $caption = '';
1846
  $content = preg_replace("/&#0?39;/", "'", $content);
1847
  $content = preg_replace("/&(#0?34|quot);/", "\"", $content);
1848
- if (preg_match("/$img_placeholder_temp caption=['\"]?(.*?)['\"]?#/", $content, $matches)) {
1849
  $caption = $matches[1];
 
1850
  $img_placeholder_temp = substr($matches[0], 0, -1);
1851
  $eimg_placeholder_temp = substr($matches[0], 0, -1);
 
 
1852
  }
1853
- $value = str_replace('{CAPTION}', $caption, $value);
1854
  $img_placeholder_temp.='#';
1855
  $eimg_placeholder_temp.='#';
1856
- $content = str_replace($img_placeholder_temp, $value, $content);
1857
- $content = str_replace($eimg_placeholder_temp, $value, $content);
1858
- //print(htmlspecialchars("value=$value\n",ENT_QUOTES));
1859
- //print(htmlspecialchars("content=\n***\n$content\n***\n",ENT_QUOTES));
1860
  } else {
1861
- $value = str_replace('{CAPTION}', '', $value);
1862
  /* if using the gallery shortcode, don't add pictures at all */
1863
  if (!preg_match("/\[gallery[^\[]*\]/", $content, $matches)) {
1864
- $pics .= $value;
1865
  }
1866
  }
 
1867
  }
1868
  if ($images_append) {
1869
  $content .= $pics;
@@ -1879,55 +1858,44 @@ function ReplaceImagePlaceHolders(&$content, $attachments, $config) {
1879
  function GetSubject(&$mimeDecodedEmail, &$content, $config) {
1880
  extract($config);
1881
  global $charset;
1882
- //assign the default title/subject
1883
  if ($mimeDecodedEmail->headers['subject'] == NULL) {
1884
  if ($allow_subject_in_mail) {
1885
- list($subject, $content) =
1886
- ParseInMessageSubject($content, $default_title);
1887
  } else {
1888
  $subject = $default_title;
1889
  }
1890
  $mimeDecodedEmail->headers['subject'] = $subject;
1891
  } else {
1892
  $subject = $mimeDecodedEmail->headers['subject'];
1893
- if ($mimeDecodedEmail->headers["content-transfer-encoding"] != '') {
1894
  $encoding = $mimeDecodedEmail->headers["content-transfer-encoding"];
1895
- } else if ($mimeDecodedEmail->ctype_parameters["content-transfer-encoding"] != '') {
1896
  $encoding = $mimeDecodedEmail->ctype_parameters["content-transfer-encoding"];
1897
  } else {
1898
  $encoding = '7bit';
1899
  }
1900
- if (function_exists(imap_mime_header_decode)) {
1901
  $subject = '';
1902
- //$elements=imap_mime_header_decode($mimeDecodedEmail->headers['subject']);
1903
- //$text = "=?utf-8?b?w6XDpMO2?= unicode";
1904
  $text = $mimeDecodedEmail->headers['subject'];
1905
- //$text="test emails with ISO 8859-2 cahracters ąęśćółńżźĄĘŚÓŁŃŻŹ";
1906
- //echo "text='$text'\n";
1907
  $elements = imap_mime_header_decode($text);
1908
  for ($i = 0; $i < count($elements); $i++) {
1909
  $thischarset = $elements[$i]->charset;
1910
  if ($thischarset == 'default')
1911
  $thischarset = $charset;
1912
- //echo "Charset: {$thischarset}\n";
1913
- //echo "Text: ". utf8_encode($elements[$i]->text). "\n\n";
1914
  $subject.=HandleMessageEncoding($encoding, $thischarset, $elements[$i]->text, $message_encoding, $message_dequote);
1915
- //echo "subject=$subject\n";
1916
  }
1917
- //echo "now subject= $subject\n";
1918
- //if ($element->charset!='') {
1919
- //$charset = $element[0]->charset;
1920
- //echo "charset='$charset'\n";
1921
- // }
1922
  }
1923
  if (!$allow_html_in_subject) {
1924
- $subject = htmlentities($subject);
1925
  }
1926
  }
1927
- //This is for ISO-2022-JP - Can anyone confirm that this is still neeeded?
1928
- // escape sequence is 'ESC $ B' == 1b 24 42 hex.
1929
  if (strpos($subject, "\x1b\x24\x42") !== false) {
1930
- // found iso-2022-jp escape sequence in subject... convert!
1931
  $subject = iconv("ISO-2022-JP//TRANSLIT", "UTF-8", $subject);
1932
  }
1933
  return($subject);
@@ -1939,7 +1907,7 @@ function GetSubject(&$mimeDecodedEmail, &$content, $config) {
1939
  */
1940
  function postie_get_tags(&$content, $defaultTags) {
1941
  $post_tags = array();
1942
- //try and determine tags
1943
  if (preg_match('/tags: ?(.*)\n/i', $content, $matches)) {
1944
  $content = str_replace($matches[0], "", $content);
1945
  $post_tags = preg_split("/,\s*/", $matches[1]);
@@ -1955,7 +1923,6 @@ function postie_get_tags(&$content, $defaultTags) {
1955
  *
1956
  */
1957
  function GetPostExcerpt(&$content, $filterNewLines, $convertNewLines) {
1958
- global $wpdb;
1959
  $post_excerpt = '';
1960
  if (preg_match('/:excerptstart ?(.*):excerptend/s', $content, $matches)) {
1961
  $content = str_replace($matches[0], "", $content);
@@ -1963,7 +1930,7 @@ function GetPostExcerpt(&$content, $filterNewLines, $convertNewLines) {
1963
  if ($filterNewLines)
1964
  $post_excerpt = FilterNewLines($post_excerpt, $convertNewLines);
1965
  }
1966
- return($post_excerpt);
1967
  }
1968
 
1969
  /**
@@ -1989,7 +1956,7 @@ function GetPostCategories(&$subject, $defaultCategory) {
1989
  foreach ($matches[1] as $match) {
1990
  $match = trim($match);
1991
  $category = NULL;
1992
- print("Working on $match\n");
1993
 
1994
  $sql_name = 'SELECT term_id
1995
  FROM ' . $wpdb->terms . '
@@ -2016,33 +1983,30 @@ function GetPostCategories(&$subject, $defaultCategory) {
2016
  if (!count($post_categories)) {
2017
  $post_categories[] = $defaultCategory;
2018
  }
2019
- return($post_categories);
2020
  }
2021
 
2022
  /**
2023
  * This function just outputs a simple html report about what is being posted in
2024
  */
2025
  function DisplayEmailPost($details) {
2026
- if (defined('POSTIE_DEBUG')) {
2027
- print_r($config);
2028
- print_r($details);
2029
- }
2030
  $theFinalContent = $details['post_content'];
2031
  // Report
2032
- print '</pre><p><b>Post Author</b>: ' . $details["post_author"] . '<br />' . "\n";
2033
- print '<b>Date</b>: ' . $details["post_date"] . '<br />' . "\n";
2034
  foreach ($details["post_category"] as $category) {
2035
- print '<b>Category</b>: ' . $category . '<br />' . "\n";
2036
  }
2037
- print '<b>Ping Status</b>: ' . $details["ping_status"] . '<br />' . "\n";
2038
- print '<b>Comment Status</b>: ' . $details["comment_status"] . '<br />' . "\n";
2039
- print '<b>Subject</b>: ' . $details["post_title"] . '<br />' . "\n";
2040
- print '<b>Postname</b>: ' . $details["post_name"] . '<br />' . "\n";
2041
- print '<b>Post Id</b>: ' . $details["ID"] . '<br />' . "\n";
2042
- print '<b>Posted content:</b></p><hr />' .
2043
- $details["post_content"] . '<hr /><pre>';
2044
- //if (function_exists('memory_get_peak_usage'))
2045
- // echo "Memory used: ". memory_get_peak_usage(). "\n";
2046
  }
2047
 
2048
  /**
@@ -2053,18 +2017,17 @@ function DisplayEmailPost($details) {
2053
  * @param string
2054
  */
2055
  function BuildBooleanSelect($label, $id, $current_value, $recommendation = NULL) {
2056
- $string = "<tr>
2057
- <th scope=\"row\">" . __($label, 'postie') . ":</th>
2058
- <td><select name=\"$id\" id=\"$id\">
2059
- <option value=\"1\">" . __("Yes", 'postie') . "</option>
2060
- <option value=\"0\" " . (!$current_value ? "SELECTED" : NULL) .
2061
- ">" . __("No", 'postie') . '</option>
2062
- </select>';
2063
- if ($recommendation != NULL) {
2064
- $string.='<span class="recommendation">' . __($recommendation, 'postie') . '</span>';
2065
  }
2066
- $string.="</td>\n</tr>";
2067
- return($string);
2068
  }
2069
 
2070
  /**
@@ -2075,22 +2038,21 @@ function BuildBooleanSelect($label, $id, $current_value, $recommendation = NULL)
2075
  * @param string
2076
  */
2077
  function BuildTextArea($label, $id, $current_value, $recommendation = NULL) {
2078
- $string = "<tr> <th scope=\"row\">" . __($label, 'postie') . ":";
2079
  if ($recommendation) {
2080
- $string.="<br /><span class='recommendation'>" . __($recommendation, 'postie') . "</span>";
2081
  }
2082
- $string.="</th>";
2083
 
2084
- $string .="<td><textarea cols=40 rows=3 name=\"$id\" id=\"$id\">";
2085
  $current_value = preg_split("/[,\r\n]+/", trim($current_value));
2086
  if (is_array($current_value)) {
2087
  foreach ($current_value as $item) {
2088
- $string .= "$item\n";
2089
  }
2090
  }
2091
- $string .= "</textarea></td>
2092
- </tr>";
2093
- return($string);
2094
  }
2095
 
2096
  /**
@@ -2113,7 +2075,7 @@ function ResetPostieConfig() {
2113
  */
2114
  function UpdatePostieConfig($data) {
2115
  UpdatePostiePermissions($data["role_access"]);
2116
- // We also update the cron settings
2117
  if ($data['interval'] != '') {
2118
  postie_decron();
2119
  if ($data['interval'] != 'manual') {
@@ -2179,7 +2141,7 @@ function get_postie_config_defaults() {
2179
  'selected_video1template' => 'simple_link',
2180
  'selected_video2template' => 'simple_link',
2181
  'shortcode' => false,
2182
- 'sig_pattern_list' => array('--', '- --'),
2183
  'smtp' => array(),
2184
  'start_image_count_at_zero' => false,
2185
  'supported_file_types' => array('video', 'application'),
@@ -2191,7 +2153,9 @@ function get_postie_config_defaults() {
2191
  'video2types' => array('x-flv'),
2192
  'video1templates' => $video1Templates,
2193
  'video2templates' => $video2Templates,
2194
- 'wrap_pre' => 'no'
 
 
2195
  );
2196
  }
2197
 
@@ -2213,17 +2177,22 @@ function GetListOfArrayConfig() {
2213
  function ReadDBConfig() {
2214
  $config = array();
2215
  global $wpdb;
2216
- $data = $wpdb->get_results("SELECT label,value FROM " . $GLOBALS["table_prefix"] . "postie_config;");
2217
- if (is_array($data)) {
2218
- foreach ($data as $row) {
2219
- if (in_array($row->label, GetListOfArrayConfig())) {
2220
- $config[$row->label] = unserialize($row->value);
2221
- } else {
2222
- $config[$row->label] = $row->value;
 
 
 
 
 
2223
  }
2224
  }
2225
  }
2226
- return($config);
2227
  }
2228
 
2229
  /**
@@ -2238,22 +2207,28 @@ function GetDBConfig() {
2238
  if (!isset($config["PREFER_TEXT_TYPE"]))
2239
  $config["PREFER_TEXT_TYPE"] = "plain";
2240
  if (!isset($config["DEFAULT_TITLE"]))
2241
- $config["DEFAULT_TITLE"] = "Live From The Field";
 
2242
  if (!isset($config["INPUT_PROTOCOL"]))
2243
- $config["INPUT_PROTOCOL"] = "pop3";
 
2244
  if (!isset($config["IMAGE_PLACEHOLDER"]))
2245
- $config["IMAGE_PLACEHOLDER"] = "#img%#";
 
2246
  if (!isset($config["IMAGES_APPEND"]))
2247
  $config["IMAGES_APPEND"] = true;
 
2248
  if (!isset($config["ALLOW_SUBJECT_IN_MAIL"]))
2249
  $config["ALLOW_SUBJECT_IN_MAIL"] = true;
2250
  if (!isset($config["DROP_SIGNATURE"]))
2251
  $config["DROP_SIGNATURE"] = true;
2252
  if (!isset($config["MESSAGE_START"]))
2253
  $config["MESSAGE_START"] = ":start";
 
2254
  if (!isset($config["MESSAGE_END"]))
2255
  $config["MESSAGE_END"] = ":end";
2256
- if (!isset($config["FORWARD_REJECTED_MAIL"]))
 
2257
  $config["FORWARD_REJECTED_MAIL"] = true;
2258
  if (!isset($config["RETURN_TO_SENDER"]))
2259
  $config["RETURN_TO_SENDER"] = false;
@@ -2269,97 +2244,127 @@ function GetDBConfig() {
2269
  $config["MESSAGE_ENCODING"] = "UTF-8";
2270
  if (!isset($config["MESSAGE_DEQUOTE"]))
2271
  $config["MESSAGE_DEQUOTE"] = true;
 
2272
  if (!isset($config["TURN_AUTHORIZATION_OFF"]))
2273
  $config["TURN_AUTHORIZATION_OFF"] = false;
2274
  if (!isset($config["CUSTOM_IMAGE_FIELD"]))
2275
- $config["CUSTOM_IMAGE_FIELD"] = false;
 
2276
  if (!isset($config["CONVERTNEWLINE"]))
2277
  $config["CONVERTNEWLINE"] = false;
2278
  if (!isset($config["SIG_PATTERN_LIST"]))
2279
- $config["SIG_PATTERN_LIST"] = array('--', '- --');
2280
  if (!isset($config["BANNED_FILES_LIST"]))
2281
  $config["BANNED_FILES_LIST"] = array();
2282
  if (!isset($config["SUPPORTED_FILE_TYPES"]))
2283
- $config["SUPPORTED_FILE_TYPES"] = array("video", "application");
 
2284
  if (!isset($config["AUTHORIZED_ADDRESSES"]))
2285
  $config["AUTHORIZED_ADDRESSES"] = array();
2286
  if (!isset($config["MAIL_SERVER"]))
2287
  $config["MAIL_SERVER"] = NULL;
2288
- if (!isset($config["MAIL_SERVER_PORT"]))
 
2289
  $config["MAIL_SERVER_PORT"] = NULL;
2290
- if (!isset($config["MAIL_USERID"]))
 
2291
  $config["MAIL_USERID"] = NULL;
2292
  if (!isset($config["MAIL_PASSWORD"]))
2293
  $config["MAIL_PASSWORD"] = NULL;
2294
- if (!isset($config["DEFAULT_POST_CATEGORY"]))
 
2295
  $config["DEFAULT_POST_CATEGORY"] = NULL;
2296
- if (!isset($config["DEFAULT_POST_TAGS"]))
 
2297
  $config["DEFAULT_POST_TAGS"] = NULL;
2298
- if (!isset($config["TIME_OFFSET"]))
 
2299
  $config["TIME_OFFSET"] = get_option('gmt_offset');
2300
  if (!isset($config["WRAP_PRE"]))
2301
  $config["WRAP_PRE"] = 'no';
2302
- if (!isset($config["CONVERTURLS"]))
 
2303
  $config["CONVERTURLS"] = true;
2304
  if (!isset($config["SHORTCODE"]))
2305
  $config["SHORTCODE"] = false;
2306
  if (!isset($config["ADD_META"]))
2307
  $config["ADD_META"] = 'no';
2308
- $config['ICON_SETS'] = array('silver', 'black', 'white', 'custom', 'none');
 
2309
  if (!isset($config["ICON_SET"]))
2310
  $config["ICON_SET"] = 'silver';
2311
  $config['ICON_SIZES'] = array(32, 48, 64);
2312
  if (!isset($config["ICON_SIZE"]))
2313
  $config["ICON_SIZE"] = 32;
2314
- if (!isset($config["AUDIOTEMPLATE"]))
2315
- $config["AUDIOTEMPLATE"] = $simple_link;
 
 
2316
  if (!isset($config["SELECTED_AUDIOTEMPLATE"]))
2317
  $config['SELECTED_AUDIOTEMPLATE'] = 'simple_link';
2318
- include('templates/audio_templates.php');
2319
  $config['AUDIOTEMPLATES'] = $audioTemplates;
2320
  if (!isset($config["SELECTED_VIDEO1TEMPLATE"]))
2321
  $config['SELECTED_VIDEO1TEMPLATE'] = 'simple_link';
2322
- include('templates/video1_templates.php');
2323
- $config['VIDEO1TEMPLATES'] = $video1Templates;
2324
- if (!isset($config["VIDEO1TEMPLATE"]))
2325
- $config["VIDEO1TEMPLATE"] = $simple_link;
 
2326
  if (!isset($config["VIDEO1TYPES"]))
2327
- $config['VIDEO1TYPES'] = array('mp4', 'mpeg4', '3gp', '3gpp', '3gpp2',
 
2328
  '3gp2', 'mov', 'mpeg');
2329
  if (!isset($config["AUDIOTYPES"]))
2330
  $config['AUDIOTYPES'] = array('m4a', 'mp3', 'ogg', 'wav', 'mpeg');
2331
  if (!isset($config["SELECTED_VIDEO2TEMPLATE"]))
2332
  $config['SELECTED_VIDEO2TEMPLATE'] = 'simple_link';
2333
- include('templates/video2_templates.php');
2334
- $config['VIDEO2TEMPLATES'] = $video2Templates;
2335
- if (!isset($config["VIDEO2TEMPLATE"]))
2336
- $config["VIDEO2TEMPLATE"] = $simple_link;
 
 
 
2337
  if (!isset($config["VIDEO2TYPES"]))
2338
  $config['VIDEO2TYPES'] = array('x-flv');
2339
  if (!isset($config["POST_STATUS"]))
2340
  $config["POST_STATUS"] = 'publish';
2341
- if (!isset($config["IMAGE_NEW_WINDOW"]))
 
2342
  $config["IMAGE_NEW_WINDOW"] = false;
2343
- if (!isset($config["FILTERNEWLINES"]))
 
2344
  $config["FILTERNEWLINES"] = true;
2345
- include('templates/image_templates.php');
2346
- $config['IMAGETEMPLATES'] = $imageTemplates;
 
 
 
 
 
 
2347
  if (!isset($config["SELECTED_IMAGETEMPLATE"]))
2348
- $config['SELECTED_IMAGETEMPLATE'] = 'wordpress_default';
2349
- if (!isset($config["IMAGETEMPLATE"]))
2350
- $config["IMAGETEMPLATE"] = $wordpress_default;
2351
  if (!isset($config["SMTP"]))
2352
  $config["SMTP"] = array();
 
 
 
 
 
 
2353
  return($config);
2354
  }
2355
 
2356
  /**
2357
- * This function returns the old-format config (pre 1.4)
 
2358
  * @return array
2359
  */
2360
  function GetConfig() {
2361
  $config = GetDBConfig();
2362
- //These should only be modified if you are testing
2363
  $config["DELETE_MAIL_AFTER_PROCESSING"] = true;
2364
  $config["POST_TO_DB"] = true;
2365
  $config["TEST_EMAIL"] = false;
@@ -2368,8 +2373,8 @@ function GetConfig() {
2368
  if (file_exists(POSTIE_ROOT . '/postie_test_variables.php')) {
2369
  include(POSTIE_ROOT . '/postie_test_variables.php');
2370
  }
2371
- //include(POSTIE_ROOT . "/../postie-test.php");
2372
- // These are computed
2373
  $config["TIME_OFFSET"] = get_option('gmt_offset');
2374
  $config["POSTIE_ROOT"] = POSTIE_ROOT;
2375
  for ($i = 0; $i < count($config["AUTHORIZED_ADDRESSES"]); $i++) {
@@ -2379,7 +2384,7 @@ function GetConfig() {
2379
  }
2380
 
2381
  /**
2382
- * end of functions used to retrieve the old (pre 1.4) config
2383
  * =======================================================
2384
  */
2385
 
@@ -2392,7 +2397,7 @@ function get_postie_config() {
2392
  if (file_exists(POSTIE_ROOT . '/postie_test_variables.php')) {
2393
  include(POSTIE_ROOT . '/postie_test_variables.php');
2394
  }
2395
- // These are computed
2396
  $config["time_offset"] = get_option('gmt_offset');
2397
  $config["postie_root"] = POSTIE_ROOT;
2398
  return $config;
@@ -2404,7 +2409,7 @@ function get_postie_config() {
2404
  */
2405
  function get_arrayed_settings() {
2406
  return array(
2407
- ',' => array('audiotypes', 'video1types', 'video2types', 'default_post_tags'),
2408
  "\n" => array('smtp', 'authorized_addresses', 'supported_file_types',
2409
  'banned_files_list', 'sig_pattern_list'));
2410
  }
@@ -2436,12 +2441,12 @@ function HasFunctions($function_list, $display = true) {
2436
  foreach ($function_list as $function) {
2437
  if (!function_exists($function)) {
2438
  if ($display) {
2439
- print("<p>Missing $function");
2440
  }
2441
- return(false);
2442
  }
2443
  }
2444
- return(true);
2445
  }
2446
 
2447
  /**
@@ -2463,7 +2468,7 @@ function TestForMarkdown() {
2463
  if (in_array("markdown.php", get_option("active_plugins"))) {
2464
  return(true);
2465
  }
2466
- return(false);
2467
  }
2468
 
2469
  /**
@@ -2471,20 +2476,20 @@ function TestForMarkdown() {
2471
  * and ensures that arrayed items are stored as such
2472
  */
2473
  function postie_validate_settings($in) {
2474
- if (defined('POSTIE_DEBUG'))
2475
- var_dump($in);
2476
  $out = array();
2477
 
2478
- // use the default as a template:
2479
- // if a field is present in the defaults, we want to store it; otherwise we discard it
2480
  $allowed_keys = get_postie_config_defaults();
2481
  foreach ($allowed_keys as $key => $default)
2482
  $out[$key] = array_key_exists($key, $in) ? $in[$key] : $default;
2483
 
2484
- // some fields are always forced to lower case:
2485
- $lowercase = array('authorized_addresses', 'smtp', 'supported_file_types', 'video1types', 'video2types', 'audiotypes');
 
2486
  foreach ($lowercase as $field) {
2487
- $out[$field] = ( is_array($out[$field]) ) ? array_map(strtolower, $out[$field]) : strtolower($out[$field]);
2488
  }
2489
  $arrays = get_arrayed_settings();
2490
 
@@ -2494,7 +2499,8 @@ function postie_validate_settings($in) {
2494
  $out[$field] = explode($sep, trim($out[$field]));
2495
  foreach ($out[$field] as $key => $val) {
2496
  $tst = trim($val);
2497
- if (empty($tst)) {
 
2498
  unset($out[$field][$key]);
2499
  } else {
2500
  $out[$field][$key] = $tst;
@@ -2522,28 +2528,47 @@ function UpdatePostiePermissions($role_access) {
2522
  $admin = $wp_roles->get_role("administrator");
2523
  $admin->add_cap("config_postie");
2524
  $admin->add_cap("post_via_postie");
 
2525
  if (!is_array($role_access)) {
2526
  $role_access = array();
2527
  }
2528
  foreach ($wp_roles->role_names as $roleId => $name) {
2529
  $role = &$wp_roles->get_role($roleId);
2530
  if ($roleId != "administrator") {
2531
- if ($role_access[$roleId]) {
2532
  $role->add_cap("post_via_postie");
 
2533
  } else {
2534
  $role->remove_cap("post_via_postie");
 
2535
  }
2536
  }
2537
  }
2538
  }
2539
 
 
 
 
 
 
 
 
 
2540
  function DebugEmailOutput(&$email, &$mimeDecodedEmail) {
2541
- $file = fopen("test_emails/" . $mimeDecodedEmail->headers["message-id"] . ".txt", "w");
2542
- fwrite($file, $email);
2543
- fclose($file);
2544
- $file = fopen("test_emails/" . $mimeDecodedEmail->headers["message-id"] . "-mime.txt", "w");
2545
- fwrite($file, print_r($mimeDecodedEmail, true));
2546
- fclose($file);
 
 
 
 
 
 
 
 
2547
  }
2548
 
2549
  /**
@@ -2565,8 +2590,7 @@ function SpecialMessageParsing(&$content, &$attachments, $config) {
2565
  if ($drop_signature) {
2566
  $content = remove_signature($content, $sig_pattern_list);
2567
  }
2568
- if ($prefer_text_type == "html"
2569
- && count($attachments["cids"])) {
2570
  ReplaceImageCIDs($content, $attachments);
2571
  }
2572
  if (!$custom_image_field) {
@@ -2574,13 +2598,13 @@ function SpecialMessageParsing(&$content, &$attachments, $config) {
2574
  } else {
2575
  $customImages = array();
2576
  foreach ($attachments["html"] as $value) {
2577
- preg_match("/src=['\"]([^'\"]*)['\"]/", $value, $matches);
2578
  array_push($customImages, $matches[1]);
2579
  }
2580
 
2581
- return($customImages);
2582
  }
2583
- return(NULL);
2584
  }
2585
 
2586
  /**
@@ -2594,7 +2618,9 @@ function VodafoneHandler(&$content, &$attachments) {
2594
  //The content is now just the text of the message
2595
  $content = $matches[1];
2596
  //Now to clean up the attachments
2597
- $vodafone_images = array("live.gif", "smiley.gif", "border_left_txt.gif", "border_top.gif", "border_bot.gif", "border_right.gif", "banner1.gif", "i_text.gif", "i_picture.gif",);
 
 
2598
  while (list($key, $value) = each($attachments['cids'])) {
2599
  if (!in_array($key, $vodafone_images)) {
2600
  $content .= "<br/>" . $attachments['html'][$attachments['cids'][$key][1]];
1
  <?php
2
 
3
+ /*
4
+ $Id: postie-functions.php 635140 2012-12-06 22:58:27Z WayneAllen $
5
+ */
6
+
7
+ /* TODO
8
+ * html purify
9
+ * USE built-in php message decoding to improve speed
10
+ * Add custom fields
11
+ * support for flexible upload plugin
12
+ * iso 8859-2 support
13
+ * add private post function
14
+ http://forum.robfelty.com/topic/how-to-private-posts-from-postie?replies=2#post-1515
15
+ * category per e-mail address
16
+ */
17
+
18
+ //to turn on debug output add the following line to wp-config.php
19
+ //define('POSTIE_DEBUG', true);
20
+
21
  function postie_disable_revisions($restore = false) {
22
  global $_wp_post_type_features, $_postie_revisions;
23
 
55
  }
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /* this function is necessary for wildcard matching on non-posix systems */
59
  if (!function_exists('fnmatch')) {
60
 
68
 
69
  }
70
 
71
+ function LogInfo($v) {
72
+ error_log("Postie: $v");
73
+ }
74
+
75
+ function EchoInfo($v) {
76
+ echo("<p>$v</p>\n");
77
+ LogInfo($v);
78
+ }
79
+
80
+ function DebugDump($v) {
81
+ if (IsDebugMode()) {
82
+ $o = print_r($v, true);
83
+ echo "<pre>\n";
84
+ EchoInfo($o);
85
+ echo "</pre>\n";
86
+ }
87
+ }
88
+
89
+ function DebugEcho($v) {
90
+ if (IsDebugMode()) {
91
+ EchoInfo($v);
92
+ }
93
+ }
94
+
95
  /**
96
  * This is the main handler for all of the processing
97
  */
106
  "cids" => array(), //holds the cids for HTML email
107
  "image_files" => array() //holds the files for each image
108
  );
109
+ EchoInfo("Message Id is :" . htmlentities($mimeDecodedEmail->headers["message-id"]));
110
+
 
 
 
 
 
 
 
111
  FilterTextParts($mimeDecodedEmail, $prefer_text_type);
112
+ $tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost');
 
113
  /* in order to do attachments correctly, we need to associate the
114
  attachments with a post. So we add the post here, then update it
115
  */
116
  $post_id = wp_insert_post($tmpPost);
117
+ EchoInfo("new post id is $post_id");
118
+
 
119
  $content = GetContent($mimeDecodedEmail, $attachments, $post_id, $poster, $config);
120
+ DebugEcho("the content is $content");
121
+
 
122
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
123
+
 
 
124
  $customImages = SpecialMessageParsing($content, $attachments, $config);
125
  $post_excerpt = GetPostExcerpt($content, $filternewlines, $convertnewline);
126
  $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail);
127
  $message_date = NULL;
128
+ if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) {
129
+ $cte = "";
130
+ $cs = "";
131
+ if (array_key_exists('content-transfer-encoding', $mimeDecodedEmail->headers)) {
132
+ $cte = $mimeDecodedEmail->headers["content-transfer-encoding"];
133
+ }
134
+ if (array_key_exists('charset', $mimeDecodedEmail->ctype_parameters)) {
135
+ $cs = $mimeDecodedEmail->ctype_parameters["charset"];
136
+ }
137
+ $message_date = HandleMessageEncoding($cte, $cs, $mimeDecodedEmail->headers["date"], $message_encoding, $message_dequote);
138
  }
139
  list($post_date, $post_date_gmt, $delay) = DeterminePostDate($content, $message_date, $time_offset);
140
  ubb2HTML($content);
142
  if ($converturls)
143
  $content = clickableLink($content, $shortcode);
144
 
 
 
145
  $id = checkReply($subject);
146
  $post_categories = GetPostCategories($subject, $default_post_category);
147
  $post_tags = postie_get_tags($content, $default_post_tags);
164
  }
165
  }
166
  } else {
167
+ EchoInfo("Reply detected");
168
  $isReply = true;
169
  // strip out quoted content
170
  $lines = explode("\n", $content);
 
171
  $newContents = '';
172
  foreach ($lines as $line) {
 
 
173
  if (preg_match("/^>.*/i", $line) == 0 &&
174
  preg_match("/^(from|subject|to|date):.*?/i", $line) == 0 &&
175
  preg_match("/^-+.*?(from|subject|to|date).*?/i", $line) == 0 &&
184
  if ($filternewlines)
185
  $content = FilterNewLines($content, $convertnewline);
186
 
 
187
  if ($delay != 0 && $post_status == 'publish') {
188
  $post_status = 'future';
189
  } else {
190
  $post_status = $post_status;
191
  }
192
+
193
+ $post_type = GetPostType($subject);
194
+
195
  $details = array(
196
  'post_author' => $poster,
197
  'comment_author' => $postAuthorDetails['author'],
199
  'user_ID' => $postAuthorDetails['user_ID'],
200
  'email_author' => $postAuthorDetails['email'],
201
  'post_date' => $post_date,
202
+ 'post_date_gmt' => $post_date_gmt,
 
203
  'post_content' => $content,
204
  'post_title' => $subject,
205
+ 'post_type' => $post_type, /* Added by Raam Dev <raam@raamdev.com> */
 
206
  'ping_status' => get_option('default_ping_status'),
207
  'post_category' => $post_categories,
208
  'tags_input' => $post_tags,
241
  }
242
 
243
  /** FUNCTIONS * */
244
+ /*
245
+ * Added by Raam Dev <raam@raamdev.com>
246
+ * Adds support for handling Custom Post Types by adding the
247
+ * Custom Post Type name to the email subject separated by
248
+ * $custom_post_type_delim, e.g. "Movies // My Favorite Movie"
249
+ */
250
+ function GetPostType(&$subject) {
251
+
252
+ $custom_post_type_delim = "//";
253
+ if (strpos($subject, $custom_post_type_delim) !== FALSE) {
254
+
255
+ // Captures the custom post type in the subject before $custom_post_type_delim
256
+ $separated_subject = explode($custom_post_type_delim, $subject);
257
+ $custom_post_type = $separated_subject[0];
258
+ $subject = $separated_subject[1];
259
+
260
+ $custom_post_type = trim(strtolower($custom_post_type));
261
+
262
+ // Check if custom post type exists, if not, set default post type of 'post'
263
+ $known_post_types = get_post_types();
264
+
265
+ if (in_array($custom_post_type, $known_post_types)) {
266
+ $post_type = $custom_post_type;
267
+ } else {
268
+ $post_type = 'post';
269
+ }
270
+ } else {
271
+ $post_type = 'post';
272
+ }
273
+
274
+ return $post_type;
275
+ }
276
+
277
  function clickableLink($text, $shortcode = false) {
278
+ # this functions deserves credit to the fine folks at phpbb.com
279
+ # It turns urls into links, and video urls into embedded players
280
 
281
  $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
282
 
283
+ // pad it with a space so we can match things at the start of the 1st line.
284
  $ret = ' ' . $text;
285
  if (strpos($ret, 'youtube') !== false) {
286
+ // try to embed youtube videos
287
  $youtube = "#(^|[\n ]|>)[\w]+?://(www\.)?youtube\.com/watch\?v=([_a-zA-Z0-9-]+).*?([ \n]|$|<)#is";
288
+ #$youtube="#(^|[\n ]|<p[^<]*>)[\w]+?://(www\.)?youtube\.com/watch\?v=([_a-zA-Z0-9]+).*?([ \n]|$|</p>)#is";
289
  if ($shortcode) {
290
  $youtube_replace = "\\1[youtube \\3]\\4";
291
  } else {
295
  }
296
 
297
  if (strpos($ret, 'vimeo') !== false) {
298
+ // try to embed vimeo videos
299
  # : http://vimeo.com/6348141
300
  $vimeo = "#(^|[\n ]|>)[\w]+?://(www\.)?vimeo\.com/([_a-zA-Z0-9-]+).*?([ \n]|$|<)#is";
301
+ #$youtube="#(^|[\n ]|<p[^<]*>)[\w]+?://(www\.)?youtube\.com/watch\?v=([_a-zA-Z0-9]+).*?([ \n]|$|</p>)#is";
302
  if ($shortcode) {
303
  $vimeo_replace = "\\1[vimeo \\3]\\4";
304
  } else {
315
  $ret = preg_replace($vimeo, $vimeo_replace, $ret);
316
  }
317
 
318
+ // matches an "xxxx://yyyy" URL at the start of a line, or after a space.
319
+ // xxxx can only be alpha characters.
320
+ // yyyy is anything up to the first space, newline, comma, double quote or <
321
  $ret = preg_replace("#(^|[\n ])<?([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)>?#is", "\\1<a href=\"\\2\" >\\2</a>", $ret);
322
 
323
+ // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
324
+ // Must contain at least 2 dots. xxxx contains either alphanum, or "-"
325
+ // zzzz is optional.. will contain everything up to the first space, newline,
326
+ // comma, double quote or <.
327
  $ret = preg_replace("#(^|[\n ])<?((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)>?#is", "\\1<a href=\"http://\\2\" >\\2</a>", $ret);
328
 
329
+ // matches an email@domain type address at the start of a line, or after a space.
330
+ // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
331
  $ret = preg_replace(
332
  "#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
333
+ // Remove our padding..
334
  $ret = substr($ret, 1);
335
  return $ret;
336
  }
341
  * Otherwise we get them from the headers
342
  */
343
  global $wpdb;
344
+ // see if subject starts with Fwd:
345
  if (preg_match("/(^Fwd:) (.*)/", $subject, $matches)) {
346
  $subject = trim($matches[2]);
347
  if (preg_match("/\nfrom:(.*?)\n/i", $content, $matches)) {
400
  */
401
 
402
  global $wpdb;
403
+
404
+ $id = NULL;
405
+
406
  // see if subject starts with Re:
407
  if (preg_match("/(^Re:) (.*)/i", $subject, $matches)) {
408
  $subject = trim($matches[2]);
424
  if (is_array($id)) {
425
  $id = $id[count($id) - 1];
426
  }
 
 
427
  }
428
  }
429
+ return $id;
430
  }
431
 
432
  function postie_read_me() {
439
  function PostieMenu() {
440
  if (function_exists('add_options_page')) {
441
  if (current_user_can('manage_options')) {
442
+ add_options_page("Postie", "Postie", 'manage_options', POSTIE_ROOT . "/postie.php", "ConfigurePostie");
443
  }
444
  }
445
  }
458
  function FetchMail($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true) {
459
  $emails = array();
460
  if (!$server || !$port || !$email) {
461
+ EchoInfo("Missing Configuration For Mail Server");
462
+ return $emails;
463
  }
464
  if ($server == "pop.gmail.com") {
465
+ EchoInfo("MAKE SURE POP IS TURNED ON IN SETTING AT Gmail");
466
  }
467
  switch (strtolower($protocol)) {
468
  case 'smtp': //direct
477
  case 'imap':
478
  case 'imap-ssl':
479
  case 'pop3-ssl':
480
+ if (!HasIMAPSupport()) {
481
+ EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
 
482
  } else {
483
  $emails = IMAPMessageFetch($server, $port, $email, $password, $protocol, $offset, $test, $deleteMessages);
484
  }
485
  break;
486
  case 'pop3':
487
  default:
488
+ $emails = POP3MessageFetch($server, $port, $email, $password, $protocol, $offset, $test, $deleteMessages);
 
 
 
 
489
  }
 
 
 
 
490
 
491
+ return $emails;
 
 
 
 
 
 
 
 
 
492
  }
493
 
494
  /**
496
  */
497
  function IMAPMessageFetch($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true) {
498
  require_once("postieIMAP.php");
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  $emails = array();
500
+ $mail_server = &PostieIMAP::Factory($protocol);
501
+ EchoInfo("Connecting to $server:$port ($protocol)");
502
+ if ($mail_server->connect($server, $port, $email, $password)) {
503
+ $msg_count = $mail_server->getNumberOfMessages();
504
+ } else {
505
+ EchoInfo("Mail Connection Time Out");
506
+ EchoInfo("Common Reasons: Server Down, Network Issue, Port/Protocol MisMatch ");
507
+ EchoInfo("The Server said:" . $mail_server->error());
508
+ $msg_count = 0;
509
+ }
510
+
511
  // loop through messages
512
  for ($i = 1; $i <= $msg_count; $i++) {
513
  $emails[$i] = $mail_server->fetchEmail($i);
523
  return $emails;
524
  }
525
 
 
 
 
 
 
 
 
 
 
526
  /**
527
  * Retrieves email via POP3
528
  */
529
  function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true) {
530
  require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
531
+
532
+ $emails = array();
533
+ $pop3 = new POP3();
534
+
535
+ EchoInfo("Connecting to $server:$port ($protocol))");
536
+
537
+ if ($pop3->connect($server, $port)) {
538
+ $msg_count = $pop3->login($email, $password);
539
+ if ($msg_count === false) {
540
+ $msg_count = 0;
541
+ }
542
+ } else {
543
  if (strpos($pop3->ERROR, "POP3: premature NOOP OK, NOT an RFC 1939 Compliant server") === false) {
544
+ EchoInfo("Mail Connection Time Out. Common Reasons: Server Down, Network Issue, Port/Protocol MisMatch");
 
 
 
 
 
 
545
  }
546
+ EchoInfo("The Server said: $pop3->ERROR");
547
+ $msg_count = 0;
 
 
 
 
 
 
 
 
548
  }
549
 
550
  // loop through messages
552
  $emails[$i] = implode('', $pop3->get($i));
553
  if ($deleteMessages) {
554
  if (!$pop3->delete($i)) {
555
+ EchoInfo('pop3 cannot delete message ' . $pop3->ERROR);
556
  $pop3->reset();
557
  exit;
 
 
558
  }
 
 
559
  }
560
  }
561
  //clean up
570
  */
571
  function PostToDB($details, $isReply, $postToDb = true, $customImageField = false) {
572
  if ($postToDb) {
 
573
  if (!$isReply) {
574
  $post_ID = wp_insert_post($details);
575
  } else {
615
  return false;
616
  foreach ($bannedFiles as $bannedFile) {
617
  if (fnmatch($bannedFile, $filename)) {
618
+ EchoInfo("Ignoring attachment: $filename - it is on the banned files list.");
619
+ return true;
620
  }
621
  }
622
+ return false;
623
  }
624
 
625
  //tear apart the meta part for useful information
626
  function GetContent($part, &$attachments, $post_id, $poster, $config) {
627
  extract($config);
628
  global $charset, $encoding;
629
+
 
 
 
630
  $meta_return = NULL;
631
+ EchoInfo("primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary);
632
+
633
  DecodeBase64Part($part);
634
+
635
+ if (array_key_exists('name', $part->ctype_parameters))
636
+ if (BannedFileName($part->ctype_parameters['name'], $banned_files_list))
637
+ return NULL;
638
+
639
+ if ($part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") {
640
  if ($part->disposition == "attachment") {
641
  $image_endings = array("jpg", "png", "gif", "jpeg", "pjpeg");
642
  foreach ($image_endings as $type) {
654
  }
655
  }
656
  }
657
+ if ($part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") {
 
658
  $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body);
659
  FilterTextParts($mimeDecodedEmail, $prefer_text_type);
660
  FilterAppleFile($mimeDecodedEmail);
663
  }
664
  } else {
665
  // fix filename (remove non-standard characters)
666
+ $filename = "";
667
+ if (array_key_exists('name', $part->ctype_parameters)) {
668
+ $filename = preg_replace("/[^\x9\xA\xD\x20-\x7F]/", "", $part->ctype_parameters['name']);
669
+ }
670
  switch (strtolower($part->ctype_primary)) {
671
  case 'multipart':
672
  FilterTextParts($part, $prefer_text_type);
678
  $tmpcharset = trim($part->ctype_parameters['charset']);
679
  if ($tmpcharset != '')
680
  $charset = $tmpcharset;
681
+ DebugEcho("charset: $tmpcharset");
682
+ if (array_key_exists('content-transfer-encoding', $part->headers)) {
683
+ $tmpencoding = trim($part->headers['content-transfer-encoding']);
684
+ if ($tmpencoding != '') {
685
+ $encoding = $tmpencoding;
686
+ }
687
+ }
688
 
689
+ if (array_key_exists('content-transfer-encoding', $part->headers)) {
690
+ DebugDump($part);
691
+ $part->body = HandleMessageEncoding($part->headers["content-transfer-encoding"], $part->ctype_parameters["charset"], $part->body, $message_encoding, $message_dequote);
692
+ DebugDump($part);
693
+ }
694
 
695
  //go through each sub-section
696
  if ($part->ctype_secondary == 'enriched') {
698
  $meta_return .= etf2HTML($part->body) . "\n";
699
  } elseif ($part->ctype_secondary == 'html') {
700
  //strip excess HTML
701
+ $meta_return .= HTML2HTML($part->body) . "\n";
 
702
  } else {
703
  //regular text, so just strip the pgp signature
704
+ if ($allow_html_in_body) {
705
  $meta_return .= $part->body . "\n";
706
  } else {
707
  $meta_return .= htmlentities($part->body) . "\n";
713
  case 'image':
714
  $file_id = postie_media_handle_upload($part, $post_id, $poster);
715
  $file = wp_get_attachment_url($file_id);
716
+ $cid = "";
717
+ if (array_key_exists('content-id', $part->headers)) {
718
+ $cid = trim($part->headers["content-id"], "<>");
719
+ }
720
  ; //cids are in <cid>
721
  $the_post = get_post($file_id);
722
  $attachments["html"][$filename] = parseTemplate($file_id, $part->ctype_primary, $imagetemplate);
723
  if ($cid) {
724
+ $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1);
 
725
  }
726
  break;
727
  case 'audio':
764
  $cid = trim($part->headers["content-id"], "<>");
765
  ; //cids are in <cid>
766
  $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $icon_set, $icon_size);
767
+ $attachments["html"][$filename] = "<a href='$file'>" . $icon . $filename . '</a>' . "\n";
 
768
  if ($cid) {
769
+ $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1);
 
770
  }
771
  }
772
  break;
773
  }
774
  }
775
+ return $meta_return;
776
  }
777
 
778
  function ubb2HTML(&$text) {
779
+ // Array of tags with opening and closing
780
  $tagArray['img'] = array('open' => '<img src="', 'close' => '">');
781
  $tagArray['b'] = array('open' => '<b>', 'close' => '</b>');
782
  $tagArray['i'] = array('open' => '<i>', 'close' => '</i>');
788
  $tagArray['color=(.*)'] = array('open' => '<font color="', 'close' => '">\\2</font>');
789
  $tagArray['size=(.*)'] = array('open' => '<font size="', 'close' => '">\\2</font>');
790
  $tagArray['font=(.*)'] = array('open' => '<font face="', 'close' => '">\\2</font>');
791
+ // Array of tags with only one part
792
  $sTagArray['br'] = array('tag' => '<br>');
793
  $sTagArray['hr'] = array('tag' => '<hr>');
794
 
842
  '',
843
  ''
844
  );
845
+ // strip extra line breaks
846
  $content = preg_replace($search, $replace, $content);
847
  return trim($content);
848
  }
849
 
850
  // This function cleans up HTML in the e-mail
851
  function HTML2HTML($content) {
852
+ $html = str_get_html($content);
853
+ if ($html) {
854
+ $b = $html->find('body');
855
+ if ($b) {
856
+ $content = $b[0]->outertext;
857
+ }
858
+ }
859
+ return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
860
  }
861
 
862
  /**
868
  global $wpdb;
869
  $poster = NULL;
870
  $from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"]));
871
+
872
+ $resentFrom = "";
873
+ if (array_key_exists('resent-from', $mimeDecodedEmail->headers)) {
874
+ $resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["resent-from"]));
875
+ }
 
 
876
 
877
  //See if the email address is one of the special authorized ones
878
+ EchoInfo("Confirming Access For $from ");
879
  $sql = 'SELECT id FROM ' . $wpdb->users . ' WHERE user_email=\'' . addslashes($from) . "' LIMIT 1;";
880
  $user_ID = $wpdb->get_var($sql);
881
  if (!empty($user_ID)) {
882
  $user = new WP_User($user_ID);
883
  if ($user->has_cap("post_via_postie")) {
884
  $poster = $user_ID;
885
+ EchoInfo("posting as user $poster");
886
  } else {
887
  $poster = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE
888
  user_login = '$admin_username'");
889
  }
890
+ } elseif ($turn_authorization_off || CheckEmailAddress($from, $authorized_addresses) || CheckEmailAddress($resentFrom, $authorized_addresses)) {
891
+ $poster = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$admin_username'");
 
 
 
892
  }
893
  $validSMTP = checkSMTP($mimeDecodedEmail, $smtp);
894
  if (!$poster || !$validSMTP) {
895
+ EchoInfo('Invalid sender: ' . htmlentities($from) . "! Not adding email!");
896
  if ($forward_rejected_mail) {
897
  $admin_email = get_option("admin_email");
898
  if (MailToRecipients($mimeDecodedEmail, $test_email, array($admin_email), $return_to_sender)) {
899
+ EchoInfo("A copy of the message has been forwarded to the administrator.");
900
  } else {
901
+ EchoInfo("The message was unable to be forwarded to the adminstrator.");
902
  }
903
  }
904
  return;
907
  }
908
 
909
  function post_as_admin($admin_username) {
910
+ EchoInfo("$from is authorized to post as the administrator");
911
+ //$from = get_option("admin_email");
912
+ //$adminUser=$admin_username;
913
+ //echo "adminUser='$adminUser'";
914
  return $poster;
915
  }
916
 
933
  * @param string
934
  */
935
  function StartFilter(&$content, $start) {
936
+ DebugEcho("start filter $start");
937
  $pos = strpos($content, $start);
938
  if ($pos === false) {
939
  return($content);
953
  $arrcontent = explode("\n", $content);
954
  $strcontent = '';
955
  $pattern = '/^(' . implode('|', $filterList) . ')/';
956
+ for ($i = 0; $i < count($arrcontent); $i++) {
957
  $line = trim($arrcontent[$i]);
 
958
  if (preg_match($pattern, trim($line))) {
 
 
959
  break;
960
  }
961
  $strcontent .= $line . "\n";
969
  * @param string
970
  * @param filter
971
  */
972
+ function EndFilter($content, $end) {
973
+ DebugEcho("end filter $end");
974
  $pos = strpos($content, $end);
975
  if ($pos === false)
976
  return $content;
993
  'ACTUAL_NEW_LINE',
994
  'LINEBREAK'
995
  );
996
+
 
997
  $result = preg_replace($search, $replace, $content);
 
998
 
 
 
999
  if ($convertNewLines) {
1000
+ $newContent = preg_replace('/(ACTUAL_NEW_LINE|LINEBREAK)/', "<br />\n", $result);
 
 
 
1001
  } else {
1002
+ $newContent = preg_replace('/(ACTUAL_NEW_LINE|LINEBREAK)/', " ", $result);
 
 
 
1003
  }
1004
+ return $newContent;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1005
  }
1006
 
1007
  //strip pgp stuff
1014
  ' ',
1015
  ''
1016
  );
1017
+ // strip extra line breaks
1018
  $return = preg_replace($search, $replace, $content);
1019
  return $return;
1020
  }
1021
 
1022
+ function ConvertUTF8ToISO_8859_1($contenttransferencoding, $currentcharset, $body) {
1023
+ if ((strtolower($currentcharset) != 'iso-8859-1')) {
1024
+ $contenttransferencoding = strtolower($contenttransferencoding);
1025
+ if ($contenttransferencoding == 'base64') {
 
1026
  $body = utf8_decode($body);
1027
  }
1028
+ if ($contenttransferencoding == 'quoted-printable') {
1029
+ $body = iconv($currentcharset, 'UTF-8', quoted_printable_decode($body));
1030
+ }
1031
  }
1032
+ return $body;
1033
  }
1034
 
1035
+ function HandleMessageEncoding($contenttransferencoding, $charset, $body, $blogEncoding = 'utf-8', $dequote = true) {
1036
  $charset = strtolower($charset);
1037
+ $contenttransferencoding = strtolower($contenttransferencoding);
1038
+
1039
+ DebugEcho("before HandleMessageEncoding: $body");
1040
+ DebugEcho("charset: $charset");
1041
+ DebugEcho("encoding: $contenttransferencoding");
1042
+
1043
+ if ($contenttransferencoding == 'base64') {
1044
+ DebugEcho("base64 detected");
1045
+ $body = base64_decode($body);
1046
+ $body = iconv($charset, $blogEncoding, $body);
 
 
 
 
 
 
1047
  }
1048
+ if ($dequote && $contenttransferencoding == 'quoted-printable') {
1049
+ DebugEcho("quoted-printable detected");
1050
+ $body = iconv($charset, $blogEncoding, quoted_printable_decode($body));
1051
+ }
1052
+
1053
+ DebugEcho("after HandleMessageEncoding: $body");
1054
+ return $body;
1055
  }
1056
 
1057
+ function ConvertToUTF_8($charset, $body) {
1058
  $charset = strtolower($charset);
 
1059
 
1060
  switch ($charset) {
1061
  case "iso-8859-1":
1064
  case "iso-2022-jp":
1065
  $body = iconv("ISO-2022-JP", "UTF-8//TRANSLIT", $body);
1066
  break;
1067
+ case ($charset == "windows-1252" || $charset == "cp-1252" || $charset == "cp 1252"):
 
1068
  $body = cp1252_to_utf8($body);
1069
  break;
1070
+ case ($charset == "windows-1256" || $charset == "cp-1256" || $charset == "cp 1256"):
 
1071
  $body = iconv("Windows-1256", "UTF-8//TRANSLIT", $body);
1072
  break;
1073
  case 'koi8-r':
1085
  case "iso-8859-15":
1086
  $body = iconv("iso-8859-15", "UTF-8//TRANSLIT", $body);
1087
  break;
1088
+ default :
1089
+ $body = iconv($charset, "UTF-8//TRANSLIT", $body);
1090
+ break;
1091
  }
1092
+ return $body;
1093
  }
1094
 
1095
  /* this function will convert windows-1252 (also known as cp-1252 to utf-8 */
1131
  * This function handles decoding base64 if needed
1132
  */
1133
  function DecodeBase64Part(&$part) {
1134
+ if (array_key_exists('content-transfer-encoding', $part->headers)) {
1135
+ if (strtolower($part->headers['content-transfer-encoding']) == 'base64') {
1136
+ DebugEcho("base64 detected");
1137
+ $part->body = iconv($part->ctype_parameters['charset'], 'UTF-8', base64_decode($part->body));
1138
+ }
 
 
 
 
1139
  }
1140
  }
1141
 
1144
  * @return boolean
1145
  */
1146
  function AllowCommentsOnPost(&$content) {
1147
+ $comments_allowed = get_option('default_comment_status'); // 'open' or 'closed'
1148
+
1149
+ if (preg_match("/comments:([0|1|2])/i", $content, $matches)) {
1150
+ $content = preg_replace("/comments:$matches[1]/i", "", $content);
1151
  if ($matches[1] == "1") {
1152
  $comments_allowed = "open";
1153
  } else if ($matches[1] == "2") {
1156
  $comments_allowed = "closed";
1157
  }
1158
  }
1159
+ return $comments_allowed;
1160
  }
1161
 
1162
  /**
1164
  */
1165
  function DeterminePostDate(&$content, $message_date = NULL, $offset = 0) {
1166
  $delay = 0;
1167
+
1168
+ if (preg_match("/delay:(-?[0-9dhm]+)/i", $content, $matches) && trim($matches[1])) {
1169
+ $days = 0;
1170
+ $hours = 0;
1171
+ $minutes = 0;
1172
+ if (preg_match("/(-?[0-9]+)d/i", $matches[1], $dayMatches)) {
1173
  $days = $dayMatches[1];
1174
  }
1175
+ if (preg_match("/(-?[0-9]+)h/i", $matches[1], $hourMatches)) {
1176
  $hours = $hourMatches[1];
1177
  }
1178
+ if (preg_match("/(-?[0-9]+)m/i", $matches[1], $minuteMatches)) {
1179
  $minutes = $minuteMatches[1];
1180
  }
1181
  $delay = (($days * 24 + $hours) * 60 + $minutes) * 60;
1182
+ $content = preg_replace("/delay:$matches[1]/i", "", $content);
1183
  }
1184
+ if (empty($message_date)) {
1185
+ $dateInSeconds = time();
1186
  } else {
1187
+ $dateInSeconds = strtotime($message_date);
1188
  }
1189
+ $dateInSeconds += $delay;
1190
+
1191
  $post_date = gmdate('Y-m-d H:i:s', $dateInSeconds + ($offset * 3600));
1192
  $post_date_gmt = gmdate('Y-m-d H:i:s', $dateInSeconds);
1193
 
1197
  echo "post_date=$post_date\n";
1198
  echo "--------------------DELAY------------\n";
1199
  */
1200
+ return array($post_date, $post_date_gmt, $delay);
1201
  }
1202
 
1203
  /**
1205
  */
1206
  function ParseInMessageSubject($content, $defaultTitle) {
1207
  if (substr($content, 0, 1) != "#") {
1208
+ //print("<p>Didn't start with # '".substr(ltrim($content),0,10)."'");
1209
  return(array($defaultTitle, $content));
1210
  }
1211
  $subjectEndIndex = strpos($content, "#", 1);
1228
  for ($i = 0; $i < count($mimeDecodedEmail->parts); $i++) {
1229
  if ($mimeDecodedEmail->parts[$i]->ctype_secondary == "applefile") {
1230
  $found = true;
1231
+ LogInfo("Removing 'applefile'");
1232
  } else {
1233
  $newParts[] = &$mimeDecodedEmail->parts[$i];
1234
  }
1240
 
1241
  function postie_media_handle_upload($part, $post_id, $poster, $post_data = array()) {
1242
  $overrides = array('test_form' => false);
1243
+ //$overrides = array('test_form'=>false, 'test_size'=>false,
1244
+ // 'test_type'=>false);
1245
  $tmpFile = tempnam(getenv('TEMP'), 'postie');
1246
  if (!is_writable($tmpFile)) {
1247
  $uploadDir = wp_upload_dir();
1252
  fwrite($fp, $part->body);
1253
  fclose($fp);
1254
  } else {
1255
+ EchoInfo("could not write to temp file: '$tmpFile' ");
1256
  }
1257
  if ($part->ctype_parameters['name'] == '') {
1258
  if ($part->d_parameters['filename'] != '') {
1278
  }
1279
 
1280
  $time = current_time('mysql');
1281
+ $post = get_post($post_id);
1282
+ if (substr($post->post_date, 0, 4) > 0)
1283
+ $time = $post->post_date;
1284
+
1285
 
1286
  $file = postie_handle_upload($the_file, $overrides, $time);
1287
  //unlink($tmpFile);
1288
 
1289
+ if (isset($file['error'])) {
1290
+ throw new Exception($file['error']);
1291
  return new WP_Error('upload_error', $file['error']);
1292
+ }
1293
 
1294
  $url = $file['url'];
1295
  $type = $file['type'];
1409
  // Move the file to the uploads dir
1410
  $new_file = $uploads['path'] . "/$filename";
1411
  if (false === @ rename($file['tmp_name'], $new_file)) {
1412
+ print_r($file);
1413
  return $upload_error_handler($file, sprintf(__('The uploaded file could not be moved to %s.'), $uploads['path']));
1414
  }
1415
 
1466
  }
1467
  if ($found && $newParts) {
1468
  //This is now the filtered list of just the preferred type.
1469
+ echo count($newParts) . " parts\n";
1470
  $mimeDecodedEmail->parts = $newParts;
1471
  }
1472
  }
1484
  $myemailadd = get_option("admin_email");
1485
  $blogname = get_option("blogname");
1486
  $blogurl = get_option("siteurl");
1487
+ //array_push($recipients, $myemailadd);
1488
  if (count($recipients) == 0) {
1489
  return false;
1490
  }
1502
  $headers .= "Cc: " . $recipient . "\r\n";
1503
  }
1504
  }
1505
+ // Set email subject
1506
  if ($reject) {
1507
  $alert_subject = $blogname . ": Unauthorized Post Attempt from $from";
1508
  if ($mail_content->ctype_parameters['boundary']) {
1510
  } else {
1511
  $boundary = uniqid("B_");
1512
  }
1513
+ // Set sender details
1514
  /*
1515
  if (isset($mail_content->headers["mime-version"])) {
1516
  $headers .= "Mime-Version: ". $mail_content->headers["mime-version"] . "\r\n";
1521
  */
1522
 
1523
  $headers.="Content-Type:multipart/alternative; boundary=\"$boundary\"\r\n";
1524
+ // SDM 20041123
1525
+ // construct mail message
1526
  $message = "An unauthorized message has been sent to $blogname.\n";
1527
  $message .= "Sender: $from\n";
1528
  $message .= "Subject: $subject\n";
1559
  }
1560
 
1561
 
1562
+ // Send message
1563
  mail($myemailadd, $alert_subject, $mailtext, $headers);
1564
 
1565
  return true;
1576
  $params['decode_bodies'] = false;
1577
  $params['decode_headers'] = $decodeHeaders;
1578
  $params['input'] = $email;
1579
+ $md = new Mail_mimeDecode($email);
1580
+ $decoded = $md->decode($params);
1581
  if (empty($decoded->parts))
1582
  $decoded->parts = array(); // have an empty array at minimum, so that it is safe for "foreach"
1583
  return $decoded;
1588
  */
1589
  function DisplayMIMEPartTypes($mimeDecodedEmail) {
1590
  foreach ($mimeDecodedEmail->parts as $part) {
1591
+ EchoInfo($part->ctype_primary . " / " . $part->ctype_secondary . "/ " . $part->headers['content-transfer-encoding']);
1592
  }
1593
  }
1594
 
1598
  * @return boolean
1599
  */
1600
  function CheckEmailAddress($address, $authorized) {
1601
+ $r = false;
1602
+ if (is_array($authorized)) {
1603
+ $a = strtolower(trim($address));
1604
+ if (!empty($a)) {
1605
+ $isAuthorized = in_array(strtolower($a), array_map('strtolower', $authorized));
1606
+ $r = $isAuthorized;
1607
+ }
1608
+ }
1609
+ return $r;
1610
  }
1611
 
1612
  /**
1613
+ * This method works around a problem with email address with extra <> in the email address
1614
  * @param string
1615
  * @return string
1616
  */
1630
  * it just returns the username (everything before @)
1631
  */
1632
  function GetNameFromEmail($address) {
1633
+ $name = "";
1634
  $matches = array();
1635
  if (preg_match('/^([^<>]+)<([^<> ()]+)>$/', $address, $matches)) {
1636
  $name = $matches[1];
1637
  } else if (preg_match('/<([^<>@ ()]+)>/', $address, $matches)) {
1638
  $name = $matches[1];
1639
+ } else if (preg_match('/(.+?)@(.+)/', $address, $matches)) {
1640
+ $name = $matches[1];
1641
  }
1642
 
1643
+ return trim($name);
1644
  }
1645
 
1646
  /**
1759
  } elseif (!preg_match("/$attachment->post_title/i", $fileName)) {
1760
  $template = str_replace('{CAPTION}', $attachment->post_title, $template);
1761
  } else {
1762
+ //$template=str_replace('{CAPTION}', '', $template);
1763
  }
1764
  return($template . '<br />');
1765
  }
1796
  */
1797
  function ReplaceImagePlaceHolders(&$content, $attachments, $config) {
1798
  extract($config);
1799
+ $startIndex = $start_image_count_at_zero ? 0 : 1;
1800
  if (!empty($attachments) && $auto_gallery) {
1801
+ $imageTemplate = '[gallery]';
1802
  if ($images_append) {
1803
+ $content .= $imageTemplate;
1804
  } else {
1805
+ $content = "$imageTemplate\n" . $content;
1806
  }
1807
+ DebugEcho("Auto gallery");
1808
  return;
1809
  }
1810
+
1811
+ $pics = "";
1812
+ $i = 0;
1813
+ foreach ($attachments as $attachementName => $imageTemplate) {
1814
  // looks for ' #img1# ' etc... and replaces with image
1815
  $img_placeholder_temp = str_replace("%", intval($startIndex + $i), $image_placeholder);
1816
  $eimg_placeholder_temp = str_replace("%", intval($startIndex + $i), "#eimg%#");
1817
  $img_placeholder_temp = rtrim($img_placeholder_temp, '#');
1818
  $eimg_placeholder_temp = rtrim($eimg_placeholder_temp, '#');
1819
+
1820
+ if (stristr($content, $img_placeholder_temp) || stristr($content, $eimg_placeholder_temp)) {
1821
  // look for caption
1822
  $caption = '';
1823
  $content = preg_replace("/&#0?39;/", "'", $content);
1824
  $content = preg_replace("/&(#0?34|quot);/", "\"", $content);
1825
+ if (preg_match("/$img_placeholder_temp caption=['\"]?(.*?)['\"]?#/i", $content, $matches)) {
1826
  $caption = $matches[1];
1827
+ DebugEcho("found caption: $caption");
1828
  $img_placeholder_temp = substr($matches[0], 0, -1);
1829
  $eimg_placeholder_temp = substr($matches[0], 0, -1);
1830
+ } else {
1831
+ DebugEcho("No caption found");
1832
  }
1833
+ $imageTemplate = str_replace('{CAPTION}', $caption, $imageTemplate);
1834
  $img_placeholder_temp.='#';
1835
  $eimg_placeholder_temp.='#';
1836
+ $content = str_ireplace($img_placeholder_temp, $imageTemplate, $content);
1837
+ $content = str_ireplace($eimg_placeholder_temp, $imageTemplate, $content);
 
 
1838
  } else {
1839
+ $imageTemplate = str_replace('{CAPTION}', '', $imageTemplate);
1840
  /* if using the gallery shortcode, don't add pictures at all */
1841
  if (!preg_match("/\[gallery[^\[]*\]/", $content, $matches)) {
1842
+ $pics .= $imageTemplate;
1843
  }
1844
  }
1845
+ $i++;
1846
  }
1847
  if ($images_append) {
1848
  $content .= $pics;
1858
  function GetSubject(&$mimeDecodedEmail, &$content, $config) {
1859
  extract($config);
1860
  global $charset;
1861
+ //assign the default title/subject
1862
  if ($mimeDecodedEmail->headers['subject'] == NULL) {
1863
  if ($allow_subject_in_mail) {
1864
+ list($subject, $content) = ParseInMessageSubject($content, $default_title);
 
1865
  } else {
1866
  $subject = $default_title;
1867
  }
1868
  $mimeDecodedEmail->headers['subject'] = $subject;
1869
  } else {
1870
  $subject = $mimeDecodedEmail->headers['subject'];
1871
+ if (array_key_exists('content-transfer-encoding', $mimeDecodedEmail->headers)) {
1872
  $encoding = $mimeDecodedEmail->headers["content-transfer-encoding"];
1873
+ } else if (array_key_exists("content-transfer-encoding", $mimeDecodedEmail->ctype_parameters)) {
1874
  $encoding = $mimeDecodedEmail->ctype_parameters["content-transfer-encoding"];
1875
  } else {
1876
  $encoding = '7bit';
1877
  }
1878
+ if (function_exists('imap_mime_header_decode')) {
1879
  $subject = '';
 
 
1880
  $text = $mimeDecodedEmail->headers['subject'];
1881
+
 
1882
  $elements = imap_mime_header_decode($text);
1883
  for ($i = 0; $i < count($elements); $i++) {
1884
  $thischarset = $elements[$i]->charset;
1885
  if ($thischarset == 'default')
1886
  $thischarset = $charset;
1887
+
 
1888
  $subject.=HandleMessageEncoding($encoding, $thischarset, $elements[$i]->text, $message_encoding, $message_dequote);
 
1889
  }
 
 
 
 
 
1890
  }
1891
  if (!$allow_html_in_subject) {
1892
+ $subject = htmlentities($subject, ENT_COMPAT | ENT_HTML401, $message_encoding);
1893
  }
1894
  }
1895
+ //This is for ISO-2022-JP - Can anyone confirm that this is still neeeded?
1896
+ // escape sequence is 'ESC $ B' == 1b 24 42 hex.
1897
  if (strpos($subject, "\x1b\x24\x42") !== false) {
1898
+ // found iso-2022-jp escape sequence in subject... convert!
1899
  $subject = iconv("ISO-2022-JP//TRANSLIT", "UTF-8", $subject);
1900
  }
1901
  return($subject);
1907
  */
1908
  function postie_get_tags(&$content, $defaultTags) {
1909
  $post_tags = array();
1910
+ //try and determine tags
1911
  if (preg_match('/tags: ?(.*)\n/i', $content, $matches)) {
1912
  $content = str_replace($matches[0], "", $content);
1913
  $post_tags = preg_split("/,\s*/", $matches[1]);
1923
  *
1924
  */
1925
  function GetPostExcerpt(&$content, $filterNewLines, $convertNewLines) {
 
1926
  $post_excerpt = '';
1927
  if (preg_match('/:excerptstart ?(.*):excerptend/s', $content, $matches)) {
1928
  $content = str_replace($matches[0], "", $content);
1930
  if ($filterNewLines)
1931
  $post_excerpt = FilterNewLines($post_excerpt, $convertNewLines);
1932
  }
1933
+ return $post_excerpt;
1934
  }
1935
 
1936
  /**
1956
  foreach ($matches[1] as $match) {
1957
  $match = trim($match);
1958
  $category = NULL;
1959
+ //EchoInfo("Categories - Working on $match");
1960
 
1961
  $sql_name = 'SELECT term_id
1962
  FROM ' . $wpdb->terms . '
1983
  if (!count($post_categories)) {
1984
  $post_categories[] = $defaultCategory;
1985
  }
1986
+ return $post_categories;
1987
  }
1988
 
1989
  /**
1990
  * This function just outputs a simple html report about what is being posted in
1991
  */
1992
  function DisplayEmailPost($details) {
1993
+ DebugDump($details);
1994
+
 
 
1995
  $theFinalContent = $details['post_content'];
1996
  // Report
1997
+ EchoInfo('<b>Post Author</b>: ' . $details["post_author"]);
1998
+ EchoInfo('<b>Date</b>: ' . $details["post_date"]);
1999
  foreach ($details["post_category"] as $category) {
2000
+ EchoInfo('<b>Category</b>: ' . $category);
2001
  }
2002
+ EchoInfo('<b>Ping Status</b>: ' . $details["ping_status"]);
2003
+ EchoInfo('<b>Comment Status</b>: ' . $details["comment_status"]);
2004
+ EchoInfo('<b>Subject</b>: ' . $details["post_title"]);
2005
+ EchoInfo('<b>Postname</b>: ' . $details["post_name"]);
2006
+ EchoInfo('<b>Post Id</b>: ' . $details["ID"]);
2007
+ EchoInfo('<b>Post Type</b>: ' . $details["post_type"]); /* Added by Raam Dev <raam@raamdev.com> */
2008
+ EchoInfo('<b>Posted content:</b>');
2009
+ EchoInfo($details["post_content"]);
 
2010
  }
2011
 
2012
  /**
2017
  * @param string
2018
  */
2019
  function BuildBooleanSelect($label, $id, $current_value, $recommendation = NULL) {
2020
+ $html = "<tr>
2021
+ <th scope='row'>" . $label . ":</th>
2022
+ <td><select name='$id' id='$id'>
2023
+ <option value='1'>" . __("Yes", 'postie') . "</option>
2024
+ <option value='0' " . (!$current_value ? "selected='selected'" : "") . ">" . __("No", 'postie') . '</option>
2025
+ </select>';
2026
+ if (!empty($recommendation)) {
2027
+ $html.='<span class = "recommendation">' . $recommendation . '</span>';
 
2028
  }
2029
+ $html.="</td>\n</tr>";
2030
+ return $html;
2031
  }
2032
 
2033
  /**
2038
  * @param string
2039
  */
2040
  function BuildTextArea($label, $id, $current_value, $recommendation = NULL) {
2041
+ $html = "<tr> <th scope='row'>" . $label . ":";
2042
  if ($recommendation) {
2043
+ $html.="<br /><span class='recommendation'>" . $recommendation . "</span>";
2044
  }
2045
+ $html.="</th>";
2046
 
2047
+ $html .="<td><textarea cols=40 rows=3 name='$id' id='$id'>";
2048
  $current_value = preg_split("/[,\r\n]+/", trim($current_value));
2049
  if (is_array($current_value)) {
2050
  foreach ($current_value as $item) {
2051
+ $html .= "$item\n";
2052
  }
2053
  }
2054
+ $html .= "</textarea></td></tr>";
2055
+ return $html;
 
2056
  }
2057
 
2058
  /**
2075
  */
2076
  function UpdatePostieConfig($data) {
2077
  UpdatePostiePermissions($data["role_access"]);
2078
+ // We also update the cron settings
2079
  if ($data['interval'] != '') {
2080
  postie_decron();
2081
  if ($data['interval'] != 'manual') {
2141
  'selected_video1template' => 'simple_link',
2142
  'selected_video2template' => 'simple_link',
2143
  'shortcode' => false,
2144
+ 'sig_pattern_list' => array('--', '---'),
2145
  'smtp' => array(),
2146
  'start_image_count_at_zero' => false,
2147
  'supported_file_types' => array('video', 'application'),
2153
  'video2types' => array('x-flv'),
2154
  'video1templates' => $video1Templates,
2155
  'video2templates' => $video2Templates,
2156
+ 'wrap_pre' => 'no
2157
+
2158
+ '
2159
  );
2160
  }
2161
 
2177
  function ReadDBConfig() {
2178
  $config = array();
2179
  global $wpdb;
2180
+ $wpdb->query("SHOW TABLES LIKE '
2181
+
2182
+ " . $GLOBALS["table_prefix"] . "postie_config'");
2183
+ if ($wpdb->num_rows > 0) {
2184
+ $data = $wpdb->get_results("SELECT label,value FROM " . $GLOBALS["table_prefix"] . "postie_config;");
2185
+ if (is_array($data)) {
2186
+ foreach ($data as $row) {
2187
+ if (in_array($row->label, GetListOfArrayConfig())) {
2188
+ $config[$row->label] = unserialize($row->value);
2189
+ } else {
2190
+ $config[$row->label] = $row->value;
2191
+ }
2192
  }
2193
  }
2194
  }
2195
+ return $config;
2196
  }
2197
 
2198
  /**
2207
  if (!isset($config["PREFER_TEXT_TYPE"]))
2208
  $config["PREFER_TEXT_TYPE"] = "plain";
2209
  if (!isset($config["DEFAULT_TITLE"]))
2210
+ $config["DEFAULT_TITLE"] = "Live Fro
2211
+ m The Field";
2212
  if (!isset($config["INPUT_PROTOCOL"]))
2213
+ $config["INPUT_PROTOCOL"]
2214
+ = "pop3";
2215
  if (!isset($config["IMAGE_PLACEHOLDER"]))
2216
+ $config["IMAGE_PLACEHOLDER"] = "#img%
2217
+ #";
2218
  if (!isset($config["IMAGES_APPEND"]))
2219
  $config["IMAGES_APPEND"] = true;
2220
+
2221
  if (!isset($config["ALLOW_SUBJECT_IN_MAIL"]))
2222
  $config["ALLOW_SUBJECT_IN_MAIL"] = true;
2223
  if (!isset($config["DROP_SIGNATURE"]))
2224
  $config["DROP_SIGNATURE"] = true;
2225
  if (!isset($config["MESSAGE_START"]))
2226
  $config["MESSAGE_START"] = ":start";
2227
+
2228
  if (!isset($config["MESSAGE_END"]))
2229
  $config["MESSAGE_END"] = ":end";
2230
+ if
2231
+ (!isset($config["FORWARD_REJECTED_MAIL"]))
2232
  $config["FORWARD_REJECTED_MAIL"] = true;
2233
  if (!isset($config["RETURN_TO_SENDER"]))
2234
  $config["RETURN_TO_SENDER"] = false;
2244
  $config["MESSAGE_ENCODING"] = "UTF-8";
2245
  if (!isset($config["MESSAGE_DEQUOTE"]))
2246
  $config["MESSAGE_DEQUOTE"] = true;
2247
+
2248
  if (!isset($config["TURN_AUTHORIZATION_OFF"]))
2249
  $config["TURN_AUTHORIZATION_OFF"] = false;
2250
  if (!isset($config["CUSTOM_IMAGE_FIELD"]))
2251
+ $config["CUSTOM_IMAGE_
2252
+ FIELD"] = false;
2253
  if (!isset($config["CONVERTNEWLINE"]))
2254
  $config["CONVERTNEWLINE"] = false;
2255
  if (!isset($config["SIG_PATTERN_LIST"]))
2256
+ $config["SIG_PATTERN_LIST"] = array('--', '---');
2257
  if (!isset($config["BANNED_FILES_LIST"]))
2258
  $config["BANNED_FILES_LIST"] = array();
2259
  if (!isset($config["SUPPORTED_FILE_TYPES"]))
2260
+ $config["SUPPORTED_FILE_TYPES"] = array("video", "applicatio
2261
+ n");
2262
  if (!isset($config["AUTHORIZED_ADDRESSES"]))
2263
  $config["AUTHORIZED_ADDRESSES"] = array();
2264
  if (!isset($config["MAIL_SERVER"]))
2265
  $config["MAIL_SERVER"] = NULL;
2266
+ if (!isset($config["MAIL_SERVER
2267
+ _PORT"]))
2268
  $config["MAIL_SERVER_PORT"] = NULL;
2269
+ if (!isset($config["MAIL_USERID"]
2270
+ ))
2271
  $config["MAIL_USERID"] = NULL;
2272
  if (!isset($config["MAIL_PASSWORD"]))
2273
  $config["MAIL_PASSWORD"] = NULL;
2274
+ if (!isset($config["DEFAULT_POST_CATEGO
2275
+ RY"]))
2276
  $config["DEFAULT_POST_CATEGORY"] = NULL;
2277
+ if (!isset($config["D
2278
+ EFAULT_POST_TAGS"]))
2279
  $config["DEFAULT_POST_TAGS"] = NULL;
2280
+ if (!isset($config["T
2281
+ IME_OFFSET"]))
2282
  $config["TIME_OFFSET"] = get_option('gmt_offset');
2283
  if (!isset($config["WRAP_PRE"]))
2284
  $config["WRAP_PRE"] = 'no';
2285
+ if (!isset($config["CONVERTUR
2286
+ LS"]))
2287
  $config["CONVERTURLS"] = true;
2288
  if (!isset($config["SHORTCODE"]))
2289
  $config["SHORTCODE"] = false;
2290
  if (!isset($config["ADD_META"]))
2291
  $config["ADD_META"] = 'no';
2292
+ $config['ICON_SETS'] = array('silver', 'black', 'w
2293
+ hite', 'custom', 'none');
2294
  if (!isset($config["ICON_SET"]))
2295
  $config["ICON_SET"] = 'silver';
2296
  $config['ICON_SIZES'] = array(32, 48, 64);
2297
  if (!isset($config["ICON_SIZE"]))
2298
  $config["ICON_SIZE"] = 32;
2299
+
2300
+
2301
+ //audio
2302
+ include('templates/audio_templates.php');
2303
  if (!isset($config["SELECTED_AUDIOTEMPLATE"]))
2304
  $config['SELECTED_AUDIOTEMPLATE'] = 'simple_link';
 
2305
  $config['AUDIOTEMPLATES'] = $audioTemplates;
2306
  if (!isset($config["SELECTED_VIDEO1TEMPLATE"]))
2307
  $config['SELECTED_VIDEO1TEMPLATE'] = 'simple_link';
2308
+ if (!isset($config["AUDIOTEMPLATE"]))
2309
+ $config["AUDIOTEMPLATE"] = $simple_link;
2310
+
2311
+ //video1
2312
+
2313
  if (!isset($config["VIDEO1TYPES"]))
2314
+ $config['VIDEO1TYPES'] = array('mp4', 'mpeg4', '3gp',
2315
+ '3gpp', '3gpp2',
2316
  '3gp2', 'mov', 'mpeg');
2317
  if (!isset($config["AUDIOTYPES"]))
2318
  $config['AUDIOTYPES'] = array('m4a', 'mp3', 'ogg', 'wav', 'mpeg');
2319
  if (!isset($config["SELECTED_VIDEO2TEMPLATE"]))
2320
  $config['SELECTED_VIDEO2TEMPLATE'] = 'simple_link';
2321
+ include('templates/video1_templates.php');
2322
+ $config['VIDEO1TEMPLATES'] = $video1Templates;
2323
+ if
2324
+ (!isset($config["VIDEO1TEMPLATE"]))
2325
+ $config["VIDEO1TEMPLATE"] = $simple_link;
2326
+
2327
+ //video2
2328
  if (!isset($config["VIDEO2TYPES"]))
2329
  $config['VIDEO2TYPES'] = array('x-flv');
2330
  if (!isset($config["POST_STATUS"]))
2331
  $config["POST_STATUS"] = 'publish';
2332
+ if (!isset($config["IMAGE_NE
2333
+ W_WINDOW"]))
2334
  $config["IMAGE_NEW_WINDOW"] = false;
2335
+ if (!isset($config["FILTERN
2336
+ EWLINES"]))
2337
  $config["FILTERNEWLINES"] = true;
2338
+ include('templates/video2_templ
2339
+ ates.php');
2340
+ $config['VIDEO2TEMPLATES'] = $video2Templates;
2341
+ if (!isset($config["V
2342
+ IDEO2TEMPLATE"]))
2343
+ $config["VIDEO2TEMPLATE"] = $simple_link;
2344
+
2345
+ //image
2346
  if (!isset($config["SELECTED_IMAGETEMPLATE"]))
2347
+ $config['SELECTED_IMAGETEMPLATE'] = 'wordpr
2348
+ ess_default';
 
2349
  if (!isset($config["SMTP"]))
2350
  $config["SMTP"] = array();
2351
+ include('templates/image_tem
2352
+ plates.php');
2353
+ if (!isset($config["IMAGETEMPLATE"]))
2354
+ $config["IMAGETEMPLATE"] = $wordpress_default;
2355
+ $config['IMAGETEMPLATES'] = $imageTemplates;
2356
+
2357
  return($config);
2358
  }
2359
 
2360
  /**
2361
+ * This function returns the old
2362
+ -format config (pre 1.4)
2363
  * @return array
2364
  */
2365
  function GetConfig() {
2366
  $config = GetDBConfig();
2367
+ //These should only be modified if you are testing
2368
  $config["DELETE_MAIL_AFTER_PROCESSING"] = true;
2369
  $config["POST_TO_DB"] = true;
2370
  $config["TEST_EMAIL"] = false;
2373
  if (file_exists(POSTIE_ROOT . '/postie_test_variables.php')) {
2374
  include(POSTIE_ROOT . '/postie_test_variables.php');
2375
  }
2376
+ //include(POSTIE_ROOT . "/../postie-test.php");
2377
+ // These are computed
2378
  $config["TIME_OFFSET"] = get_option('gmt_offset');
2379
  $config["POSTIE_ROOT"] = POSTIE_ROOT;
2380
  for ($i = 0; $i < count($config["AUTHORIZED_ADDRESSES"]); $i++) {
2384
  }
2385
 
2386
  /**
2387
+ * end of functions u sed to retrieve the old (pre 1.4) config
2388
  * =======================================================
2389
  */
2390
 
2397
  if (file_exists(POSTIE_ROOT . '/postie_test_variables.php')) {
2398
  include(POSTIE_ROOT . '/postie_test_variables.php');
2399
  }
2400
+ // These are computed
2401
  $config["time_offset"] = get_option('gmt_offset');
2402
  $config["postie_root"] = POSTIE_ROOT;
2403
  return $config;
2409
  */
2410
  function get_arrayed_settings() {
2411
  return array(
2412
+ ', ' => array('audiotypes', 'video1types', 'video2types', 'default_post_tags'),
2413
  "\n" => array('smtp', 'authorized_addresses', 'supported_file_types',
2414
  'banned_files_list', 'sig_pattern_list'));
2415
  }
2441
  foreach ($function_list as $function) {
2442
  if (!function_exists($function)) {
2443
  if ($display) {
2444
+ EchoInfo("Missing $function");
2445
  }
2446
+ return false;
2447
  }
2448
  }
2449
+ return true;
2450
  }
2451
 
2452
  /**
2468
  if (in_array("markdown.php", get_option("active_plugins"))) {
2469
  return(true);
2470
  }
2471
+ return false;
2472
  }
2473
 
2474
  /**
2476
  * and ensures that arrayed items are stored as such
2477
  */
2478
  function postie_validate_settings($in) {
2479
+ //DebugDump($in);
 
2480
  $out = array();
2481
 
2482
+ // use the default as a template:
2483
+ // if a field is present in the defaults, we want to store it; otherwise we discard it
2484
  $allowed_keys = get_postie_config_defaults();
2485
  foreach ($allowed_keys as $key => $default)
2486
  $out[$key] = array_key_exists($key, $in) ? $in[$key] : $default;
2487
 
2488
+ // some fields are always forced to lower case:
2489
+ $lowercase = array('authorized_add
2490
+ resses', 'smtp', 'supported_file_types', 'video1types', 'video2types', 'audiotypes');
2491
  foreach ($lowercase as $field) {
2492
+ $out[$field] = ( is_array($out[$field]) ) ? array_map("strtolower", $out[$field]) : strtolower($out[$field]);
2493
  }
2494
  $arrays = get_arrayed_settings();
2495
 
2499
  $out[$field] = explode($sep, trim($out[$field]));
2500
  foreach ($out[$field] as $key => $val) {
2501
  $tst = trim($val);
2502
+ if
2503
+ (empty($tst)) {
2504
  unset($out[$field][$key]);
2505
  } else {
2506
  $out[$field][$key] = $tst;
2528
  $admin = $wp_roles->get_role("administrator");
2529
  $admin->add_cap("config_postie");
2530
  $admin->add_cap("post_via_postie");
2531
+
2532
  if (!is_array($role_access)) {
2533
  $role_access = array();
2534
  }
2535
  foreach ($wp_roles->role_names as $roleId => $name) {
2536
  $role = &$wp_roles->get_role($roleId);
2537
  if ($roleId != "administrator") {
2538
+ if (array_key_exists($roleId, $role_access)) {
2539
  $role->add_cap("post_via_postie");
2540
+ //DebugEcho("added $roleId");
2541
  } else {
2542
  $role->remove_cap("post_via_postie");
2543
+ //DebugEcho("removed $roleId");
2544
  }
2545
  }
2546
  }
2547
  }
2548
 
2549
+ function IsDebugMode() {
2550
+ return (defined('POSTIE_DEBUG') && POSTIE_DEBUG == true);
2551
+ }
2552
+
2553
+ function SafeFileName($filename) {
2554
+ return str_replace(array('\\', '/', ':', '*', '?', '"', '<', '>', '|'), array('', '', '', '', '', '', '', '', ''), $filename);
2555
+ }
2556
+
2557
  function DebugEmailOutput(&$email, &$mimeDecodedEmail) {
2558
+ if (IsDebugMode()) {
2559
+ $fname = POSTIE_ROOT . DIRECTORY_SEPARATOR . "test_emails" . DIRECTORY_SEPARATOR . SafeFileName($mimeDecodedEmail->headers["message-id"]);
2560
+ $file = fopen($fname . ".txt ", "w");
2561
+ fwrite($file, $email);
2562
+ fclose($file);
2563
+
2564
+ $file = fopen($fname . "-mime.txt ", "w");
2565
+ fwrite($file, print_r($mimeDecodedEmail, true));
2566
+ fclose($file);
2567
+
2568
+ $file = fopen($fname . ".php ", "w");
2569
+ fwrite($file, serialize($email));
2570
+ fclose($file);
2571
+ }
2572
  }
2573
 
2574
  /**
2590
  if ($drop_signature) {
2591
  $content = remove_signature($content, $sig_pattern_list);
2592
  }
2593
+ if ($prefer_text_type == "html" && count($attachments["cids"])) {
 
2594
  ReplaceImageCIDs($content, $attachments);
2595
  }
2596
  if (!$custom_image_field) {
2598
  } else {
2599
  $customImages = array();
2600
  foreach ($attachments["html"] as $value) {
2601
+ preg_match("/src = ['\"]([^'\"]*)['\"]/", $value, $matches);
2602
  array_push($customImages, $matches[1]);
2603
  }
2604
 
2605
+ return $customImages;
2606
  }
2607
+ return NULL;
2608
  }
2609
 
2610
  /**
2618
  //The content is now just the text of the message
2619
  $content = $matches[1];
2620
  //Now to clean up the attachments
2621
+ $vodafone_images = array("live.gif"
2622
+ , "smiley.gif", "border_left_txt.gif", "border_top.gif",
2623
+ "border_bot.gif", "border_right.gif", "banner1.gif", "i_text.gif", "i_picture.gif",);
2624
  while (list($key, $value) = each($attachments['cids'])) {
2625
  if (!in_array($key, $vodafone_images)) {
2626
  $content .= "<br/>" . $attachments['html'][$attachments['cids'][$key][1]];
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.5
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 625416 2012-11-14 22:18:55Z WayneAllen $
31
  * -= Requests Pending =-
32
  * German Umlats don't work
33
  * Problems under PHP5
@@ -52,17 +52,17 @@
52
  * www.cdavies.org/permalink/watchingbrowserembeddedgpvideosinlinux.php
53
  * Support private posts
54
  * Make it possible to post without a script at all
 
 
 
 
55
  */
56
 
57
- //Older Version History is in the HISTORY file
58
- //error_reporting(E_ALL & ~E_NOTICE);
59
- //ini_set("display_errors", 1);
60
-
61
  define("POSTIE_ROOT", dirname(__FILE__));
62
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
63
 
64
  function postie_loadjs_add_page() {
65
- $postiepage = add_options_page('Postie', 'Postie', 8, POSTIE_ROOT . '/postie.php', 'postie_loadjs_options_page');
66
  add_action("admin_print_scripts-$postiepage", 'postie_loadjs_admin_head');
67
  }
68
 
@@ -71,7 +71,7 @@ function postie_loadjs_options_page() {
71
  }
72
 
73
  function postie_loadjs_admin_head() {
74
- $plugindir = get_settings('siteurl') . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__));
75
  wp_enqueue_script('loadjs', $plugindir . '/js/simpleTabs.jquery.js');
76
  echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/postie/css/style.css" />' . "\n";
77
  echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/postie/css/simpleTabs.css" />' . "\n";
@@ -88,10 +88,10 @@ if (isset($_GET["postie_read_me"])) {
88
  //Add Menu Configuration
89
  if (is_admin()) {
90
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
91
- //add_action("admin_menu","PostieMenu");
92
  add_action('admin_init', 'postie_admin_settings');
93
  add_action('admin_menu', 'postie_loadjs_add_page');
94
  if (function_exists('load_plugin_textdomain')) {
 
95
  function postie_load_domain() {
96
  $plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
97
  load_plugin_textdomain('postie', $plugin_dir . "/languages/", basename(dirname(__FILE__)) . '/languages/');
@@ -103,25 +103,21 @@ if (is_admin()) {
103
  }
104
 
105
  function activate_postie() {
 
 
106
  static $init = false;
107
  $options = get_option('postie-settings');
108
 
109
- if ($init)
110
  return;
 
111
 
112
  if (!$options) {
113
  $options = array();
114
  }
115
  $default_options = get_postie_config_defaults();
116
  $old_config = array();
117
- $updated = false;
118
- $migration = false;
119
-
120
- /*
121
- global $wpdb;
122
- $GLOBALS["table_prefix"]. "postie_config";
123
- $result = $wpdb->get_results("SELECT label,value FROM $postietable ;");
124
- */
125
  $result = GetConfig();
126
  if (is_array($result)) {
127
  foreach ($result as $key => $val) {
@@ -135,7 +131,7 @@ function activate_postie() {
135
  $options = postie_validate_settings($options);
136
  update_option('postie-settings', $options);
137
  $init = true;
138
- // $wpdb->query("DROP TABLE IF EXISTS $postietable"); // safely updated options, so we can remove the old table
139
  return $options;
140
  }
141
 
@@ -156,10 +152,9 @@ function postie_warnings() {
156
  ) && !isset($_POST['submit'])) {
157
 
158
  function postie_enter_info() {
159
- echo "
160
- <div id='postie-info-warning' class='updated fade'><p><strong>" .
161
- __('Postie is almost ready.', 'postie') . "</strong> "
162
- . sprintf(__('You must <a href="%1$s">enter your email settings</a> for it to work.', 'postie'), "options-general.php?page=postie/postie.php") . "</p></div> ";
163
  }
164
 
165
  add_action('admin_notices', 'postie_enter_info');
@@ -196,7 +191,7 @@ add_filter('whitelist_options', 'postie_whitelist');
196
 
197
  function check_postie() {
198
  $host = get_option('siteurl');
199
- preg_match("/https?:\/\/(.[^\/]*)(.*)/", $host, $matches);
200
  $host = $matches[1];
201
  $url = "";
202
  if (isset($matches[2])) {
@@ -216,10 +211,7 @@ function check_postie() {
216
  }
217
  fclose($fp);
218
  } else {
219
- echo "Cannot connect to server on port $port. Please check to make sure
220
- that this port is open on your webhost.
221
- Additional information:
222
- $errno: $errstr";
223
  }
224
  }
225
 
@@ -243,12 +235,12 @@ function postie_decron() {
243
 
244
  /* here we add some more options for how often to check for e-mail */
245
 
246
- function more_reccurences() {
247
- return array(
248
- 'weekly' => array('interval' => 604800, 'display' => 'Once Weekly'),
249
- 'twiceperhour' => array('interval' => 1800, 'display' => 'Twice per hour '),
250
- 'tenminutes' => array('interval' => 600, 'display' => 'Every 10 minutes')
251
- );
252
  }
253
 
254
  add_filter('cron_schedules', 'more_reccurences');
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.6
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 635157 2012-12-06 23:55:51Z WayneAllen $
31
  * -= Requests Pending =-
32
  * German Umlats don't work
33
  * Problems under PHP5
52
  * www.cdavies.org/permalink/watchingbrowserembeddedgpvideosinlinux.php
53
  * Support private posts
54
  * Make it possible to post without a script at all
55
+ * * TODO - fix corruption of rtf attachments
56
+ * TODO - add port checking in tests
57
+ * TODO - non-image uploads get ignored in content when using autogallery - see
58
+ replaceimageplaceholders
59
  */
60
 
 
 
 
 
61
  define("POSTIE_ROOT", dirname(__FILE__));
62
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
63
 
64
  function postie_loadjs_add_page() {
65
+ $postiepage = add_options_page('Postie', 'Postie', 'manage_options', POSTIE_ROOT . '/postie.php', 'postie_loadjs_options_page');
66
  add_action("admin_print_scripts-$postiepage", 'postie_loadjs_admin_head');
67
  }
68
 
71
  }
72
 
73
  function postie_loadjs_admin_head() {
74
+ $plugindir = get_option('siteurl') . '/wp-content/plugins/' . dirname(plugin_basename(__FILE__));
75
  wp_enqueue_script('loadjs', $plugindir . '/js/simpleTabs.jquery.js');
76
  echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/postie/css/style.css" />' . "\n";
77
  echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/postie/css/simpleTabs.css" />' . "\n";
88
  //Add Menu Configuration
89
  if (is_admin()) {
90
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
 
91
  add_action('admin_init', 'postie_admin_settings');
92
  add_action('admin_menu', 'postie_loadjs_add_page');
93
  if (function_exists('load_plugin_textdomain')) {
94
+
95
  function postie_load_domain() {
96
  $plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
97
  load_plugin_textdomain('postie', $plugin_dir . "/languages/", basename(dirname(__FILE__)) . '/languages/');
103
  }
104
 
105
  function activate_postie() {
106
+ LogInfo("activiated");
107
+
108
  static $init = false;
109
  $options = get_option('postie-settings');
110
 
111
+ if ($init) {
112
  return;
113
+ }
114
 
115
  if (!$options) {
116
  $options = array();
117
  }
118
  $default_options = get_postie_config_defaults();
119
  $old_config = array();
120
+
 
 
 
 
 
 
 
121
  $result = GetConfig();
122
  if (is_array($result)) {
123
  foreach ($result as $key => $val) {
131
  $options = postie_validate_settings($options);
132
  update_option('postie-settings', $options);
133
  $init = true;
134
+ DebugEcho("activate completed");
135
  return $options;
136
  }
137
 
152
  ) && !isset($_POST['submit'])) {
153
 
154
  function postie_enter_info() {
155
+ echo "<div id='postie-info-warning' class='updated fade'><p><strong>" . __('Postie is almost ready.', 'postie') . "</strong> "
156
+ . sprintf(__('You must <a href="%1$s">enter your email settings</a> for it to work.', 'postie'), "options-general.php?page=postie/postie.php")
157
+ . "</p></div> ";
 
158
  }
159
 
160
  add_action('admin_notices', 'postie_enter_info');
191
 
192
  function check_postie() {
193
  $host = get_option('siteurl');
194
+ preg_match("/https?:\/\/(.[^\/]*)(.*)/i", $host, $matches);
195
  $host = $matches[1];
196
  $url = "";
197
  if (isset($matches[2])) {
211
  }
212
  fclose($fp);
213
  } else {
214
+ EchoInfo("Cannot connect to server on port $port. Please check to make sure that this port is open on your webhost. Additional information: $errno: $errstr");
 
 
 
215
  }
216
  }
217
 
235
 
236
  /* here we add some more options for how often to check for e-mail */
237
 
238
+ function more_reccurences($schedules) {
239
+ $schedules['postie-weekly'] = array('interval' => 60 * 60 * 24 * 7, 'display' => __('Once Weekly'));
240
+ $schedules['postie-twiceperhour'] = array('interval' => 60 * 30, 'display' => __('Twice per hour '));
241
+ $schedules['postie-tenminutes'] = array('interval' => 60 * 10, 'display' => __('Every 10 minutes'));
242
+
243
+ return $schedules;
244
  }
245
 
246
  add_filter('cron_schedules', 'more_reccurences');
postieIMAP.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * @author Dirk Elmendorf
4
  * @style Compliant
@@ -8,7 +9,7 @@
8
  */
9
 
10
  /**
11
- * This class handles the details of an IMAP connection
12
  *
13
  * @author Dirk Elmendorf
14
  * @package Postie
@@ -23,123 +24,147 @@ class PostieIMAP {
23
  var $_connection;
24
  var $_server_string;
25
 
26
- function PostieIMAP($protocol = "imap",$ssl_on = false,$self_cert = true) {
27
  $this->_connected = false;
28
  $this->_tls_on = false;
29
  $this->_protocol = strtolower($protocol);
30
  $this->_ssl = $ssl_on;
31
  $this->_self_cert = $self_cert;
32
  }
 
33
  /**
34
- *call this to turn on TLS
35
- */
36
  function TLSOn() {
37
  $this->_tls_on = true;
38
  }
39
- /**
40
- * call this if you want to verify the cert
41
- */
 
42
  function RealCert() {
43
  $this->self_cert = false;
44
  }
 
45
  /**
46
- * Shows if the object is actually connected
47
- *@return boolean
48
- */
49
  function isConnected() {
50
  return($this->_connected);
51
  }
 
52
  /**
53
- *Opens a connection to the server
54
- *@return boolean
55
- */
56
- function connect($server,$port,$login,$password) {
57
- $option = "/service=".$this->_protocol;
58
-
59
  if ($this->_ssl) {
60
  $option .= "/ssl";
61
  }
62
  if ($this->_tls_on) {
63
  $option .= "/tls";
64
- }
65
- else {
66
  $option .= "/notls";
67
  }
68
  if ($this->_self_cert) {
69
  $option .= "/novalidate-cert";
70
  }
71
- if (eregi("google",$server)) {
72
  //Fix from Jim Hodgson http://www.jimhodgson.com/2006/07/19/postie/
73
- $this->_server_string = "{".$server.":".$port.$option."}INBOX";
74
- }
75
- else {
76
- $this->_server_string = "{".$server.":".$port.$option."}";
 
 
77
  }
78
- $this->_connection = imap_open($this->_server_string,$login,$password);
79
 
80
  if ($this->_connection) {
81
  $this->_connected = true;
82
  }
83
- return($this->_connected);
84
  }
 
85
  /**
86
- * Returns a count of the number of messages
87
- * @return integer
88
- */
89
  function getNumberOfMessages() {
90
- //$status= imap_status($this->_connection,$this->_server_string, SA_UNSEEN);
91
- return(imap_num_msg($this->_connection));
92
- //return($status->unseen);
 
 
 
 
 
93
  }
 
94
  /**
95
- * Gets the raw email message from the server
96
- * @return string
97
- */
98
- function fetchEmail($index){
99
  if ($index < 1 || $index > ($this->getNumberOfMessages() + 1)) {
100
  die("Invalid IMAP/POP3 message index!");
101
  }
102
  $header_info = imap_headerinfo($this->_connection, $index);
103
- if ($header_info->Recent=='N' || $header_info->Unseen=='U') {
104
- $email = imap_fetchheader($this->_connection,$index);
105
- $email .= imap_body($this->_connection,$index);
106
- return($email);
 
 
 
 
 
 
107
  } else {
108
- return('already read');
109
  }
 
110
  }
 
111
  /**
112
- * Marks a message for deletion
113
- */
114
- function deleteMessage($index){
115
- imap_delete($this->_connection,$index);
116
  }
 
117
  /**
118
- * Handles purging any files that are marked for deletion
119
- */
120
- function expungeMessages(){
121
- imap_expunge($this->_connection);
122
  }
 
123
  /**
124
- * Handles disconnecting from the server
125
- */
126
- function disconnect(){
127
  imap_close($this->_connection);
128
  $this->_connection = false;
129
  }
 
130
  /**
131
- *@return string
132
- */
133
  function error() {
134
  return(imap_last_error());
135
  }
 
136
  /**
137
- * Handles returning the right kind of object
138
- * @return PostieIMAP|PostieIMAPSSL|PostimePOP3SSL
139
- * @static
140
- */
141
  function &Factory($protocol) {
142
- switch(strtolower($protocol)) {
143
  case "imap":
144
  $object = &new PostieIMAP();
145
  break;
@@ -154,31 +179,35 @@ class PostieIMAP {
154
  }
155
  return($object);
156
  }
 
157
  }
158
 
159
  /**
160
- * This class handles the details of an IMAP-SSL connection
161
  *
162
  * @author Dirk Elmendorf
163
  * @package Postie
164
  */
165
- class PostieIMAPSSL Extends PostieIMAP{
166
 
167
- function PostieIMAPSSL($protocol = "imap",$ssl_on = true,$self_cert = true) {
168
- PostieIMAP::PostieIMAP($protocol,$ssl_on,$self_cert);
169
  }
 
170
  }
171
 
172
  /**
173
- * This class handles the details of an POP3-SSL connection
174
  *
175
  * @author Dirk Elmendorf
176
  * @package Postie
177
  */
178
  class PostiePOP3SSL Extends PostieIMAP {
179
 
180
- function PostiePOP3SSL($protocol = "pop3",$ssl_on = true,$self_cert = true) {
181
- PostieIMAP::PostieIMAP($protocol,$ssl_on,$self_cert);
182
  }
 
183
  }
 
184
  ?>
1
  <?php
2
+
3
  /**
4
  * @author Dirk Elmendorf
5
  * @style Compliant
9
  */
10
 
11
  /**
12
+ * This class handles the details of an IMAP connection
13
  *
14
  * @author Dirk Elmendorf
15
  * @package Postie
24
  var $_connection;
25
  var $_server_string;
26
 
27
+ function PostieIMAP($protocol = "imap", $ssl_on = false, $self_cert = true) {
28
  $this->_connected = false;
29
  $this->_tls_on = false;
30
  $this->_protocol = strtolower($protocol);
31
  $this->_ssl = $ssl_on;
32
  $this->_self_cert = $self_cert;
33
  }
34
+
35
  /**
36
+ * call this to turn on TLS
37
+ */
38
  function TLSOn() {
39
  $this->_tls_on = true;
40
  }
41
+
42
+ /**
43
+ * call this if you want to verify the cert
44
+ */
45
  function RealCert() {
46
  $this->self_cert = false;
47
  }
48
+
49
  /**
50
+ * Shows if the object is actually connected
51
+ * @return boolean
52
+ */
53
  function isConnected() {
54
  return($this->_connected);
55
  }
56
+
57
  /**
58
+ * Opens a connection to the server
59
+ * @return boolean
60
+ */
61
+ function connect($server, $port, $login, $password) {
62
+ $option = "/service=" . $this->_protocol;
63
+
64
  if ($this->_ssl) {
65
  $option .= "/ssl";
66
  }
67
  if ($this->_tls_on) {
68
  $option .= "/tls";
69
+ } else {
 
70
  $option .= "/notls";
71
  }
72
  if ($this->_self_cert) {
73
  $option .= "/novalidate-cert";
74
  }
75
+ if (preg_match("/google|gmail/i", $server)) {
76
  //Fix from Jim Hodgson http://www.jimhodgson.com/2006/07/19/postie/
77
+ $this->_server_string = "{" . $server . ":" . $port . $option . "}INBOX";
78
+ // if (IsDebugMode()) {
79
+ // $this->_server_string = "{" . $server . ":" . $port . $option . "}[Gmail]/All Mail";
80
+ // }
81
+ } else {
82
+ $this->_server_string = "{" . $server . ":" . $port . $option . "}";
83
  }
84
+ $this->_connection = imap_open($this->_server_string, $login, $password);
85
 
86
  if ($this->_connection) {
87
  $this->_connected = true;
88
  }
89
+ return $this->_connected;
90
  }
91
+
92
  /**
93
+ * Returns a count of the number of messages
94
+ * @return integer
95
+ */
96
  function getNumberOfMessages() {
97
+ if (IsDebugMode()) {
98
+ $status = imap_status($this->_connection, $this->_server_string, SA_ALL); //get all messages in debug mode so we can reprocess them
99
+ //DebugEcho($this->_server_string);
100
+ //DebugDump($status);
101
+ return $status->unseen;
102
+ } else {
103
+ return imap_num_msg($this->_connection);
104
+ }
105
  }
106
+
107
  /**
108
+ * Gets the raw email message from the server
109
+ * @return string
110
+ */
111
+ function fetchEmail($index) {
112
  if ($index < 1 || $index > ($this->getNumberOfMessages() + 1)) {
113
  die("Invalid IMAP/POP3 message index!");
114
  }
115
  $header_info = imap_headerinfo($this->_connection, $index);
116
+ // if (IsDebugMode()) {
117
+ // $header = imap_fetchheader($this->_connection, $index);
118
+ // $body = imap_body($this->_connection, $index);
119
+ // return $header . $body;
120
+ // } else {
121
+ if ($header_info->Recent == 'N' || $header_info->Unseen == 'U') {
122
+ $email = imap_fetchheader($this->_connection, $index);
123
+ $email .= imap_body($this->_connection, $index);
124
+
125
+ return $email;
126
  } else {
127
+ return 'already read';
128
  }
129
+ //}
130
  }
131
+
132
  /**
133
+ * Marks a message for deletion
134
+ */
135
+ function deleteMessage($index) {
136
+ imap_delete($this->_connection, $index);
137
  }
138
+
139
  /**
140
+ * Handles purging any files that are marked for deletion
141
+ */
142
+ function expungeMessages() {
143
+ imap_expunge($this->_connection);
144
  }
145
+
146
  /**
147
+ * Handles disconnecting from the server
148
+ */
149
+ function disconnect() {
150
  imap_close($this->_connection);
151
  $this->_connection = false;
152
  }
153
+
154
  /**
155
+ * @return string
156
+ */
157
  function error() {
158
  return(imap_last_error());
159
  }
160
+
161
  /**
162
+ * Handles returning the right kind of object
163
+ * @return PostieIMAP|PostieIMAPSSL|PostimePOP3SSL
164
+ * @static
165
+ */
166
  function &Factory($protocol) {
167
+ switch (strtolower($protocol)) {
168
  case "imap":
169
  $object = &new PostieIMAP();
170
  break;
179
  }
180
  return($object);
181
  }
182
+
183
  }
184
 
185
  /**
186
+ * This class handles the details of an IMAP-SSL connection
187
  *
188
  * @author Dirk Elmendorf
189
  * @package Postie
190
  */
191
+ class PostieIMAPSSL Extends PostieIMAP {
192
 
193
+ function PostieIMAPSSL($protocol = "imap", $ssl_on = true, $self_cert = true) {
194
+ PostieIMAP::PostieIMAP($protocol, $ssl_on, $self_cert);
195
  }
196
+
197
  }
198
 
199
  /**
200
+ * This class handles the details of an POP3-SSL connection
201
  *
202
  * @author Dirk Elmendorf
203
  * @package Postie
204
  */
205
  class PostiePOP3SSL Extends PostieIMAP {
206
 
207
+ function PostiePOP3SSL($protocol = "pop3", $ssl_on = true, $self_cert = true) {
208
+ PostieIMAP::PostieIMAP($protocol, $ssl_on, $self_cert);
209
  }
210
+
211
  }
212
+
213
  ?>
postie_test.php CHANGED
@@ -2,7 +2,6 @@
2
  // try to connect to server with different protocols/ and userids
3
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
4
  include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php");
5
- //require_once('admin.php');
6
  require_once("postie-functions.php");
7
 
8
  $config = get_postie_config();
@@ -12,6 +11,7 @@ $parent_file = 'options-general.php?page=postie/postie.php';
12
  get_currentuserinfo();
13
 
14
  if (!current_user_can('manage_options')) {
 
15
  echo "<h2> Sorry only admin can run this file</h2>";
16
  exit();
17
  }
@@ -30,84 +30,63 @@ $images = array("Test.png", "Test.jpg", "Test.gif");
30
  }
31
 
32
  if (!TestPostieDirectory()) {
33
- print("<h1>Warning!</h1><p>Postie expects to be in its own directory named postie.</p>");
34
  } else {
35
- print("<p>Postie is in " . dirname(__FILE__) . "</p>");
36
  }
37
  ?>
38
 
39
  <br/>
40
  <h2>International support</h2>
41
  <p><i><?php _e('Only required for international character set support', 'postie') ?></i></p>
42
- <table>
43
- <tr>
44
- <th>iconv</th>
45
- <td> <?php if (HasIconvInstalled()) _e('yes', 'postie'); ?></td>
46
- </tr>
47
- <tr>
48
- <th>imap <small>(required for subjects)</small></th>
49
- <td> <?php if (function_exists('imap_mime_header_decode')) _e('yes', 'postie'); ?></td>
50
- </tr>
51
- </table>
52
- <br/>
53
-
54
  <h2>Clock Tests</h2>
55
  <p>This shows what time it would be if you posted right now</p>
56
  <?php
57
  $content = "";
58
  $data = DeterminePostDate($content);
 
 
59
  ?>
60
- <p><?php print("GMT:" . $data[1]); ?></p>
61
- <p><?php print("Current:" . $data[0]); ?></p>
62
-
63
- <h2>Mail Tests</h2>
64
- <p>These try to confirm that the email configuration is correct.</p>
65
-
66
- <table>
67
- <tr>
68
- <th>Test</th>
69
- <th>Result</th>
70
- </tr>
71
- <tr>
72
- <th>Connect to Mail Host</th>
73
- <td>
74
- <?php
75
- if (!$mail_server || !$mail_server_port || !$mail_userid) {
76
- print("NO - check server settings");
77
- }
78
- switch (strtolower($config["input_protocol"])) {
79
- case 'imap':
80
- case 'imap-ssl':
81
- case 'pop3-ssl':
82
- if (!HasIMAPSupport()) {
83
- print("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
84
- } else {
85
- require_once("postieIMAP.php");
86
- $mail_server = &PostieIMAP::Factory($config["input_protocol"]);
87
- if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) {
88
- print("Unable to connect. The server said - " . $mail_server->error());
89
- print("<br/>Try putting in your full email address as a userid and try again.");
90
- } else {
91
- print("Yes");
92
- }
93
- }
94
- break;
95
- case 'pop3':
96
- default:
97
- require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
98
- $pop3 = &new POP3();
99
- if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
100
- print("Unable to connect. The server said - " . $pop3->ERROR);
101
- print("<br/>Try putting in your full email address as a userid and try again.");
102
- } else {
103
- print("Yes");
104
- }
105
- break;
106
- }
107
- ?>
108
- </td>
109
- </tr>
110
 
 
111
 
112
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  </div>
2
  // try to connect to server with different protocols/ and userids
3
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
4
  include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php");
 
5
  require_once("postie-functions.php");
6
 
7
  $config = get_postie_config();
11
  get_currentuserinfo();
12
 
13
  if (!current_user_can('manage_options')) {
14
+ LogInfo("non-admin tried to set options");
15
  echo "<h2> Sorry only admin can run this file</h2>";
16
  exit();
17
  }
30
  }
31
 
32
  if (!TestPostieDirectory()) {
33
+ EchoInfo("<b>Warning!</b> Postie expects to be in its own directory named postie.");
34
  } else {
35
+ EchoInfo("Postie is in " . dirname(__FILE__));
36
  }
37
  ?>
38
 
39
  <br/>
40
  <h2>International support</h2>
41
  <p><i><?php _e('Only required for international character set support', 'postie') ?></i></p>
42
+ <?php
43
+ EchoInfo("iconv: " . ((HasIconvInstalled()) ? __('yes', 'postie') : __('no', 'postie')));
44
+ EchoInfo("imap <small>(required for subjects)</small>: " . ((function_exists('imap_mime_header_decode')) ? __('yes', 'postie') : __('no', 'postie')));
45
+ ?>
46
+
 
 
 
 
 
 
 
47
  <h2>Clock Tests</h2>
48
  <p>This shows what time it would be if you posted right now</p>
49
  <?php
50
  $content = "";
51
  $data = DeterminePostDate($content);
52
+ EchoInfo("GMT: $data[1]");
53
+ EchoInfo("Current: $data[0]");
54
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
+ <h2>Connect to Mail Host</h2>
57
 
58
+ <?php
59
+ if (!$mail_server || !$mail_server_port || !$mail_userid) {
60
+ EchoInfo("NO - check server settings");
61
+ }
62
+ switch (strtolower($config["input_protocol"])) {
63
+ case 'imap':
64
+ case 'imap-ssl':
65
+ case 'pop3-ssl':
66
+ if (!HasIMAPSupport()) {
67
+ EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
68
+ } else {
69
+ require_once("postieIMAP.php");
70
+ $mail_server = &PostieIMAP::Factory($config["input_protocol"]);
71
+ if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) {
72
+ EchoInfo("Unable to connect. The server said:");
73
+ EchoInfo($mail_server->error());
74
+ } else {
75
+ EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
76
+ }
77
+ }
78
+ break;
79
+ case 'pop3':
80
+ default:
81
+ require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
82
+ $pop3 = &new POP3();
83
+ if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
84
+ EchoInfo("Unable to connect. The server said:");
85
+ EchoInfo($pop3->ERROR);
86
+ } else {
87
+ EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
88
+ }
89
+ break;
90
+ }
91
+ ?>
92
  </div>
readme.html CHANGED
@@ -1,2120 +1,193 @@
1
- <p><em>The Postie plugin allows you to blog via e-mail, including many advanced
2
- features not found in WordPress&#039;s default post by e-mail feature.</em></p>
3
-
4
- <hr />
5
-
6
- <p>
7
- <strong>Contributors:</strong> WayneAllen<br />
8
- <strong>Donate link:</strong> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&#038;hosted_button_id=HPK99BJ88V4C2">donate</a><br />
9
- <strong>Tags:</strong> e-mail, email<br />
10
- <strong>Requires at least:</strong> 2.8<br />
11
- <strong>Tested up to:</strong> 3.4.2<br />
12
- <strong>Stable tag:</strong> 1.4.5<br/>
13
- <strong>License:</strong> GPLv2 or later (http://www.gnu.org/licenses/gpl-2.0.html) </p>
14
-
15
- <hr />
16
-
17
- <h3>Description</h3>
18
- <p>Postie offers many advanced features for posting to your blog via e-mail,
19
- including the ability to assign categories by name, included pictures and
20
- videos, and automatically strip off signatures. It also has support for both
21
- imap and pop3, with the option for ssl with both. For usage notes, see the
22
- <a href="other_notes">other notes</a> page</p>
23
-
24
- <h4>What's new?</h4>
25
-
26
- <ul>
27
- <li><p>1.4.5 (2012.11.14)</p>
28
-
29
- <ul>
30
- <li>Fixed bug in XSS attack vulnerability code. Thanks to R Reid <a href="http://blog.strictly-software.com/2012/03/fixing-postie-plugin-for-wordpress-to.html" rel="nofollow">http://blog.strictly-software.com/2012/03/fixing-postie-plugin-for-wordpress-to.html</a></li>
31
- <li>Fixed bug where emails with multiple categories has the incorrect title</li>
32
- <li>Fixed bugs where PHP setting were not being changed correctly - thanks to Peter Chester <a href="http://tri.be/author/peter/" rel="nofollow">http://tri.be/author/peter/</a></li>
33
- <li>New maintainer</li>
34
- </ul></li>
35
- <li><p>1.4.4 (2012.08.10)</p>
36
-
37
- <ul>
38
- <li>Fixed possible XSS attack vulnerability </li>
39
- </ul></li>
40
- <li><p>1.4.3 (2011.12.12)</p>
41
-
42
- <ul>
43
- <li>Removed get_user_by function to make compatible with wp 3.3 - now requires
44
- 2.8+</li>
45
- </ul></li>
46
- <li><p>1.4.2 (2011.01.29)</p>
47
-
48
- <ul>
49
- <li>Fixed mailto link bug (thanks to Jason McNeil) </li>
50
- <li>Fixed bug with attachments with non-ascii characters in filename (thanks to
51
- mtakada)</li>
52
- <li>checking for socket errors when checking mail (thanks elysian)</li>
53
- <li>fixed issue with multiple files not being inserted correctly</li>
54
- <li>Added support for ISO 8859-15 (thanks paolog)</li>
55
- <li>fixed sql injection problem (thanks Jose P. Espinal for pointing it out)</li>
56
- </ul></li>
57
- <li><p>1.4.1 (2010.06.18)</p>
58
-
59
- <ul>
60
- <li>Images appear in correct order when using images append = false</li>
61
- <li>Images are sorted in order of filename before inserting into post</li>
62
- <li>Fixed formatting problem with wordpress_default image template</li>
63
- <li>Captions now correctly work with wordpress &gt;3.0 and &lt;3.0</li>
64
- <li>Fixed auto_gallery feature</li>
65
- <li>Default port is now 110</li>
66
- <li>Added more configuration tests</li>
67
- <li>Added background color to settings page to make input boxes more visible</li>
68
- <li>Removed extra quote character in captions from #img# placeholders (thanks
69
- SteelD for pointing out the error)</li>
70
- <li>Added support for big5 and gb-1232 encodings (thanks Chow)</li>
71
- <li>Fixed issue with configurations items stored as arrays, which caused
72
- problems with validating authorized addresses</li>
73
- <li>Fixed bug with replaceImageCIDs function</li>
74
- <li>On hosts which allow it, we set max execution time to 300 seconds and
75
- memory_limit to infinity to allow processing of large e-mails (especially
76
- with large attachments)</li>
77
- </ul></li>
78
- </ul> <hr />
79
- <h3>Installation</h3>
80
- <ul>
81
- <li>Either:
82
-
83
- <ul>
84
- <li>Put the postie.zip file in wp-content/plugins/ and unzip it</li>
85
- </ul></li>
86
- <li>Or:
87
-
88
- <ul>
89
- <li>Use the automatic installer (WP 2.7+)</li>
90
- </ul></li>
91
- <li>Login to WordPress as an administrator</li>
92
- <li>Goto the Plugins tab in the WordPress Admin Site</li>
93
- <li>Activate "Postie"</li>
94
- <li>Goto to the "Settings" tab and click on the sub-tab "Postie" to configure it.</li>
95
- <li>Make sure you enter the mailserver information correctly, including the type
96
- of connection and the port number. Common port configurations:
97
-
98
- <ul>
99
- <li>pop3: 110 </li>
100
- <li>pop3-ssl: 995</li>
101
- <li>imap: 143</li>
102
- <li>imap-ssl: 993</li>
103
- </ul></li>
104
- <li>(Postie ignores the settings under Settings-&gt;Writing-&gt;Writing-by-Email)</li>
105
- </ul>
106
-
107
- <h4>Automating checking e-mail</h4>
108
-
109
- <p>By default, postie checks for new e-mail every 30 minutes. You can select from
110
- a number of different checking intervals in the settings page, under the
111
- mailserver tab.</p>
112
-
113
- <p>If you would prefer to have more fine-grained control of how postie checks
114
- for mail, you can also set up a crontab. This is for advanced users only.
115
- If your site runs on a UNIX/linux server, and you have shell access, you can
116
- enable mail checking using cron; if you don't know anything about cron, skip
117
- to the cronless postie section.</p>
118
-
119
- <p>Setup a cronjob to pull down the get&#095;mail.php
120
- Examples:</p>
121
-
122
- <p>*/5 * * * * /usr/bin/lynx --source <a href="http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php" rel="nofollow">http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php</a> &gt;/dev/null 2&gt;&amp;1</p>
123
-
124
- <p>This fetches the mail every five minutes with lynx</p>
125
-
126
- <p>*/10 * * * * /usr/bin/wget -O /dev/null <a href="http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php" rel="nofollow">http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php</a> &gt;/dev/null 2&gt;&amp;1</p>
127
-
128
- <p>This fetches the mail every ten minutes with wget</p> <hr />
129
- <h3>Frequently Asked Questions</h3>
130
- <h4>Postie won't connect to my mailserver. Why Not?</h4>
131
-
132
- <p>Make sure the port you are using is open. For example, bluehost seems to block
133
- ports 993 and 995 (for pop3-ssl and imap-ssl) by default. I have heard that
134
- you can request that they open them for you ( you might have to pay extra).</p>
135
-
136
- <p>You can check for open ports with the following command on your server:
137
- netstat -ln|grep -E ':::(993|995|143)'</p>
138
-
139
- <p>If nothing shows up, then the ports are not open.</p>
140
-
141
- <h4>How can I get postie to display inline images?</h4>
142
-
143
- <p>Make sure that you send e-mail formatted as html (richtext), and set postie to
144
- prefer html messages (in the message tab of the postie settings)</p>
145
-
146
- <h4>Mail is not showing up right when I send html (rich formatted) e-mail!</h4>
147
-
148
- <p>Make sure you set the preferred text type to html</p>
149
-
150
- <h4>Do I need to any code to my theme for postie to work?</h4>
151
-
152
- <p>No.</p>
153
-
154
- <h4>I read somewhere to add an iframe to my footer. Should I do this?</h4>
155
-
156
- <p>No. Do not add an iframe in your footer to get postie to check mail
157
- periodically. To check e-mail periodically, either set-up a cron job, or use
158
- cronless postie. See installation instructions</p>
159
-
160
- <h4>My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl</h4>
161
-
162
- <p>You must have php-imap installed on your server for this to work. Ask your
163
- hosting provider about this.</p>
164
-
165
- <h4>Can I use postie to check a gmail account?</h4>
166
-
167
- <p>Yes. You can use either pop3-ssl or imap-ssl with a gmail account. Before
168
- attempting to use with postie, make sure that you enable pop or imap in your
169
- gmail preferences.</p>
170
-
171
- <ul>
172
- <li>Pop3 settings:
173
-
174
- <ul>
175
- <li>protocol - pop3-ssl</li>
176
- <li>server - pop.gmail.com</li>
177
- <li>port - 995</li>
178
- <li>userid - your username (e.g. if your e-mail address is <a href="mailto:foo@gmail.com">foo@gmail.com</a>,
179
- this would be just foo)</li>
180
- <li>password - your password </li>
181
- </ul></li>
182
- <li>IMAP settings:
183
-
184
- <ul>
185
- <li>protocol - imap-ssl</li>
186
- <li>server - imap.gmail.com</li>
187
- <li>port - 993</li>
188
- <li>userid - your username (e.g. if your e-mail address is <a href="mailto:foo@gmail.com">foo@gmail.com</a>,
189
- this would be just foo)</li>
190
- <li>password - your password </li>
191
- </ul></li>
192
- </ul>
193
-
194
- <h4>My posts show up as being posted by 'admin' instead of me. Why?</h4>
195
-
196
- <p>If your admin account is linked to <a href="mailto:bar@gmail.com">bar@gmail.com</a>, and you send mail from
197
- <a href="mailto:bar@gmail.com">bar@gmail.com</a>, it will show up as being posted by admin. If you have a
198
- wordpress user named "John Doe", which is linked to <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a>, make
199
- sure that you send e-mails from <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a>. It doesn't matter which
200
- e-mail address postie is checking. That is, if you send mail from
201
- <a href="mailto:johndoe@gmail.com">johndoe@gmail.com</a> to <a href="mailto:foo@gmail.com">foo@gmail.com</a>, it gets posted as "John Doe".</p>
202
-
203
- <p>If you send an e-mail to your postie address from an e-mail address that is no
204
- t linked to a wordpress user, it will get posted as admin.</p>
205
-
206
- <h4>Images aren't showing up at all?</h4>
207
-
208
- <p>There are a couple possible reasons for this. First, check to see if you can
209
- add an image through wordpress's normal posting mechanism. If not, then there
210
- is probably 1 or 2 problems:
211
- 1. Your server does not have the php-gd library installed. Ask your hosting
212
- provider about this.</p>
213
-
214
- <ol>
215
- <li>Your wp-content/uploads directory is not writable by the webserver. Make
216
- sure that it is</li>
217
- </ol>
218
-
219
- <h4>Can I delete the wp-files directory needed by postie version &lt;1.3.0?</h4>
220
-
221
- <p>If you have posts published already by older versions of postie, getting rid
222
- of those directories will delete any files you might have had associated with
223
- those old posts. If you don't have any such posts, then you can safely delete
224
- them.</p>
225
-
226
- <h4>How can I get rid of stupid stuff my e-mail provider adds to my messages?</h4>
227
-
228
- <p>To strip off stuff that they add at the beginning of a message, start your
229
- post with :start</p>
230
-
231
- <p>To strip off stuff that they add at the end of a message, end your
232
- post with :end</p>
233
-
234
- <h4>How can I add custom attachment icons?</h4>
235
-
236
- <p>Simply upload the icons you want to the postie/icons/custom directory. You
237
- must name the icons according to the following scheme:
238
- {filetype}-{size}.png</p>
239
-
240
- <p>For example, for word documents, you could use:</p>
241
-
242
- <pre><code>doc-32.png</code></pre>
243
-
244
- <p>for a 32x32 pixel icon. (You can actually create any size icon you want, but
245
- if you name it 32, then it will only be used if you select to use size 32
246
- icons)</p>
247
-
248
- <p>See the other directories in icons for more examples.</p>
249
-
250
- <p>Currently the following filetypes are supported:</p>
251
-
252
- <ul>
253
- <li>doc - microsoft word (including docx)</li>
254
- <li>ppt - microsoft powerpoint (including pptx)</li>
255
- <li>xls - microsoft excel (including xlsx)</li>
256
- <li>numbers - iWork numbres spreadsheet</li>
257
- <li>pages - iWork pages document</li>
258
- <li>key - iWork keynote presentation</li>
259
- <li>pdf - portable document format</li>
260
- <li>rtf - rich text format</li>
261
- <li>txt - plain text document</li>
262
- </ul>
263
-
264
- <h4>Can I add special text to the body of the post when using postie?</h4>
265
-
266
- <p>Yes. You can create your own function, and use the postie_post filter.
267
- Two short examples are included in the filterPostie.php.sample file</p>
268
-
269
- <h4>Can I add special text to the title of the post when using postie?</h4>
270
-
271
- <p>Yes. You can create your own function, and use the postie_post filter.
272
- Two short examples are included in the filterPostie.php.sample file</p>
273
-
274
- <h4>Can I select tags or categories based on the content of the e-mail?</h4>
275
-
276
- <p>Yes. You can create your own function, and use the postie_post filter.
277
- See the filterPostie.php.sample file for examples.</p>
278
-
279
- <h4>Is the IMAP extension required for postie?</h4>
280
-
281
- <p>The IMAP extension is not required, but it is strongly recommended, especially
282
- is you are using non-English text. There is more information on php.net about
283
- installing the IMAP extension. If you have control over your server, it is
284
- often not hard to install.</p>
285
-
286
- <p>On Ubuntu, try
287
- sudo apt-get install php5-imap</p>
288
-
289
- <p>On Fedora, try
290
- sudo yuminstall php-imap</p>
291
-
292
- <p>The IMAP extension is known to be installed on the following popular webhosts:
293
- * Dreamhost</p>
294
-
295
- <h4>How can I embed youtube or vimeo videos?</h4>
296
-
297
- <p>Simply put the url in the body of your e-mail. (Make sure that you have the
298
- option to convert url into links turned on)</p> <hr />
299
- <h3>Screenshots</h3>
300
- <ol>
301
- <li>Postie options (showing video and audio templates)</li>
302
- </ol> <hr />
303
- <h3>Changelog</h3>
304
- <h4>1.4.5</h4>
305
-
306
- <ul>
307
- <li>TODO - fix corruption of rtf attachments</li>
308
- <li>TODO - add port checking in tests</li>
309
- <li>TODO - non-image uploads get ignored in content when using autogallery - see
310
- replaceimageplaceholders</li>
311
- </ul>
312
-
313
- <h4>1.4.4 (2012.08.10)</h4>
314
-
315
- <ul>
316
- <li>Fixed possible XSS attack vulnerability </li>
317
- </ul>
318
-
319
- <h4>1.4.3</h4>
320
-
321
- <ul>
322
- <li>Removed get_user_by function to make compatible with wp 3.3 - now requires
323
- 2.8+</li>
324
- </ul>
325
-
326
- <h4>1.4.2 (2011.01.29)</h4>
327
-
328
- <ul>
329
- <li>Fixed mailto link bug (thanks to Jason McNeil) </li>
330
- <li>Fixed bug with attachments with non-ascii characters in filename (thanks to
331
- mtakada)</li>
332
- <li>checking for socket errors when checking mail (thanks elysian)</li>
333
- <li>fixed issue with multiple files not being inserted correctly</li>
334
- <li>Added support for ISO 8859-15 (thanks paolog)</li>
335
- <li>fixed sql injection problem (thanks Jose P. Espinal for pointing it out)</li>
336
- <li>Fixed namespace clashing for get_config function</li>
337
- </ul>
338
-
339
- <h4>1.4.1 (2010.06.18)</h4>
340
-
341
- <ul>
342
- <li>Images appear in correct order when using images append = false</li>
343
- <li>Fixed formatting problem with wordpress_default image template</li>
344
- <li>Captions now correctly work with wordpress &gt;3.0 and &lt;3.0</li>
345
- <li>Fixed auto_gallery feature</li>
346
- <li>Default port is now 110</li>
347
- <li>Added more configuration tests</li>
348
- <li>Added background color to settings page to make input boxes more visible</li>
349
- <li>Removed extra quote character in captions from #img# placeholders (thanks
350
- SteelD for pointing out the error)</li>
351
- <li>Added support for big5 and gb-1232 encodings (thanks Chow)</li>
352
- <li>Fixed issue with configurations items stored as arrays, which caused
353
- problems with validating authorized addresses</li>
354
- <li>Fixed bug with replaceImageCIDs function</li>
355
- <li>On hosts which allow it, we set max execution time to 300 seconds and
356
- memory_limit to infinity to allow processing of large e-mails (especially
357
- with large attachments)</li>
358
- <li>Images are sorted in order of filename before inserting into post
359
- <h4>1.4 (2010.04.25)</h4> </li>
360
- <li>Now using wordpress settings api (thanks for much help from Andrew S)</li>
361
- <li>Cronless postie is now integrated with postie instead of a separate plugin</li>
362
- <li>filterPostie.php moved to filterPostie.php.sample</li>
363
- <li>Can use fetchmails.php to fetch mail from multiple mailboxes</li>
364
- <li>Fixed problem with embedding youtube videos from html (richtext) e-mail</li>
365
- <li>Added support for embedding vimeo vidoes</li>
366
- <li>Fixed problem with selecting "none" as icon set for attachments (thanks
367
- tonyvitali)</li>
368
- <li>Fixed problems with cronless postie settings</li>
369
- <li>Fixed bug with embedding youtube and vimeo videos whose ID contains a -
370
- (thanks Jim Kehoe)</li>
371
- <li>Post_author is now included with attachments</li>
372
- <li>fixed confirmation_email settings so that now you can select between sender,
373
- admin, both, or none (thanks to redsalmon for pointing out bug)</li>
374
- <li>Added option to automatically insert galleries</li>
375
- <li>Updated FAQ and readme</li>
376
- </ul>
377
-
378
- <h4>1.3.4 (2009.10.05)</h4>
379
-
380
- <ul>
381
- <li>Fixed problem with images not posting under cron</li>
382
- <li>Fixed issue with disappearing password</li>
383
- </ul>
384
-
385
- <h4>1.3.3 (2009.09.11)</h4>
386
-
387
- <ul>
388
- <li>Fixed problem with double titles</li>
389
- <li>Fixed error in wp-mu</li>
390
- <li>Cronless postie now correctly updates when changing the setting in the
391
- postie settings</li>
392
- <li>Small fix in handling of names of attachments (thanks to Teejot)</li>
393
- <li>Fixed delay option (thanks to redbrandonk)</li>
394
- <li>Cronless option value is now correctly deleted when deactivating the
395
- cronless postie plugin</li>
396
- </ul>
397
-
398
- <h4>1.3.2 (2009.08.27)</h4>
399
-
400
- <ul>
401
- <li>tags are now always an array, even if no default tags are set </li>
402
- <li>Subject is showing up again if you do not have the IMAP extension
403
- installed</li>
404
- <li>More information on the IMAP extension and more user-friendly
405
- installation</li>
406
- <li>Fixed problems with smtp server settings in 1.3.1</li>
407
- <li>Added russian translation (thanks to fatcow.com)</li>
408
- </ul>
409
-
410
- <h4>1.3.1 (2009.08.24)</h4>
411
-
412
- <ul>
413
- <li>Changed GetContent filter to postie_post</li>
414
- <li>Added database upgrade hook on activation</li>
415
- <li>Fixed bug where content would be empty if trying to remove signature,
416
- and signature list was emtpy</li>
417
- <li>Updated FAQ and readme</li>
418
- </ul>
419
-
420
- <h4>1.3.0 (2009.08.14)</h4>
421
-
422
- <ul>
423
- <li>Features
424
-
425
- <ul>
426
- <li>Added mpeg4 to default list of videotypes</li>
427
- <li>Added support for KOI8-R character set (cyrillic)</li>
428
- <li>Added support for iso-8859-2 character set (eastern european)</li>
429
- <li>Added option to include custom icons for attachments</li>
430
- <li>Added option to send confirmation message to sender</li>
431
- <li>Enhanced e-mails for unauthorized users</li>
432
- <li>Added option to send unauthorized e-mail back to sender</li>
433
- <li>Added option to only allow e-mails from a specified list of smtp
434
- servers</li>
435
- <li>Added option to use shortcode for embedding videos (works with the
436
- videos plugin <a href="http://www.daburna.de/download/videos-plugin.zip" rel="nofollow">http://www.daburna.de/download/videos-plugin.zip</a></li>
437
- <li>Better handling of comment authors (thanks to Petter for suggestion)</li>
438
- <li>Simplified message options (now includes an advanced options section)</li>
439
- <li>Added filter ability for post content</li>
440
- </ul></li>
441
- <li>Bug fixes
442
-
443
- <ul>
444
- <li>No longer including wp-config.php</li>
445
- <li>If tmpdir is not writable, try a different tmpdir</li>
446
- <li>More subject encoding fixes</li>
447
- <li>Updated image templates, which were causing problems for cron</li>
448
- <li>Fixed in text captions</li>
449
- <li>Fixed SQL problems when updating options</li>
450
- <li>Fixed name clashes with other plugins</li>
451
- <li>Fixed custom image field</li>
452
- </ul></li>
453
- </ul>
454
-
455
- <h4>1.3.beta (2009.07.01)</h4>
456
-
457
- <ul>
458
- <li>Mores fixes for character issues in subject</li>
459
- <li>Now handling Windows-1256 (arabic) character set</li>
460
- <li>Fixed image uploading on windows servers</li>
461
- <li>Fixed replying to message adds comment</li>
462
- <li>Uploading pictures via MMS should now work</li>
463
- <li>Fixed some issues with e-mails from outloook 12</li>
464
- <li>Greatly reduced number of database queries</li>
465
- <li>No longer requiring config_handler.php</li>
466
- </ul>
467
-
468
- <h4>1.3.alpha (2009.06.05)</h4>
469
-
470
- <ul>
471
- <li>Now using default wordpress image and upload handling, which means:
472
-
473
- <ul>
474
- <li>No more creating special directories for postie</li>
475
- <li>No more confusion about imagemagick</li>
476
- <li>Can now use the [gallery] feature of wordpress</li>
477
- <li>Attachments are now connected to posts in the database</li>
478
- <li>All image resizing uses wordpress's default settings (under media)</li>
479
- </ul></li>
480
- <li>Configuration, settings and documentation improvements
481
-
482
- <ul>
483
- <li>Completely redesigned settings page (mostly thanks to Rainman)</li>
484
- <li>Reset configuration no longer deletes mailserver settings</li>
485
- <li>Now including help files and faq directly in settings page</li>
486
- </ul></li>
487
- <li>More media features
488
-
489
- <ul>
490
- <li>Automatically turn links to youtube into an embedded player</li>
491
- <li>Added option to embed audio files with custom templates</li>
492
- <li>Video options are now template based</li>
493
- <li>Image options are now solely template based, with several new default
494
- templates</li>
495
- </ul></li>
496
- <li>Bug fixes
497
-
498
- <ul>
499
- <li>Uploading images from vodafone phones should now work</li>
500
- <li>Correctly handling Windows-1252 encoding</li>
501
- <li>Correctly handling non-ascii characters in subject line</li>
502
- </ul></li>
503
- </ul>
504
-
505
- <h4>1.2.3 (2009.05.17)</h4>
506
-
507
- <ul>
508
- <li>Fixed headers already sent bug</li>
509
- <li>Converted shortcode <code>&lt;?</code> to proper <code>&lt;?php</code> (thanks brack)</li>
510
- <li>Deleting mails after processing again</li>
511
- </ul>
512
-
513
- <h4>1.2.2 (2009.05.15)</h4>
514
-
515
- <ul>
516
- <li>Show empty categories for default category in options</li>
517
- <li>Image scaling fixed so that the smaller value of max image width and max
518
- image height is used</li>
519
- <li>Fixed some issues with parsing html e-mail</li>
520
- <li>Got rid of stupid mime tag (thanks Jeroen)</li>
521
- <li>No longer adding slashes before calling wp_insert_post</li>
522
- <li>When using custom image field, each image has a unique key</li>
523
- </ul>
524
-
525
- <h4>1.2.1 (2009.05.07)</h4>
526
-
527
- <ul>
528
- <li>Got rid of stupid version checking</li>
529
- <li>Improved cronless postie instructions and configuration</li>
530
- <li>Internationalization is working now</li>
531
- <li>Dutch localization (thanks to gvmelle> <a href="http://gvmelle.com" rel="nofollow">http://gvmelle.com</a></li>
532
- <li>Fixed caption bug when using image magick</li>
533
- <li>Added option to not filter new lines (when using markdown syntax)</li>
534
- <li>Fixed autoplay option</li>
535
- <li>Can now use wildcards in excluding filenames</li>
536
- <li>Producing better quality thumbnails (thanks to robcarey)</li>
537
- </ul>
538
-
539
- <h4>1.2 (2009.04.22)</h4>
540
-
541
- <ul>
542
- <li>More video options:
543
-
544
- <ul>
545
- <li>Can embed 3gp, mp4, mov videos</li>
546
- <li>Can specify video width, video height, player width, and player height
547
- in the settings page</li>
548
- <li>Can specify custom image template</li>
549
- </ul></li>
550
- <li>Image handling improvements:
551
-
552
- <ul>
553
- <li>Only downscale images, not up-scale (thanks Jarven)</li>
554
- <li>More custom image template options</li>
555
- <li>IPTC captions now also work when not resizing images</li>
556
- <li>Added option to use custom field for images (for Datapusher)</li>
557
- <li>Fixed some issues with image templates and line break handling</li>
558
- <li>Custom image template now works even when not resizing images</li>
559
- </ul></li>
560
- <li>Documentation improvements:
561
-
562
- <ul>
563
- <li>Added links to settings, forum, and readme in plugin description</li>
564
- <li>Updated readme (thanks to Venkatraman Dhamodaran)</li>
565
- <li>Added better instructions on how to use cronless postie</li>
566
- </ul></li>
567
- <li>Text processing improvements:
568
-
569
- <ul>
570
- <li>Added option to automatically convert urls into links</li>
571
- <li>Added feature to include a custom excerpt</li>
572
- </ul></li>
573
- <li>Miscellaneous improvements
574
-
575
- <ul>
576
- <li>Improved internationalization (thanks to Håvard Broberg
577
- (nanablag@nanablag.com))</li>
578
- </ul></li>
579
- <li>Bug Fixes
580
-
581
- <ul>
582
- <li>Removed debugging info in get_mail.php (security issue) thanks to
583
- <a href="http://svalgaard.net/jens/">Jens</a></li>
584
- <li>No longer directly including pluggable.php (should
585
- prevent conflicts with other plugins such as registerplus</li>
586
- </ul></li>
587
- </ul>
588
-
589
- <h4>1.1.5 (2009.03.10)</h4>
590
-
591
- <ul>
592
- <li>Added option to have postie posts be pending review, published, or draft</li>
593
- <li>Settings panel only shows up for administrators</li>
594
- <li>Need not be user "admin" to modify settings or to post from non-registered
595
- users</li>
596
- <li>Can now set administrator name. Authorized e-mail addresses which don't
597
- have a user get posted under this name</li>
598
- <li>Will use IPTC captions if available</li>
599
- <li>Added option to replace newline characters with <br /></li>
600
- </ul>
601
-
602
- <h4>1.1.4 (2009.03.06)</h4>
603
-
604
- <ul>
605
- <li>Added more image options (open in new window, custom image template)</li>
606
- <li>can now add captions to images</li>
607
- <li>Can now add tags (including default tag option)</li>
608
- </ul>
609
-
610
- <h4>1.1.3 (2009.02.20)</h4>
611
-
612
- <ul>
613
- <li>Fixed delayed posting</li>
614
- <li>updated readme some</li>
615
- </ul>
616
-
617
- <h4>1.1.2 (2008.07.12)</h4>
618
-
619
- <ul>
620
- <li>now maintained by Robert Felty</li>
621
- <li>allow negative delays</li>
622
- <li>will glean author information from forwarded or redirected e*mails</li>
623
- <li>replying to an e*mail adds a comment to a post</li>
624
- <li>fixed category handling to work with taxonomy</li>
625
- <li>fixed one syntax error</li>
626
- <li>added option to wrap posts and comments in </li>
627
- </ul>
628
-
629
- <p>&lt;</p>
630
-
631
- <p>pre%gt; tags</p>
632
-
633
- <h4>1.1.1</h4>
634
-
635
- <p>Below is all the of the version information. As far as I can tell there once was a guy named John Blade. He took some of the original wp-mail.php code
636
- and started hacking away on it. He actually got pretty far. About the time I discovered WordPress and his little hack - called WP-Mail at the time - he
637
- went on a vacation or something. There were some problems with the script, and it was missing some features I wanted. I hacked away at it and got it
638
- into a place where it did what I wanted. I started posting about it since I figured other people might want the features.</p>
639
-
640
- <p>John didn't release any more versions at least up til July 2005. So I started accepting submissions and feature requests from people to help make the
641
- code better. In June/July 2005 I discovered a little plugin by Chris J Davis (<a href="http://www.chrisjdavis.org/cjd-notepad/" rel="nofollow">http://www.chrisjdavis.org/cjd-notepad/</a>) called notepad. I added a small
642
- feature to it (basically a bookmarklet). In the process I started looking at his code and realized how much you could do with the plugin system
643
- available in Word Press.</p>
644
-
645
- <p>So I decided to make an offical fork. I put up an article on my blog asking for new names. I picked Postie. I then modified the code to be a proper
646
- plugin. And the rest is history :)</p>
647
-
648
- <ul>
649
- <li>BUGFIX -problem with subject</li>
650
- <li>BUGFIX -cronless postie typo</li>
651
- </ul>
652
-
653
- <h4>1.1</h4>
654
-
655
- <ul>
656
- <li>FEATURE: Updated and tested with WordPress 2.1</li>
657
- <li>BUGFIX:Removed deprecated functions</li>
658
- <li>FEATURE: Cronless Postie now uses the WordPress native Psuedo Cron.</li>
659
- </ul>
660
-
661
- <h4>1.0</h4>
662
-
663
- <ul>
664
- <li>BUGFIX: TestWPVersion broke with 2.1</li>
665
- <li>FEATURE: end: now marks the end of a message (Dan Cunningham)</li>
666
- <li>FEATURE: Better Readme (Michael Rasmussen)</li>
667
- <li>FEATURE: Smart Sharpen Option -EXPERIMENTAL- (Jonas Rhodin)</li>
668
- <li>BUGFIX: Issue with google imap fixed (Jim Hodgson)</li>
669
- <li>BUGFIX: Fixed espacing issue in subjects (Paul Clip)</li>
670
- <li>BUGFIX: Typo in Div fixed (phil)</li>
671
- </ul>
672
-
673
- <h4>0.9.9.3.2</h4>
674
-
675
- <ul>
676
- <li>BUGFIX: Typo</li>
677
- </ul>
678
-
679
- <h4>0.9.9.3.1</h4>
680
-
681
- <ul>
682
- <li>BUGFIX: Removed debugging code</li>
683
- </ul>
684
-
685
- <h4>0.9.9.3</h4>
686
-
687
- <ul>
688
- <li>BUGFIX: If your email address matches an existing user - then it will post as that user - even if you allow anyone to post.</li>
689
- <li>BUGFIX: Replaced get_settings('home') with get_settings('siteurl')</li>
690
- <li>BUGFIX: Better handling for Japanese charactersets - Thanks to <a href="http://www.souzouzone.jp/blog/archives/009531.html" rel="nofollow">http://www.souzouzone.jp/blog/archives/009531.html</a></li>
691
- <li>BUGFIX: Better thumbnail window opening code - thanks to Gabi &amp; Duntello!</li>
692
- <li>FEATURE: Added an option to set the MAX Height of an image - idea from Duntello</li>
693
- <li>BUGFIX: Modified the FilterNewLines for better flowed text handling - You now HAVE TO PUT TWO NEW LINES to end a paragraph.</li>
694
- <li>FEATURE: Added new CSS tags to support positioning images/attachments/3gp videos</li>
695
- <li>BUGFIX: Tries to use the date in the message (Thanks Ravan) I tried this once before and it never worked - hopefully this time it will.</li>
696
- <li>BUGFIX: Added a workaround to fix the problem with Subscribe2 - it will now notify on posts that are not set to show up in the future.</li>
697
- </ul>
698
-
699
- <h4>0.9.9.2</h4>
700
-
701
- <ul>
702
- <li>BUGFIX: Looks for the NOOP error and disgards it</li>
703
- <li>FEATURE: Postie now detects the version of WordPress being used </li>
704
- <li>FEATURE: Smarter Parsing of VodaPhone </li>
705
- <li>FEATURE: Easy place to add new code to handle other brain-dead mail clients</li>
706
- <li>BUGFIX: Handles insertion of single quotes properly</li>
707
- <li>BUGFIX: Thumbnails should now link properly</li>
708
- </ul>
709
-
710
- <h4>0.9.9.1</h4>
711
-
712
- <ul>
713
- <li>BUGFIX: Needed a strtolower in places to catch all iso-8859 - thx to Gitte Wange for the catch</li>
714
- <li>BUGFIX: Fixed issue with the category not being posted properly</li>
715
- </ul>
716
-
717
- <h4>0.9.9</h4>
718
-
719
- <ul>
720
- <li>UPDATE TO WP 2.0</li>
721
- <li>BUGFIX: Config Page now works</li>
722
- <li>FEATURES: Supports role based posting</li>
723
- <li>BUGFIX: Posting updates the category counts.</li>
724
- </ul>
725
-
726
- <h4>0.9.8.6</h4>
727
-
728
- <ul>
729
- <li>BUGFIX: Fixed problems with config page &lt;%php became &lt;?php</li>
730
- <li></li>
731
- </ul>
732
-
733
- <h4>0.9.8.5</h4>
734
-
735
- <ul>
736
- <li>BUGFIX: onClick changed to onclick</li>
737
- <li>BUGFIX: strolower added to test for iso - thanks daniele</li>
738
- <li>BUGFIX: Added a class to the 3gp video tags</li>
739
- <li>FEATURE: Added the option to put the images before the article</li>
740
- <li>BUGFIX: Added in selection for charsets - thanks Psykotik - this may cause problems for other encodings</li>
741
- <li>FEATURE: Added option to turn of quoted printable decoding</li>
742
- <li>FEATURE: :start tag - now postie looks for this tag before looking for you message - handy if your service provider prepends a message </li>
743
- <li>FEATURE: Template for translation now included</li>
744
- </ul>
745
-
746
- <h4>0.9.8.4</h4>
747
-
748
- <ul>
749
- <li>BUGFIX: Fixed problem with config_form.php - select had "NULL" instead of ""</li>
750
- <li>BUGFIX: 3g2 now supported</li>
751
- <li>BUGFIX: More line break issues addressed</li>
752
- <li>BUGFIX: QuickTime controls are now visible even if the movie is done playing</li>
753
- <li>BUGFIX: Email addresses in the format <a href="mailto:&#x73;o&#109;&#x65;&#064;&#x64;&#111;&#x6d;&#097;&#x69;&#110;&#046;&#x63;&#111;&#x6d;">&#x73;o&#109;&#x65;&#064;&#x64;&#111;&#x6d;&#097;&#x69;&#110;&#046;&#x63;&#111;&#x6d;</a> (Full Name) supported</li>
754
- <li>BUGFIX: Some images that were not being resized - are now</li>
755
- <li>BUGFIX: HTML problems - if you posted plain text with HTML on it ignored all images</li>
756
- <li>BUGFIX: The test system blew up on the thumbnails </li>
757
- <li>BUGFIX: Selected HTML for preferred text is now shown in the config form properly</li>
758
- <li>BUGFIX: Postie now complains if it is not in its own directory</li>
759
- <li>BUGFIX: Postie doesn't include PEAR if it is already available</li>
760
- <li>BUGFIX: In Test mode rejected emails are simply dropped</li>
761
- <li>BUGFIX: Markdown messes up Postie - it will warn you if you turn it on.</li>
762
- <li></li>
763
- </ul>
764
-
765
- <h4>0.9.8.3</h4>
766
-
767
- <ul>
768
- <li>BUGFIX: Fixed issue with the line feed replacement</li>
769
- <li>BUGFIX: Added Banned File Config back in</li>
770
- <li>FEATURE: Added in a link around 3gp video embedded via QT</li>
771
- <li>BUGFIX: Email that has both Plain and HTML content will show the HTML content and not the plain if html is preferred</li>
772
- </ul>
773
-
774
- <h4>0.9.8.2</h4>
775
-
776
- <ul>
777
- <li>BUGFIX: Fixed an extra new line after attachin non-image files.</li>
778
- <li>BUGFIX: The Test system now displays any missing gd functions</li>
779
- <li>BUGFIX: The test system was only using ImageMagick</li>
780
- </ul>
781
-
782
- <h4>0.9.8.1</h4>
783
-
784
- <ul>
785
- <li>BUGFIX: The test images are now included in the zip </li>
786
- </ul>
787
-
788
- <h4>0.9.8</h4>
789
-
790
- <ul>
791
- <li>BUGFIX: New Lines detected and handled properly in cases where the mail client doesn't put a space before the new line (Miss Distance)</li>
792
- <li>BUGFIX: 3gp mime type added (Paco Cotera)</li>
793
- <li>BUGFIX: Authorized Email Addresses are not case-insensitive</li>
794
- <li>FEATURE: The larger image now does a proper pop up </li>
795
- <li>BUGFIX: Fixed Timeing Issue - turns out it wasn't reading the db at all</li>
796
- <li>FEATURE: New Test Screen - to help track down problems</li>
797
- </ul>
798
-
799
- <h4>0.9.7</h4>
800
-
801
- <ul>
802
- <li>BUGFIX: removed all short tags</li>
803
- <li>BUGFIX: There were spacing issues in the way I wrote the QT embed statements </li>
804
- <li>FEATURE: Added calls to WP-Cron - should work with that properly now if you activate Cronless Postie</li>
805
- <li>FEATURE: ImageMagick version works without any calls to GD</li>
806
- <li>BUGFIX: Postie now correctly handles cases wjere tjere are multiple blogs in one db</li>
807
- <li>BUGFIX: Turned off warnings when using without GD</li>
808
- <li>FEATURE: add the rotate:X to your message to rotate all images</li>
809
- <li>FEATURE: new filter_postie_thumbnail_with_full which makes it easy to show a thumbnail on the front page but full image on the single page - see FAQ</li>
810
- </ul>
811
-
812
- <h4>0.9.6</h4>
813
-
814
- <ul>
815
- <li>BUGFIX: handles email addresses that are no name and just <a href="mailto:&#101;&#109;&#x61;&#105;&#108;&#x40;&#101;&#109;&#x61;&#x69;&#108;&#x2e;&#x63;&#111;&#x6d;">&#101;&#109;&#x61;&#105;&#108;&#x40;&#101;&#109;&#x61;&#x69;&#108;&#x2e;&#x63;&#111;&#x6d;</a> (Steve Cooley Reported)</li>
816
- <li>FEATURE: Basic support for embedding flash files</li>
817
- <li>BUGFIX: Postie now handles creating the correct URL on non Unix platforms</li>
818
- <li>BUGFIX: Fixed problem with file attachments not being put in the right place.</li>
819
- <li>FEATURE: You can now choose to use imagemagick convert to handle making thumbnails</li>
820
- <li>BUGFIX: Rewrote Cronless Postie to use direct sockets</li>
821
- <li>BUGFIX: Time offset is now settable just for Postie - hopefully this will fix problems for cases where the normal time offset doesn't work properly.</li>
822
- <li>FEATURE: First draft of frame for a 3GP video</li>
823
- <li>FEATURE: Option to embed 3GP in QuickTime Controller.</li>
824
- </ul>
825
-
826
- <h4>0.9.5.2</h4>
827
-
828
- <ul>
829
- <li>BUGFIX: gmt varialble not being set correctly</li>
830
- <li>BUGFIX: Changed the name of the Check Mail button to fix an issue with mod_security</li>
831
- <li>BUGFIX: Fixed issue with Cronless-Postie</li>
832
- <li>BUGFIX: There was an argument passed by reference incorrectly</li>
833
- <li>FEATURE: Added in Cronless Postie Readme</li>
834
- <li>FEATURE: Added in Postie Readme</li>
835
- </ul>
836
-
837
- <h4>0.9.5.1</h4>
838
-
839
- <ul>
840
- <li>BUGFIX: Confirmed POP3-SSL on debian-3.0</li>
841
- <li>BUGFIX: Updated the plugin version</li>
842
- <li>BUGFIX: Stopped displaying the email account</li>
843
- <li></li>
844
- </ul>
845
-
846
- <h4>0.9.5</h4>
847
-
848
- <ul>
849
- <li>BUGFIX: Postie handles cases where you do not have GD</li>
850
- <li>FEATURE: You can now set the access level for posting - so other people can use the gate way</li>
851
- <li>BUGFIX: Fixed issue when admininstrator email is not tied to a user account.</li>
852
- <li>FEATURE: Can now reset all Postie configurations back to defaults</li>
853
- <li>BUGFIX: HTML Emails with embedded images are now handled properly.</li>
854
- <li>BUGFIX: The time difference should work correctly now</li>
855
- <li>BUGFIX: Postie's configs are completely seperate from Writing-By-Mail</li>
856
- <li>FEATURE: Warning if you use Gmail to make sure you turn on POP support</li>
857
- <li>BUGFIX: Manual Check Mail Button in interface</li>
858
- <li>BUGFIX: fixed issue of compatability with cjd-notepad</li>
859
- <li>BUGFIX: Windows Works Now</li>
860
- </ul>
861
-
862
- <h4>0.9.4</h4>
863
-
864
- <ul>
865
- <li>BUGFIX: Cronless Postie - fixed the include statement</li>
866
- <li>BUGFIX: Authorized Addresses now supports a single address</li>
867
- <li>FEATURE: All configuration in Postie done in a single screen</li>
868
- <li>FEATURE: AUTHORIZATION can be completely overridden</li>
869
- <li>BUGFIX: line 1159 - didn't handle cases where the table didn't exist already very well</li>
870
- <li>FEATURE: Detects if you can do IMAP</li>
871
- <li>FEATURE: Added IMAP Support</li>
872
- <li>FEATURE: Added IMAP-SSL Support</li>
873
- <li>FEATURE: Added POP3-SSL Support</li>
874
- </ul>
875
-
876
- <h4>0.9.3</h4>
877
-
878
- <ul>
879
- <li>Bug fixes for IIS</li>
880
- </ul>
881
-
882
- <h4>0.9.2</h4>
883
-
884
- <ul>
885
- <li>Moved to more of a DIRECTORY_SEPARATOR structure </li>
886
- </ul>
887
-
888
- <h4>0.9.1</h4>
889
-
890
- <ul>
891
- <li>Added a define to fix a problem with over including</li>
892
- </ul>
893
-
894
- <h4>0.9</h4>
895
-
896
- <ul>
897
- <li>Converted to an honest to god plugin</li>
898
- <li>BUGFIX: If you put a single category:subject it now works</li>
899
- <li>BUGFIX: ? Special characters may be supported? The test post now shows a lot of umlats and accents?</li>
900
- <li>BUGFIX: The last ] in a subject with categories is now filtered out</li>
901
- <li>FEATURE: -1- subject - will put the post in category 1</li>
902
- </ul>
903
-
904
- <h4>0.312.13</h4>
905
-
906
- <ul>
907
- <li>Code clean up - The main loop is finally readable by even non programmers</li>
908
- <li>FEATURE - You can now post to multiple categories at one time by using the [#],[Category Name], [Cat] in the subject</li>
909
- <li>FEATURE - You can now select a category by just including the begining characters [G] will select General </li>
910
- <li>if you don't have any other categories that start with g</li>
911
- <li>FEATURE - Jay Talbot - added a new feature so you can have multiple email addresses be allowed in</li>
912
- <li>Make multi category posting more obvious</li>
913
- <li>BUG FIX: Timezones of GMT+? should now work properly</li>
914
- <li>BUG FIX: Able to handle mis-mime typed images as long as they are named with .jpg/.gif/.png</li>
915
- </ul>
916
-
917
- <h4>0.312.12</h4>
918
-
919
- <ul>
920
- <li>Code clean up - slowing shrinking the main to make it easiery to fix things</li>
921
- <li>FEATURE: Be able to turn on/off allowing comments in an email</li>
922
- <li>BUG FIX: AppleDouble now mostly supported </li>
923
- <li>BUG FIX: MIME handling improved.</li>
924
- <li>BUG FIX: Fix issue with timing delay</li>
925
- </ul>
926
-
927
- <h4>0.312.11</h4>
928
-
929
- <ul>
930
- <li>FEATURE: Patterns to define where a sig starts are user configurable</li>
931
- <li>FEATURE: Add filter options for banned file names</li>
932
- <li>BUG FIX: Made it possible to turn off posting to the db for testing purposes</li>
933
- </ul>
934
-
935
- <h4>0.312.10</h4>
936
-
937
- <ul>
938
- <li>FEATURE: Added in code to diplay the mime type of the file being linked to</li>
939
- <li>BUG FIX: It now tests for the existance of the directories and makes sure</li>
940
- <li>that the web server can write to them</li>
941
- </ul>
942
-
943
- <h4>0.312.9</h4>
944
-
945
- <ul>
946
- <li>FEATURE:Should handle jpg as well as jpeg as the file type</li>
947
- <li>BUG FIX: Now correctly handles the subject in the message</li>
948
- <li>BUG FIX: Should handle Text preferences correctly </li>
949
- </ul>
950
-
951
- <h4>0.312.8</h4>
952
-
953
- <ul>
954
- <li>Some general code tidying. </li>
955
- <li>FEATURE: Can now have email from invalid email addresses automatically forwared</li>
956
- <li>to the admin's email account. This forward includes all attachments. </li>
957
- <li>Props to David Luden for getting this started.</li>
958
- <li>Minor change: The system will continue if it runs into a message that doesn't have </li>
959
- <li>any content - it will also continue to process if it gets an email from </li>
960
- <li>someone not in the system. In the past this could result in deleted mail</li>
961
- <li>if your cron job didn't run often enough.</li>
962
- </ul>
963
-
964
- <h4>0.312.7</h4>
965
-
966
- <ul>
967
- <li>Confirm the handling of 3gp video for cell phones o</li>
968
- <li>Added in new directive SUPPORTED_FILE_TYPES -if the mime type is listed here then the system will try to make a link to it without making a thumb nail.</li>
969
- </ul>
970
-
971
- <h4>0.312.6</h4>
972
-
973
- <ul>
974
- <li>Bug Fix: Ok the last bug I fixed - actually caused another bug - man I should set up some unit tests. Now it handles mail from the nokia mail client correctly.</li>
975
- </ul>
976
-
977
- <h4>0.312.5</h4>
978
-
979
- <ul>
980
- <li>Bug Fix : The system was accepting all test/* types. Now you can set a preference (defaults to text/plain)</li>
981
- <li>to use as the main text for the post.</li>
982
- </ul>
983
-
984
- <h4>0.312.4</h4>
985
-
986
- <ul>
987
- <li>Added in sanitize_title call suggested by Jemima</li>
988
- <li>Added in ability to provide a subject in an mms - by using #Subject#</li>
989
- <li>Fixed an issue with the time stamp system so it now automatically uses the gmt_offset from WordPress</li>
990
- <li>Fixed issue with the delay:1d1h tag that prevented it from being removed from the body.</li>
991
- <li>Fixed issue with the delay tag that caused problems if it was the last thing before an image.</li>
992
- </ul>
993
-
994
- <h4>0.312.3-HEY (2005-05)</h4>
995
-
996
- <ul>
997
- <li>&gt; Some changes and Bugfixes by Adrian Heydecker</li>
998
- <li>&gt; Not (yet) in main development branch.</li>
999
- <li>Fixed bug: JPEG-thumbnails had a bigger filesize than full images caused by bad hardcoded compression value.</li>
1000
- <li>Fixed bug: If images and signatures were present but no placeholder tags, the images were deleted together with the signature.</li>
1001
- <li>Fixed bug: Generates valid postnames for users of mod_rewrite. Permalinks to posts should now work even when whitespaces are present in the subject line.</li>
1002
- <li>Added support for Quoted Printable encoded mail.</li>
1003
- <li>Added ability to encode Wordpress-posts in charset ISO-8859-1 instead of UTF-8.</li>
1004
- <li>Added ability to choose JPEG-compression value for thumbnails.</li>
1005
- <li>Added ability to add class="" and style="" to images.</li>
1006
- <li>Added ability to use a different mailadress (eg. mobile) without setting up a new Wordpress-account.</li>
1007
- </ul>
1008
-
1009
- <h4>0.312.2</h4>
1010
-
1011
- <ul>
1012
- <li>BUGFIX: It now removes the delay tag from the message</li>
1013
- </ul>
1014
-
1015
- <h4>0.312.1</h4>
1016
-
1017
- <ul>
1018
- <li>Added modification for placeholder support for images (David Luden)</li>
1019
- <li>Added in support to automatically scale down big images (Dirk Elmendorf)</li>
1020
- <li>Fixed bug with multiple emails all getting the contents of the first image tag (Dirk Elmendorf)</li>
1021
- <li>Added option to allow HTML in the body and subject of the email (Dirk Elmendorf)</li>
1022
- <li>Switch config options to defines to reduce the number of global variables (Dirk Elmendorf)</li>
1023
- <li>Added tests to make sure there is a trailing slash on the DIR definitions (Dirk Elmendorf)</li>
1024
- <li>Add tests to see if they have gd installed (Dirk Elmendorf)</li>
1025
- <li>Seperate the scaling out to a function for easier usage (Dirk Elmendorf)</li>
1026
- <li>Add delay feature for future posting. (Dirk Elmendorf)</li>
1027
- <li><p>Added in ability to use strtotime if it is available (Dirk ELmendorf)</p></li>
1028
- <li><p>Todo</p></li>
1029
- <li>Have option to have the email that is rejected forwarded on to another address.</li>
1030
- <li>Fix bug that id still diplays the delay tag in the body </li>
1031
- </ul>
1032
-
1033
- <h4>0.312 - 2005-03</h4>
1034
-
1035
- <ul>
1036
- <li>CHANGE FOR DEFAULT E-mail Categories, instead of [General] Subject you can now use General: Subject in the subject line. Less typing, and there must be a space after the colon. </li>
1037
- <li>Fixed bugs with no default posting for categories and user </li>
1038
- </ul>
1039
-
1040
- <h4>0.311 - 2005-01</h4>
1041
-
1042
- <ul>
1043
- <li>eep, major bug for pop3 server. Next time I test my code more before I released, fixed so that pop3 now works.`</li>
1044
- </ul>
1045
-
1046
- <h4>0.31 - 2004-12 &amp; 2005-01</h4>
1047
-
1048
- <ul>
1049
- <li>(Has it been this long, best get back into the swing of things... did most of this coding on my holiday as I didn't have a machine to play WoW on :)</li>
1050
- <li>moved the deletion of pop3 emails into a check so that e-mails aren't deleted without proper checking.</li>
1051
- <li>added HTML 'decoding' (basic support for Thunderbird &amp; Outlook) </li>
1052
- <li>updated the Category search so that it matches words as well as numbers (i.e. [General] Subjectname will work instead of just [1] Subjectname)</li>
1053
- <li>Changed time function from time to strtotime (as per Senior Pez's suggestion), but found out that strtotime isn't in default php distro so removed...</li>
1054
- </ul>
1055
-
1056
- <h4>0.3 - 2004-09</h4>
1057
-
1058
- <ul>
1059
- <li>Added UBB decoding support</li>
1060
- <li>Added default title (when there is no subject assigned)</li>
1061
- <li>Started doing a little code cleanup, been reading Advanced PHP Book :)</li>
1062
- <li></li>
1063
- </ul>
1064
-
1065
- <h4>0.2 - 2004-08</h4>
1066
-
1067
- <ul>
1068
- <li>Stopped using pear body decoding in favour of own decoding (may be slower but more modifiable) because of enriched text decoding</li>
1069
- <li>Added base64_decode checking (may help mobile phone users)</li>
1070
- <li>Fixed Subject line for non-english users (htmlentities instead of just trim)</li>
1071
- <li>Fixed error in some pop hanging -&gt; more graceful exit on event on no emails in inbox ($pop3-&gt;quit)</li>
1072
- <li>Added work around for email addresses with exta &lt;&gt; in field (ie: <a href="mailto:&#098;&#108;&#097;d&#x65;&#x40;&#x6c;&#x61;&#x6e;&#115;&#109;&#097;&#115;&#104;.&#x63;&#x6f;&#x6d;">&#098;&#108;&#097;d&#x65;&#x40;&#x6c;&#x61;&#x6e;&#115;&#109;&#097;&#115;&#104;.&#x63;&#x6f;&#x6d;</a> instead of <a href="mailto:blade@lasmash.com">blade@lasmash.com</a></li>
1073
- <li>Added some ===basic=== enriched text support</li>
1074
- <li>Updated readme file for easier install</li>
1075
- <li>Easy modify of globals (such as PHOTOSDIR and FILESDIR)</li>
1076
- <li>Cleaned up some pear stuff in install</li>
1077
- <li></li>
1078
- </ul>
1079
-
1080
- <h4>0.1 - 2004-06</h4>
1081
-
1082
- <ul>
1083
- <li>First release</li>
1084
- </ul> <hr />
1085
-
1086
- <h3>Upgrade Notice</h3>
1087
- <dl>
1088
- <dt>1.4.4</dt>
1089
- <dd>Fixed possible XSS attack vulnerability</dd>
1090
- </dl>
1091
-
1092
- <h3 id='Usage'>Usage</h3>
1093
- <ul>
1094
- <li>If you put in :start - the message processing won't start until it sees that string</li>
1095
- <li>If you put in :end - the message processing will stop once it sees that string</li>
1096
- <li>Posts can be delayed by adding a line with delayXdXhXm where X is a number.
1097
-
1098
- <ul>
1099
- <li>delay:1d - 1 day</li>
1100
- <li>delay:1h - 1 hour</li>
1101
- <li>delay:1m - 1 minute</li>
1102
- <li>delay:1d2h4m - 1 day 2 hours 4m</li>
1103
- </ul></li>
1104
- <li>By putting comments:X in your message you can control if comments are allowed
1105
-
1106
- <ul>
1107
- <li>comments:0 - means closed</li>
1108
- <li>comments:1 - means open</li>
1109
- <li>comments:2 - means registered only</li>
1110
- </ul></li>
1111
- <li>Replying to an e-mail gets posted as a comment.
1112
-
1113
- <ul>
1114
- <li>For example, you e-mailed a post with the subject line "foo".
1115
- If you then send an e-mail with the subject line "Re: foo", it will
1116
- get posted as a comment to the "foo" post. This works by the subject
1117
- line, so if you have two posts with titles "foo", then the comment
1118
- will get placed in the more recent post.</li>
1119
- </ul></li>
1120
- <li>Custom excerpt
1121
-
1122
- <ul>
1123
- <li>You can include a custom excerpt of an e-mail by putting it between
1124
- :excerptstart and :excerptend</li>
1125
- <li>You can include images in the excerpt by using the shortcode #eimg1#,
1126
- #eimg2# etc.</li>
1127
- </ul></li>
1128
- </ul>
1129
-
1130
- <h4>Category and tag handling</h4>
1131
-
1132
- <ul>
1133
- <li>If you put a category name in the subject with a : it will be used
1134
- as the category for the post</li>
1135
- <li>If you put a category id number in the subject with a : it will
1136
- be used as the category for the post</li>
1137
- <li><p>If you put the first part of a category name it will be posted in
1138
- the first category that the system finds that matches - so if you put</p>
1139
-
1140
- <p>Subject: Gen: New News</p>
1141
-
1142
- <p>The system will post that in General.</p></li>
1143
- <li><p>All of the above also applies if you put the category in brackets []</p></li>
1144
- <li><p>Using [] or you can post to multiple categories at once</p>
1145
-
1146
- <p>Subject: [1] [Mo] [Br] My Subject</p>
1147
-
1148
- <p>On my blog it would post to General (Id 1), Moblog, and Brewing all at one time</p></li>
1149
- <li><p>Using - or you can post to multiple categories at once</p>
1150
-
1151
- <p>Subject: -1- -Mo- -Br- My Subject</p>
1152
-
1153
- <p>On my blog it would post to General (Id 1), Moblog, and Brewing all at one time</p></li>
1154
- <li>You can add tags by adding a line in the body of the message like so:
1155
- tags: foo, bar</li>
1156
- <li>You can also set a default tag to be applied if no tags are included.</li>
1157
- </ul>
1158
-
1159
- <h4>Image Handling</h4>
1160
-
1161
- <ul>
1162
- <li>Allows you to attach images to your email and automatically post
1163
- them to your blog</li>
1164
- <li>You can publish images in the text of your message by using #img1#
1165
- #img2# - each one will be replaced with the HTML for the image
1166
- you attached</li>
1167
- <li><p>Captions - you can also add a caption like so:</p>
1168
-
1169
- <ul>
1170
- <li>#img1 caption='foo'#</li>
1171
- <li>#img2 caption='bar'#</li>
1172
- </ul>
1173
-
1174
- <p>Or, if you use IPTC captions, this caption will be used (adding a caption
1175
- in many photo editing programs (for example Picasa), will add an IPTC caption)</p></li>
1176
- <li><p>Image templates
1177
- Postie now uses the default wordpress image template, but you can specify a
1178
- different one if you wish.</p>
1179
-
1180
- <p>You can also specify a custom image template. I use the following custom
1181
- template:</p></li>
1182
- </ul>
1183
-
1184
- <a href='{IMAGE}'></a>{CAPTION}
1185
-
1186
- <pre><code>* {THUMBNAIL} gets replaced with the url to the thumbnail image
1187
- * {MEDIUM} gets replaced with the url to the medium-sized image
1188
- * {LARGE} gets replaced with the url to the large-sized image
1189
- * {FULL} gets replaced with the url to the full-sized image
1190
- * {FILENAME} gets replaced with the absolute path to the full-size image
1191
- * {RELFILENAME} gets replaced with the relative path to the full-size image
1192
- * {CAPTION} gets replaced with the caption you specified (if any)
1193
- * {WIDTH} gets replaced with width of the photo
1194
- * {HEIGHT} gets replaced with the height of the photo
1195
- </code></pre>
1196
-
1197
- <h4>Interoperability</h4>
1198
-
1199
- <ul>
1200
- <li>If your mail client doesn't support setting the subject (nokia) you
1201
- can do so by putting #your title here# at the begining of your message</li>
1202
- <li>POP3,POP3-SSL,IMAP,IMAP-SSL now supported - last three require
1203
- php-imap support</li>
1204
- <li>The program understands enough about mime to not duplicate post
1205
- if you send an HTML and plain text message</li>
1206
- <li>Automatically confirms that you are installed correctly</li>
1207
- </ul>
1208
- <hr />
1209
-
1210
- <h2 id='re-edit'>Re-Edit your Readme File</h2>
1211
-
1212
- <form method="post" action="">
1213
- <input type="hidden" name="text" value="1" />
1214
- <textarea rows="20" cols="100" name="readme_contents">=== Postie ===
1215
- Contributors: robfelty, WayneAllen
1216
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=HPK99BJ88V4C2
1217
- Author URI: http://allens-home.com/
1218
- Plugin URI: http://PostiePlugin.com/
1219
- Tags: e-mail, email
1220
- Requires at least: 2.8
1221
- Tested up to: 3.4.1
1222
- Stable tag: 1.4.5
1223
- License: GPLv2 or later
1224
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
1225
-
1226
- The Postie plugin allows you to blog via e-mail, including many advanced
1227
- features not found in WordPress&#039;s default post by e-mail feature.
1228
-
1229
- == Description ==
1230
- Postie offers many advanced features for posting to your blog via e-mail,
1231
- including the ability to assign categories by name, included pictures and
1232
- videos, and automatically strip off signatures. It also has support for both
1233
- imap and pop3, with the option for ssl with both. For usage notes, see the
1234
- [other notes](other_notes) page
1235
-
1236
- = What&#039;s new? =
1237
-
1238
- * 1.4.5 (upcoming)
1239
- * Fixed bug in XSS attack vulnerability code. Thanks to R Reid http://blog.strictly-software.com/2012/03/fixing-postie-plugin-for-wordpress-to.html
1240
- * Fixed bug where emails with multiple categories has the incorrect title
1241
- * Fixed bugs where PHP setting were not being changed correctly - thanks to Peter Chester http://tri.be/author/peter/
1242
- * New maintainer
1243
-
1244
- * 1.4.4 (2012.08.10)
1245
- * Fixed possible XSS attack vulnerability
1246
-
1247
- * 1.4.3 (2011.12.12)
1248
- * Removed get_user_by function to make compatible with wp 3.3 - now requires
1249
- 2.8+
1250
-
1251
- * 1.4.2 (2011.01.29)
1252
- * Fixed mailto link bug (thanks to Jason McNeil)
1253
- * Fixed bug with attachments with non-ascii characters in filename (thanks to
1254
- mtakada)
1255
- * checking for socket errors when checking mail (thanks elysian)
1256
- * fixed issue with multiple files not being inserted correctly
1257
- * Added support for ISO 8859-15 (thanks paolog)
1258
- * fixed sql injection problem (thanks Jose P. Espinal for pointing it out)
1259
-
1260
- * 1.4.1 (2010.06.18)
1261
- * Images appear in correct order when using images append = false
1262
- * Images are sorted in order of filename before inserting into post
1263
- * Fixed formatting problem with wordpress_default image template
1264
- * Captions now correctly work with wordpress &gt;3.0 and &lt;3.0
1265
- * Fixed auto_gallery feature
1266
- * Default port is now 110
1267
- * Added more configuration tests
1268
- * Added background color to settings page to make input boxes more visible
1269
- * Removed extra quote character in captions from #img# placeholders (thanks
1270
- SteelD for pointing out the error)
1271
- * Added support for big5 and gb-1232 encodings (thanks Chow)
1272
- * Fixed issue with configurations items stored as arrays, which caused
1273
- problems with validating authorized addresses
1274
- * Fixed bug with replaceImageCIDs function
1275
- * On hosts which allow it, we set max execution time to 300 seconds and
1276
- memory_limit to infinity to allow processing of large e-mails (especially
1277
- with large attachments)
1278
-
1279
- == Installation ==
1280
- * Either:
1281
- * Put the postie.zip file in wp-content/plugins/ and unzip it
1282
- * Or:
1283
- * Use the automatic installer (WP 2.7+)
1284
- * Login to WordPress as an administrator
1285
- * Goto the Plugins tab in the WordPress Admin Site
1286
- * Activate &quot;Postie&quot;
1287
- * Goto to the &quot;Settings&quot; tab and click on the sub-tab &quot;Postie&quot; to configure it.
1288
- * Make sure you enter the mailserver information correctly, including the type
1289
- of connection and the port number. Common port configurations:
1290
- * pop3: 110
1291
- * pop3-ssl: 995
1292
- * imap: 143
1293
- * imap-ssl: 993
1294
- * (Postie ignores the settings under Settings-&gt;Writing-&gt;Writing-by-Email)
1295
-
1296
- = Automating checking e-mail =
1297
-
1298
- By default, postie checks for new e-mail every 30 minutes. You can select from
1299
- a number of different checking intervals in the settings page, under the
1300
- mailserver tab.
1301
-
1302
- If you would prefer to have more fine-grained control of how postie checks
1303
- for mail, you can also set up a crontab. This is for advanced users only.
1304
- If your site runs on a UNIX/linux server, and you have shell access, you can
1305
- enable mail checking using cron; if you don&#039;t know anything about cron, skip
1306
- to the cronless postie section.
1307
-
1308
- Setup a cronjob to pull down the get\_mail.php
1309
- Examples:
1310
-
1311
- */5 * * * * /usr/bin/lynx --source http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php &gt;/dev/null 2&gt;&amp;1
1312
-
1313
- This fetches the mail every five minutes with lynx
1314
-
1315
- */10 * * * * /usr/bin/wget -O /dev/null http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php &gt;/dev/null 2&gt;&amp;1
1316
-
1317
- This fetches the mail every ten minutes with wget
1318
-
1319
- == Usage ==
1320
- * If you put in :start - the message processing won&#039;t start until it sees that string
1321
- * If you put in :end - the message processing will stop once it sees that string
1322
- * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
1323
- * delay:1d - 1 day
1324
- * delay:1h - 1 hour
1325
- * delay:1m - 1 minute
1326
- * delay:1d2h4m - 1 day 2 hours 4m
1327
- * By putting comments:X in your message you can control if comments are allowed
1328
- * comments:0 - means closed
1329
- * comments:1 - means open
1330
- * comments:2 - means registered only
1331
- * Replying to an e-mail gets posted as a comment.
1332
- * For example, you e-mailed a post with the subject line &quot;foo&quot;.
1333
- If you then send an e-mail with the subject line &quot;Re: foo&quot;, it will
1334
- get posted as a comment to the &quot;foo&quot; post. This works by the subject
1335
- line, so if you have two posts with titles &quot;foo&quot;, then the comment
1336
- will get placed in the more recent post.
1337
- * Custom excerpt
1338
- * You can include a custom excerpt of an e-mail by putting it between
1339
- :excerptstart and :excerptend
1340
- * You can include images in the excerpt by using the shortcode #eimg1#,
1341
- #eimg2# etc.
1342
-
1343
- = Category and tag handling =
1344
- * If you put a category name in the subject with a : it will be used
1345
- as the category for the post
1346
- * If you put a category id number in the subject with a : it will
1347
- be used as the category for the post
1348
- * If you put the first part of a category name it will be posted in
1349
- the first category that the system finds that matches - so if you put
1350
-
1351
- Subject: Gen: New News
1352
-
1353
- The system will post that in General.
1354
-
1355
- * All of the above also applies if you put the category in brackets []
1356
- * Using [] or you can post to multiple categories at once
1357
-
1358
- Subject: [1] [Mo] [Br] My Subject
1359
-
1360
- On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
1361
-
1362
- * Using - or you can post to multiple categories at once
1363
-
1364
- Subject: -1- -Mo- -Br- My Subject
1365
-
1366
- On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
1367
- * You can add tags by adding a line in the body of the message like so:
1368
- tags: foo, bar
1369
- * You can also set a default tag to be applied if no tags are included.
1370
-
1371
- = Image Handling =
1372
- * Allows you to attach images to your email and automatically post
1373
- them to your blog
1374
- * You can publish images in the text of your message by using #img1#
1375
- #img2# - each one will be replaced with the HTML for the image
1376
- you attached
1377
- * Captions - you can also add a caption like so:
1378
-
1379
- * #img1 caption=&#039;foo&#039;#
1380
- * #img2 caption=&#039;bar&#039;#
1381
-
1382
- Or, if you use IPTC captions, this caption will be used (adding a caption
1383
- in many photo editing programs (for example Picasa), will add an IPTC caption)
1384
-
1385
- * Image templates
1386
- Postie now uses the default wordpress image template, but you can specify a
1387
- different one if you wish.
1388
-
1389
- You can also specify a custom image template. I use the following custom
1390
- template:
1391
-
1392
- &lt;div class=&#039;imageframe alignleft&#039;&gt;&lt;a href=&#039;{IMAGE}&#039;&gt;&lt;img src=&quot;{THUMBNAIL}&quot;
1393
- alt=&quot;{CAPTION}&quot; title=&quot;{CAPTION}&quot;
1394
- class=&quot;attachment&quot; /&gt;&lt;/a&gt;&lt;div
1395
- class=&#039;imagecaption&#039;&gt;{CAPTION}&lt;/div&gt;&lt;/div&gt;
1396
-
1397
- * {THUMBNAIL} gets replaced with the url to the thumbnail image
1398
- * {MEDIUM} gets replaced with the url to the medium-sized image
1399
- * {LARGE} gets replaced with the url to the large-sized image
1400
- * {FULL} gets replaced with the url to the full-sized image
1401
- * {FILENAME} gets replaced with the absolute path to the full-size image
1402
- * {RELFILENAME} gets replaced with the relative path to the full-size image
1403
- * {CAPTION} gets replaced with the caption you specified (if any)
1404
- * {WIDTH} gets replaced with width of the photo
1405
- * {HEIGHT} gets replaced with the height of the photo
1406
-
1407
- = Interoperability =
1408
- * If your mail client doesn&#039;t support setting the subject (nokia) you
1409
- can do so by putting #your title here# at the begining of your message
1410
- * POP3,POP3-SSL,IMAP,IMAP-SSL now supported - last three require
1411
- php-imap support
1412
- * The program understands enough about mime to not duplicate post
1413
- if you send an HTML and plain text message
1414
- * Automatically confirms that you are installed correctly
1415
-
1416
- == Screenshots ==
1417
-
1418
- 1. Postie options (showing video and audio templates)
1419
-
1420
- == Frequently Asked Questions ==
1421
-
1422
- = Postie won&#039;t connect to my mailserver. Why Not? =
1423
-
1424
- Make sure the port you are using is open. For example, bluehost seems to block
1425
- ports 993 and 995 (for pop3-ssl and imap-ssl) by default. I have heard that
1426
- you can request that they open them for you ( you might have to pay extra).
1427
-
1428
- You can check for open ports with the following command on your server:
1429
- netstat -ln|grep -E &#039;:::(993|995|143)&#039;
1430
-
1431
- If nothing shows up, then the ports are not open.
1432
-
1433
- = How can I get postie to display inline images? =
1434
-
1435
- Make sure that you send e-mail formatted as html (richtext), and set postie to
1436
- prefer html messages (in the message tab of the postie settings)
1437
-
1438
- = Mail is not showing up right when I send html (rich formatted) e-mail! =
1439
-
1440
- Make sure you set the preferred text type to html
1441
-
1442
- = Do I need to any code to my theme for postie to work? =
1443
-
1444
- No.
1445
-
1446
- = I read somewhere to add an iframe to my footer. Should I do this? =
1447
-
1448
- No. Do not add an iframe in your footer to get postie to check mail
1449
- periodically. To check e-mail periodically, either set-up a cron job, or use
1450
- cronless postie. See installation instructions
1451
-
1452
- = My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl =
1453
-
1454
- You must have php-imap installed on your server for this to work. Ask your
1455
- hosting provider about this.
1456
-
1457
- = Can I use postie to check a gmail account? =
1458
-
1459
- Yes. You can use either pop3-ssl or imap-ssl with a gmail account. Before
1460
- attempting to use with postie, make sure that you enable pop or imap in your
1461
- gmail preferences.
1462
-
1463
- * Pop3 settings:
1464
- * protocol - pop3-ssl
1465
- * server - pop.gmail.com
1466
- * port - 995
1467
- * userid - your username (e.g. if your e-mail address is foo@gmail.com,
1468
- this would be just foo)
1469
- * password - your password
1470
- * IMAP settings:
1471
- * protocol - imap-ssl
1472
- * server - imap.gmail.com
1473
- * port - 993
1474
- * userid - your username (e.g. if your e-mail address is foo@gmail.com,
1475
- this would be just foo)
1476
- * password - your password
1477
-
1478
- = My posts show up as being posted by &#039;admin&#039; instead of me. Why? =
1479
-
1480
- If your admin account is linked to bar@gmail.com, and you send mail from
1481
- bar@gmail.com, it will show up as being posted by admin. If you have a
1482
- wordpress user named &quot;John Doe&quot;, which is linked to johndoe@gmail.com, make
1483
- sure that you send e-mails from johndoe@gmail.com. It doesn&#039;t matter which
1484
- e-mail address postie is checking. That is, if you send mail from
1485
- johndoe@gmail.com to foo@gmail.com, it gets posted as &quot;John Doe&quot;.
1486
-
1487
- If you send an e-mail to your postie address from an e-mail address that is no
1488
- t linked to a wordpress user, it will get posted as admin.
1489
-
1490
- = Images aren&#039;t showing up at all? =
1491
-
1492
- There are a couple possible reasons for this. First, check to see if you can
1493
- add an image through wordpress&#039;s normal posting mechanism. If not, then there
1494
- is probably 1 or 2 problems:
1495
- 1. Your server does not have the php-gd library installed. Ask your hosting
1496
- provider about this.
1497
-
1498
- 2. Your wp-content/uploads directory is not writable by the webserver. Make
1499
- sure that it is
1500
-
1501
- = Can I delete the wp-files directory needed by postie version &lt;1.3.0? =
1502
-
1503
- If you have posts published already by older versions of postie, getting rid
1504
- of those directories will delete any files you might have had associated with
1505
- those old posts. If you don&#039;t have any such posts, then you can safely delete
1506
- them.
1507
-
1508
- = How can I get rid of stupid stuff my e-mail provider adds to my messages? =
1509
-
1510
- To strip off stuff that they add at the beginning of a message, start your
1511
- post with :start
1512
-
1513
- To strip off stuff that they add at the end of a message, end your
1514
- post with :end
1515
-
1516
- = How can I add custom attachment icons? =
1517
-
1518
- Simply upload the icons you want to the postie/icons/custom directory. You
1519
- must name the icons according to the following scheme:
1520
- {filetype}-{size}.png
1521
-
1522
- For example, for word documents, you could use:
1523
-
1524
- `doc-32.png`
1525
-
1526
- for a 32x32 pixel icon. (You can actually create any size icon you want, but
1527
- if you name it 32, then it will only be used if you select to use size 32
1528
- icons)
1529
-
1530
- See the other directories in icons for more examples.
1531
-
1532
- Currently the following filetypes are supported:
1533
-
1534
- * doc - microsoft word (including docx)
1535
- * ppt - microsoft powerpoint (including pptx)
1536
- * xls - microsoft excel (including xlsx)
1537
- * numbers - iWork numbres spreadsheet
1538
- * pages - iWork pages document
1539
- * key - iWork keynote presentation
1540
- * pdf - portable document format
1541
- * rtf - rich text format
1542
- * txt - plain text document
1543
-
1544
- = Can I add special text to the body of the post when using postie? =
1545
-
1546
- Yes. You can create your own function, and use the postie_post filter.
1547
- Two short examples are included in the filterPostie.php.sample file
1548
-
1549
- = Can I add special text to the title of the post when using postie? =
1550
-
1551
- Yes. You can create your own function, and use the postie_post filter.
1552
- Two short examples are included in the filterPostie.php.sample file
1553
-
1554
- = Can I select tags or categories based on the content of the e-mail? =
1555
-
1556
- Yes. You can create your own function, and use the postie_post filter.
1557
- See the filterPostie.php.sample file for examples.
1558
-
1559
- = Is the IMAP extension required for postie? =
1560
-
1561
- The IMAP extension is not required, but it is strongly recommended, especially
1562
- is you are using non-English text. There is more information on php.net about
1563
- installing the IMAP extension. If you have control over your server, it is
1564
- often not hard to install.
1565
-
1566
- On Ubuntu, try
1567
- sudo apt-get install php5-imap
1568
-
1569
- On Fedora, try
1570
- sudo yuminstall php-imap
1571
-
1572
- The IMAP extension is known to be installed on the following popular webhosts:
1573
- * Dreamhost
1574
-
1575
- = How can I embed youtube or vimeo videos? =
1576
-
1577
- Simply put the url in the body of your e-mail. (Make sure that you have the
1578
- option to convert url into links turned on)
1579
-
1580
- == CHANGELOG ==
1581
-
1582
- = 1.4.5 =
1583
- * TODO - fix corruption of rtf attachments
1584
- * TODO - add port checking in tests
1585
- * TODO - non-image uploads get ignored in content when using autogallery - see
1586
- replaceimageplaceholders
1587
-
1588
- = 1.4.4 (2012.08.10) =
1589
- * Fixed possible XSS attack vulnerability
1590
-
1591
- = 1.4.3 =
1592
- * Removed get_user_by function to make compatible with wp 3.3 - now requires
1593
- 2.8+
1594
-
1595
- = 1.4.2 (2011.01.29) =
1596
- * Fixed mailto link bug (thanks to Jason McNeil)
1597
- * Fixed bug with attachments with non-ascii characters in filename (thanks to
1598
- mtakada)
1599
- * checking for socket errors when checking mail (thanks elysian)
1600
- * fixed issue with multiple files not being inserted correctly
1601
- * Added support for ISO 8859-15 (thanks paolog)
1602
- * fixed sql injection problem (thanks Jose P. Espinal for pointing it out)
1603
- * Fixed namespace clashing for get_config function
1604
-
1605
- = 1.4.1 (2010.06.18) =
1606
- * Images appear in correct order when using images append = false
1607
- * Fixed formatting problem with wordpress_default image template
1608
- * Captions now correctly work with wordpress &gt;3.0 and &lt;3.0
1609
- * Fixed auto_gallery feature
1610
- * Default port is now 110
1611
- * Added more configuration tests
1612
- * Added background color to settings page to make input boxes more visible
1613
- * Removed extra quote character in captions from #img# placeholders (thanks
1614
- SteelD for pointing out the error)
1615
- * Added support for big5 and gb-1232 encodings (thanks Chow)
1616
- * Fixed issue with configurations items stored as arrays, which caused
1617
- problems with validating authorized addresses
1618
- * Fixed bug with replaceImageCIDs function
1619
- * On hosts which allow it, we set max execution time to 300 seconds and
1620
- memory_limit to infinity to allow processing of large e-mails (especially
1621
- with large attachments)
1622
- * Images are sorted in order of filename before inserting into post
1623
-
1624
- = 1.4 (2010.04.25) =
1625
- * Now using wordpress settings api (thanks for much help from Andrew S)
1626
- * Cronless postie is now integrated with postie instead of a separate plugin
1627
- * filterPostie.php moved to filterPostie.php.sample
1628
- * Can use fetchmails.php to fetch mail from multiple mailboxes
1629
- * Fixed problem with embedding youtube videos from html (richtext) e-mail
1630
- * Added support for embedding vimeo vidoes
1631
- * Fixed problem with selecting &quot;none&quot; as icon set for attachments (thanks
1632
- tonyvitali)
1633
- * Fixed problems with cronless postie settings
1634
- * Fixed bug with embedding youtube and vimeo videos whose ID contains a -
1635
- (thanks Jim Kehoe)
1636
- * Post_author is now included with attachments
1637
- * fixed confirmation_email settings so that now you can select between sender,
1638
- admin, both, or none (thanks to redsalmon for pointing out bug)
1639
- * Added option to automatically insert galleries
1640
- * Updated FAQ and readme
1641
-
1642
- = 1.3.4 (2009.10.05) =
1643
- * Fixed problem with images not posting under cron
1644
- * Fixed issue with disappearing password
1645
-
1646
- = 1.3.3 (2009.09.11) =
1647
- * Fixed problem with double titles
1648
- * Fixed error in wp-mu
1649
- * Cronless postie now correctly updates when changing the setting in the
1650
- postie settings
1651
- * Small fix in handling of names of attachments (thanks to Teejot)
1652
- * Fixed delay option (thanks to redbrandonk)
1653
- * Cronless option value is now correctly deleted when deactivating the
1654
- cronless postie plugin
1655
-
1656
- = 1.3.2 (2009.08.27) =
1657
- * tags are now always an array, even if no default tags are set
1658
- * Subject is showing up again if you do not have the IMAP extension
1659
- installed
1660
- * More information on the IMAP extension and more user-friendly
1661
- installation
1662
- * Fixed problems with smtp server settings in 1.3.1
1663
- * Added russian translation (thanks to fatcow.com)
1664
-
1665
- = 1.3.1 (2009.08.24) =
1666
- * Changed GetContent filter to postie_post
1667
- * Added database upgrade hook on activation
1668
- * Fixed bug where content would be empty if trying to remove signature,
1669
- and signature list was emtpy
1670
- * Updated FAQ and readme
1671
-
1672
- = 1.3.0 (2009.08.14) =
1673
- * Features
1674
- * Added mpeg4 to default list of videotypes
1675
- * Added support for KOI8-R character set (cyrillic)
1676
- * Added support for iso-8859-2 character set (eastern european)
1677
- * Added option to include custom icons for attachments
1678
- * Added option to send confirmation message to sender
1679
- * Enhanced e-mails for unauthorized users
1680
- * Added option to send unauthorized e-mail back to sender
1681
- * Added option to only allow e-mails from a specified list of smtp
1682
- servers
1683
- * Added option to use shortcode for embedding videos (works with the
1684
- videos plugin http://www.daburna.de/download/videos-plugin.zip
1685
- * Better handling of comment authors (thanks to Petter for suggestion)
1686
- * Simplified message options (now includes an advanced options section)
1687
- * Added filter ability for post content
1688
- * Bug fixes
1689
- * No longer including wp-config.php
1690
- * If tmpdir is not writable, try a different tmpdir
1691
- * More subject encoding fixes
1692
- * Updated image templates, which were causing problems for cron
1693
- * Fixed in text captions
1694
- * Fixed SQL problems when updating options
1695
- * Fixed name clashes with other plugins
1696
- * Fixed custom image field
1697
-
1698
- = 1.3.beta (2009.07.01) =
1699
- * Mores fixes for character issues in subject
1700
- * Now handling Windows-1256 (arabic) character set
1701
- * Fixed image uploading on windows servers
1702
- * Fixed replying to message adds comment
1703
- * Uploading pictures via MMS should now work
1704
- * Fixed some issues with e-mails from outloook 12
1705
- * Greatly reduced number of database queries
1706
- * No longer requiring config_handler.php
1707
-
1708
- = 1.3.alpha (2009.06.05) =
1709
- * Now using default wordpress image and upload handling, which means:
1710
- * No more creating special directories for postie
1711
- * No more confusion about imagemagick
1712
- * Can now use the [gallery] feature of wordpress
1713
- * Attachments are now connected to posts in the database
1714
- * All image resizing uses wordpress&#039;s default settings (under media)
1715
- * Configuration, settings and documentation improvements
1716
- * Completely redesigned settings page (mostly thanks to Rainman)
1717
- * Reset configuration no longer deletes mailserver settings
1718
- * Now including help files and faq directly in settings page
1719
- * More media features
1720
- * Automatically turn links to youtube into an embedded player
1721
- * Added option to embed audio files with custom templates
1722
- * Video options are now template based
1723
- * Image options are now solely template based, with several new default
1724
- templates
1725
- * Bug fixes
1726
- * Uploading images from vodafone phones should now work
1727
- * Correctly handling Windows-1252 encoding
1728
- * Correctly handling non-ascii characters in subject line
1729
-
1730
- = 1.2.3 (2009.05.17) =
1731
- * Fixed headers already sent bug
1732
- * Converted shortcode `&lt;?` to proper `&lt;?php` (thanks brack)
1733
- * Deleting mails after processing again
1734
-
1735
- = 1.2.2 (2009.05.15) =
1736
- * Show empty categories for default category in options
1737
- * Image scaling fixed so that the smaller value of max image width and max
1738
- image height is used
1739
- * Fixed some issues with parsing html e-mail
1740
- * Got rid of stupid mime tag (thanks Jeroen)
1741
- * No longer adding slashes before calling wp_insert_post
1742
- * When using custom image field, each image has a unique key
1743
-
1744
-
1745
- = 1.2.1 (2009.05.07) =
1746
- * Got rid of stupid version checking
1747
- * Improved cronless postie instructions and configuration
1748
- * Internationalization is working now
1749
- * Dutch localization (thanks to gvmelle http://gvmelle.com)
1750
- * Fixed caption bug when using image magick
1751
- * Added option to not filter new lines (when using markdown syntax)
1752
- * Fixed autoplay option
1753
- * Can now use wildcards in excluding filenames
1754
- * Producing better quality thumbnails (thanks to robcarey)
1755
-
1756
- = 1.2 (2009.04.22) =
1757
- * More video options:
1758
- * Can embed 3gp, mp4, mov videos
1759
- * Can specify video width, video height, player width, and player height
1760
- in the settings page
1761
- * Can specify custom image template
1762
- * Image handling improvements:
1763
- * Only downscale images, not up-scale (thanks Jarven)
1764
- * More custom image template options
1765
- * IPTC captions now also work when not resizing images
1766
- * Added option to use custom field for images (for Datapusher)
1767
- * Fixed some issues with image templates and line break handling
1768
- * Custom image template now works even when not resizing images
1769
- * Documentation improvements:
1770
- * Added links to settings, forum, and readme in plugin description
1771
- * Updated readme (thanks to Venkatraman Dhamodaran)
1772
- * Added better instructions on how to use cronless postie
1773
- * Text processing improvements:
1774
- * Added option to automatically convert urls into links
1775
- * Added feature to include a custom excerpt
1776
- * Miscellaneous improvements
1777
- * Improved internationalization (thanks to Håvard Broberg
1778
- (nanablag@nanablag.com))
1779
- * Bug Fixes
1780
- * Removed debugging info in get_mail.php (security issue) thanks to
1781
- [Jens]( http://svalgaard.net/jens/)
1782
- * No longer directly including pluggable.php (should
1783
- prevent conflicts with other plugins such as registerplus
1784
-
1785
-
1786
- = 1.1.5 (2009.03.10) =
1787
- * Added option to have postie posts be pending review, published, or draft
1788
- * Settings panel only shows up for administrators
1789
- * Need not be user &quot;admin&quot; to modify settings or to post from non-registered
1790
- users
1791
- * Can now set administrator name. Authorized e-mail addresses which don&#039;t
1792
- have a user get posted under this name
1793
- * Will use IPTC captions if available
1794
- * Added option to replace newline characters with &lt;br /&gt;
1795
-
1796
- = 1.1.4 (2009.03.06) =
1797
- * Added more image options (open in new window, custom image template)
1798
- * can now add captions to images
1799
- * Can now add tags (including default tag option)
1800
-
1801
- = 1.1.3 (2009.02.20) =
1802
- * Fixed delayed posting
1803
- * updated readme some
1804
-
1805
- = 1.1.2 (2008.07.12) =
1806
- * now maintained by Robert Felty
1807
- * allow negative delays
1808
- * will glean author information from forwarded or redirected e*mails
1809
- * replying to an e*mail adds a comment to a post
1810
- * fixed category handling to work with taxonomy
1811
- * fixed one syntax error
1812
- * added option to wrap posts and comments in &lt;pre%gt; tags
1813
-
1814
-
1815
- = 1.1.1 =
1816
-
1817
- Below is all the of the version information. As far as I can tell there once was a guy named John Blade. He took some of the original wp-mail.php code
1818
- and started hacking away on it. He actually got pretty far. About the time I discovered WordPress and his little hack - called WP-Mail at the time - he
1819
- went on a vacation or something. There were some problems with the script, and it was missing some features I wanted. I hacked away at it and got it
1820
- into a place where it did what I wanted. I started posting about it since I figured other people might want the features.
1821
-
1822
- John didn&#039;t release any more versions at least up til July 2005. So I started accepting submissions and feature requests from people to help make the
1823
- code better. In June/July 2005 I discovered a little plugin by Chris J Davis (http://www.chrisjdavis.org/cjd-notepad/) called notepad. I added a small
1824
- feature to it (basically a bookmarklet). In the process I started looking at his code and realized how much you could do with the plugin system
1825
- available in Word Press.
1826
-
1827
- So I decided to make an offical fork. I put up an article on my blog asking for new names. I picked Postie. I then modified the code to be a proper
1828
- plugin. And the rest is history :)
1829
-
1830
- * BUGFIX -problem with subject
1831
- * BUGFIX -cronless postie typo
1832
-
1833
- = 1.1 =
1834
- * FEATURE: Updated and tested with WordPress 2.1
1835
- * BUGFIX:Removed deprecated functions
1836
- * FEATURE: Cronless Postie now uses the WordPress native Psuedo Cron.
1837
-
1838
- = 1.0 =
1839
- * BUGFIX: TestWPVersion broke with 2.1
1840
- * FEATURE: end: now marks the end of a message (Dan Cunningham)
1841
- * FEATURE: Better Readme (Michael Rasmussen)
1842
- * FEATURE: Smart Sharpen Option -EXPERIMENTAL- (Jonas Rhodin)
1843
- * BUGFIX: Issue with google imap fixed (Jim Hodgson)
1844
- * BUGFIX: Fixed espacing issue in subjects (Paul Clip)
1845
- * BUGFIX: Typo in Div fixed (phil)
1846
-
1847
- = 0.9.9.3.2 =
1848
- * BUGFIX: Typo
1849
- = 0.9.9.3.1 =
1850
- * BUGFIX: Removed debugging code
1851
-
1852
- = 0.9.9.3 =
1853
- * BUGFIX: If your email address matches an existing user - then it will post as that user - even if you allow anyone to post.
1854
- * BUGFIX: Replaced get_settings(&#039;home&#039;) with get_settings(&#039;siteurl&#039;)
1855
- * BUGFIX: Better handling for Japanese charactersets - Thanks to http://www.souzouzone.jp/blog/archives/009531.html
1856
- * BUGFIX: Better thumbnail window opening code - thanks to Gabi &amp; Duntello!
1857
- * FEATURE: Added an option to set the MAX Height of an image - idea from Duntello
1858
- * BUGFIX: Modified the FilterNewLines for better flowed text handling - You now HAVE TO PUT TWO NEW LINES to end a paragraph.
1859
- * FEATURE: Added new CSS tags to support positioning images/attachments/3gp videos
1860
- * BUGFIX: Tries to use the date in the message (Thanks Ravan) I tried this once before and it never worked - hopefully this time it will.
1861
- * BUGFIX: Added a workaround to fix the problem with Subscribe2 - it will now notify on posts that are not set to show up in the future.
1862
-
1863
-
1864
-
1865
- = 0.9.9.2 =
1866
- * BUGFIX: Looks for the NOOP error and disgards it
1867
- * FEATURE: Postie now detects the version of WordPress being used
1868
- * FEATURE: Smarter Parsing of VodaPhone
1869
- * FEATURE: Easy place to add new code to handle other brain-dead mail clients
1870
- * BUGFIX: Handles insertion of single quotes properly
1871
- * BUGFIX: Thumbnails should now link properly
1872
-
1873
- = 0.9.9.1 =
1874
- * BUGFIX: Needed a strtolower in places to catch all iso-8859 - thx to Gitte Wange for the catch
1875
- * BUGFIX: Fixed issue with the category not being posted properly
1876
-
1877
- = 0.9.9 =
1878
- * UPDATE TO WP 2.0
1879
- * BUGFIX: Config Page now works
1880
- * FEATURES: Supports role based posting
1881
- * BUGFIX: Posting updates the category counts.
1882
-
1883
- = 0.9.8.6 =
1884
- * BUGFIX: Fixed problems with config page &lt;%php became &lt;?php
1885
- *
1886
- = 0.9.8.5 =
1887
- * BUGFIX: onClick changed to onclick
1888
- * BUGFIX: strolower added to test for iso - thanks daniele
1889
- * BUGFIX: Added a class to the 3gp video tags
1890
- * FEATURE: Added the option to put the images before the article
1891
- * BUGFIX: Added in selection for charsets - thanks Psykotik - this may cause problems for other encodings
1892
- * FEATURE: Added option to turn of quoted printable decoding
1893
- * FEATURE: :start tag - now postie looks for this tag before looking for you message - handy if your service provider prepends a message
1894
- * FEATURE: Template for translation now included
1895
- = 0.9.8.4 =
1896
- * BUGFIX: Fixed problem with config_form.php - select had &quot;NULL&quot; instead of &quot;&quot;
1897
- * BUGFIX: 3g2 now supported
1898
- * BUGFIX: More line break issues addressed
1899
- * BUGFIX: QuickTime controls are now visible even if the movie is done playing
1900
- * BUGFIX: Email addresses in the format &lt;some@domain.com&gt; (Full Name) supported
1901
- * BUGFIX: Some images that were not being resized - are now
1902
- * BUGFIX: HTML problems - if you posted plain text with HTML on it ignored all images
1903
- * BUGFIX: The test system blew up on the thumbnails
1904
- * BUGFIX: Selected HTML for preferred text is now shown in the config form properly
1905
- * BUGFIX: Postie now complains if it is not in its own directory
1906
- * BUGFIX: Postie doesn&#039;t include PEAR if it is already available
1907
- * BUGFIX: In Test mode rejected emails are simply dropped
1908
- * BUGFIX: Markdown messes up Postie - it will warn you if you turn it on.
1909
- *
1910
- = 0.9.8.3 =
1911
- * BUGFIX: Fixed issue with the line feed replacement
1912
- * BUGFIX: Added Banned File Config back in
1913
- * FEATURE: Added in a link around 3gp video embedded via QT
1914
- * BUGFIX: Email that has both Plain and HTML content will show the HTML content and not the plain if html is preferred
1915
-
1916
- = 0.9.8.2 =
1917
- * BUGFIX: Fixed an extra new line after attachin non-image files.
1918
- * BUGFIX: The Test system now displays any missing gd functions
1919
- * BUGFIX: The test system was only using ImageMagick
1920
-
1921
- = 0.9.8.1 =
1922
- * BUGFIX: The test images are now included in the zip
1923
-
1924
- = 0.9.8 =
1925
- * BUGFIX: New Lines detected and handled properly in cases where the mail client doesn&#039;t put a space before the new line (Miss Distance)
1926
- * BUGFIX: 3gp mime type added (Paco Cotera)
1927
- * BUGFIX: Authorized Email Addresses are not case-insensitive
1928
- * FEATURE: The larger image now does a proper pop up
1929
- * BUGFIX: Fixed Timeing Issue - turns out it wasn&#039;t reading the db at all
1930
- * FEATURE: New Test Screen - to help track down problems
1931
-
1932
- = 0.9.7 =
1933
- * BUGFIX: removed all short tags
1934
- * BUGFIX: There were spacing issues in the way I wrote the QT embed statements
1935
- * FEATURE: Added calls to WP-Cron - should work with that properly now if you activate Cronless Postie
1936
- * FEATURE: ImageMagick version works without any calls to GD
1937
- * BUGFIX: Postie now correctly handles cases wjere tjere are multiple blogs in one db
1938
- * BUGFIX: Turned off warnings when using without GD
1939
- * FEATURE: add the rotate:X to your message to rotate all images
1940
- * FEATURE: new filter_postie_thumbnail_with_full which makes it easy to show a thumbnail on the front page but full image on the single page - see FAQ
1941
-
1942
- = 0.9.6 =
1943
- * BUGFIX: handles email addresses that are no name and just &lt;email@email.com&gt; (Steve Cooley Reported)
1944
- * FEATURE: Basic support for embedding flash files
1945
- * BUGFIX: Postie now handles creating the correct URL on non Unix platforms
1946
- * BUGFIX: Fixed problem with file attachments not being put in the right place.
1947
- * FEATURE: You can now choose to use imagemagick convert to handle making thumbnails
1948
- * BUGFIX: Rewrote Cronless Postie to use direct sockets
1949
- * BUGFIX: Time offset is now settable just for Postie - hopefully this will fix problems for cases where the normal time offset doesn&#039;t work properly.
1950
- * FEATURE: First draft of frame for a 3GP video
1951
- * FEATURE: Option to embed 3GP in QuickTime Controller.
1952
-
1953
- = 0.9.5.2 =
1954
- * BUGFIX: gmt varialble not being set correctly
1955
- * BUGFIX: Changed the name of the Check Mail button to fix an issue with mod_security
1956
- * BUGFIX: Fixed issue with Cronless-Postie
1957
- * BUGFIX: There was an argument passed by reference incorrectly
1958
- * FEATURE: Added in Cronless Postie Readme
1959
- * FEATURE: Added in Postie Readme
1960
-
1961
- = 0.9.5.1 =
1962
- * BUGFIX: Confirmed POP3-SSL on debian-3.0
1963
- * BUGFIX: Updated the plugin version
1964
- * BUGFIX: Stopped displaying the email account
1965
- *
1966
- = 0.9.5 =
1967
- * BUGFIX: Postie handles cases where you do not have GD
1968
- * FEATURE: You can now set the access level for posting - so other people can use the gate way
1969
- * BUGFIX: Fixed issue when admininstrator email is not tied to a user account.
1970
- * FEATURE: Can now reset all Postie configurations back to defaults
1971
- * BUGFIX: HTML Emails with embedded images are now handled properly.
1972
- * BUGFIX: The time difference should work correctly now
1973
- * BUGFIX: Postie&#039;s configs are completely seperate from Writing-By-Mail
1974
- * FEATURE: Warning if you use Gmail to make sure you turn on POP support
1975
- * BUGFIX: Manual Check Mail Button in interface
1976
- * BUGFIX: fixed issue of compatability with cjd-notepad
1977
- * BUGFIX: Windows Works Now
1978
-
1979
-
1980
- = 0.9.4 =
1981
- * BUGFIX: Cronless Postie - fixed the include statement
1982
- * BUGFIX: Authorized Addresses now supports a single address
1983
- * FEATURE: All configuration in Postie done in a single screen
1984
- * FEATURE: AUTHORIZATION can be completely overridden
1985
- * BUGFIX: line 1159 - didn&#039;t handle cases where the table didn&#039;t exist already very well
1986
- * FEATURE: Detects if you can do IMAP
1987
- * FEATURE: Added IMAP Support
1988
- * FEATURE: Added IMAP-SSL Support
1989
- * FEATURE: Added POP3-SSL Support
1990
-
1991
- = 0.9.3 =
1992
- * Bug fixes for IIS
1993
- = 0.9.2 =
1994
- * Moved to more of a DIRECTORY_SEPARATOR structure
1995
- = 0.9.1 =
1996
- * Added a define to fix a problem with over including
1997
- = 0.9 =
1998
- * Converted to an honest to god plugin
1999
- * BUGFIX: If you put a single category:subject it now works
2000
- * BUGFIX: ? Special characters may be supported? The test post now shows a lot of umlats and accents?
2001
- * BUGFIX: The last ] in a subject with categories is now filtered out
2002
- * FEATURE: -1- subject - will put the post in category 1
2003
- = 0.312.13 =
2004
- * Code clean up - The main loop is finally readable by even non programmers
2005
- * FEATURE - You can now post to multiple categories at one time by using the [#],[Category Name], [Cat] in the subject
2006
- * FEATURE - You can now select a category by just including the begining characters [G] will select General
2007
- * if you don&#039;t have any other categories that start with g
2008
- * FEATURE - Jay Talbot - added a new feature so you can have multiple email addresses be allowed in
2009
- * Make multi category posting more obvious
2010
- * BUG FIX: Timezones of GMT+? should now work properly
2011
- * BUG FIX: Able to handle mis-mime typed images as long as they are named with .jpg/.gif/.png
2012
-
2013
- = 0.312.12 =
2014
- * Code clean up - slowing shrinking the main to make it easiery to fix things
2015
- * FEATURE: Be able to turn on/off allowing comments in an email
2016
- * BUG FIX: AppleDouble now mostly supported
2017
- * BUG FIX: MIME handling improved.
2018
- * BUG FIX: Fix issue with timing delay
2019
- = 0.312.11 =
2020
- * FEATURE: Patterns to define where a sig starts are user configurable
2021
- * FEATURE: Add filter options for banned file names
2022
- * BUG FIX: Made it possible to turn off posting to the db for testing purposes
2023
- = 0.312.10 =
2024
- * FEATURE: Added in code to diplay the mime type of the file being linked to
2025
- * BUG FIX: It now tests for the existance of the directories and makes sure
2026
- * that the web server can write to them
2027
- = 0.312.9 =
2028
- * FEATURE:Should handle jpg as well as jpeg as the file type
2029
- * BUG FIX: Now correctly handles the subject in the message
2030
- * BUG FIX: Should handle Text preferences correctly
2031
- = 0.312.8 =
2032
- * Some general code tidying.
2033
- * FEATURE: Can now have email from invalid email addresses automatically forwared
2034
- * to the admin&#039;s email account. This forward includes all attachments.
2035
- * Props to David Luden for getting this started.
2036
- * Minor change: The system will continue if it runs into a message that doesn&#039;t have
2037
- * any content - it will also continue to process if it gets an email from
2038
- * someone not in the system. In the past this could result in deleted mail
2039
- * if your cron job didn&#039;t run often enough.
2040
- = 0.312.7 =
2041
- * Confirm the handling of 3gp video for cell phones o
2042
- * Added in new directive SUPPORTED_FILE_TYPES -if the mime type is listed here then the system will try to make a link to it without making a thumb nail.
2043
- = 0.312.6 =
2044
- * Bug Fix: Ok the last bug I fixed - actually caused another bug - man I should set up some unit tests. Now it handles mail from the nokia mail client correctly.
2045
- = 0.312.5 =
2046
- * Bug Fix : The system was accepting all test/* types. Now you can set a preference (defaults to text/plain)
2047
- * to use as the main text for the post.
2048
- = 0.312.4 =
2049
- * Added in sanitize_title call suggested by Jemima
2050
- * Added in ability to provide a subject in an mms - by using #Subject#
2051
- * Fixed an issue with the time stamp system so it now automatically uses the gmt_offset from WordPress
2052
- * Fixed issue with the delay:1d1h tag that prevented it from being removed from the body.
2053
- * Fixed issue with the delay tag that caused problems if it was the last thing before an image.
2054
-
2055
- = 0.312.3-HEY (2005-05) =
2056
- * &gt; Some changes and Bugfixes by Adrian Heydecker
2057
- * &gt; Not (yet) in main development branch.
2058
- * Fixed bug: JPEG-thumbnails had a bigger filesize than full images caused by bad hardcoded compression value.
2059
- * Fixed bug: If images and signatures were present but no placeholder tags, the images were deleted together with the signature.
2060
- * Fixed bug: Generates valid postnames for users of mod_rewrite. Permalinks to posts should now work even when whitespaces are present in the subject line.
2061
- * Added support for Quoted Printable encoded mail.
2062
- * Added ability to encode Wordpress-posts in charset ISO-8859-1 instead of UTF-8.
2063
- * Added ability to choose JPEG-compression value for thumbnails.
2064
- * Added ability to add class=&quot;&quot; and style=&quot;&quot; to images.
2065
- * Added ability to use a different mailadress (eg. mobile) without setting up a new Wordpress-account.
2066
-
2067
- = 0.312.2 =
2068
- * BUGFIX: It now removes the delay tag from the message
2069
- = 0.312.1 =
2070
- * Added modification for placeholder support for images (David Luden)
2071
- * Added in support to automatically scale down big images (Dirk Elmendorf)
2072
- * Fixed bug with multiple emails all getting the contents of the first image tag (Dirk Elmendorf)
2073
- * Added option to allow HTML in the body and subject of the email (Dirk Elmendorf)
2074
- * Switch config options to defines to reduce the number of global variables (Dirk Elmendorf)
2075
- * Added tests to make sure there is a trailing slash on the DIR definitions (Dirk Elmendorf)
2076
- * Add tests to see if they have gd installed (Dirk Elmendorf)
2077
- * Seperate the scaling out to a function for easier usage (Dirk Elmendorf)
2078
- * Add delay feature for future posting. (Dirk Elmendorf)
2079
- * Added in ability to use strtotime if it is available (Dirk ELmendorf)
2080
-
2081
- * Todo
2082
- * Have option to have the email that is rejected forwarded on to another address.
2083
- * Fix bug that id still diplays the delay tag in the body
2084
- = 0.312 - 2005-03 =
2085
- * CHANGE FOR DEFAULT E-mail Categories, instead of [General] Subject you can now use General: Subject in the subject line. Less typing, and there must be a space after the colon.
2086
- * Fixed bugs with no default posting for categories and user
2087
- = 0.311 - 2005-01 =
2088
- * eep, major bug for pop3 server. Next time I test my code more before I released, fixed so that pop3 now works.`
2089
- = 0.31 - 2004-12 &amp; 2005-01 =
2090
- * (Has it been this long, best get back into the swing of things... did most of this coding on my holiday as I didn&#039;t have a machine to play WoW on :)
2091
- * moved the deletion of pop3 emails into a check so that e-mails aren&#039;t deleted without proper checking.
2092
- * added HTML &#039;decoding&#039; (basic support for Thunderbird &amp; Outlook)
2093
- * updated the Category search so that it matches words as well as numbers (i.e. [General] Subjectname will work instead of just [1] Subjectname)
2094
- * Changed time function from time to strtotime (as per Senior Pez&#039;s suggestion), but found out that strtotime isn&#039;t in default php distro so removed...
2095
-
2096
- = 0.3 - 2004-09 =
2097
- * Added UBB decoding support
2098
- * Added default title (when there is no subject assigned)
2099
- * Started doing a little code cleanup, been reading Advanced PHP Book :)
2100
- *
2101
- = 0.2 - 2004-08 =
2102
- * Stopped using pear body decoding in favour of own decoding (may be slower but more modifiable) because of enriched text decoding
2103
- * Added base64_decode checking (may help mobile phone users)
2104
- * Fixed Subject line for non-english users (htmlentities instead of just trim)
2105
- * Fixed error in some pop hanging -&gt; more graceful exit on event on no emails in inbox ($pop3-&gt;quit)
2106
- * Added work around for email addresses with exta &lt;&gt; in field (ie: &lt;blade@lansmash.com&gt; instead of blade@lasmash.com
2107
- * Added some ===basic=== enriched text support
2108
- * Updated readme file for easier install
2109
- * Easy modify of globals (such as PHOTOSDIR and FILESDIR)
2110
- * Cleaned up some pear stuff in install
2111
- *
2112
- = 0.1 - 2004-06 =
2113
- * First release
2114
-
2115
- == Upgrade Notice ==
2116
-
2117
- = 1.4.4 =
2118
- Fixed possible XSS attack vulnerability</textarea>
2119
- <p><input type="submit" value="Validate!" /></p>
2120
- </form>
1
+ <h3>Installation</h3>
2
+ <ul>
3
+ <li>Either:
4
+
5
+ <ul>
6
+ <li>Put the postie.zip file in wp-content/plugins/ and unzip it</li>
7
+ </ul></li>
8
+ <li>Or:
9
+
10
+ <ul>
11
+ <li>Use the automatic installer (WP 2.7+)</li>
12
+ </ul></li>
13
+ <li>Login to WordPress as an administrator</li>
14
+ <li>Goto the Plugins tab in the WordPress Admin Site</li>
15
+ <li>Activate "Postie"</li>
16
+ <li>Goto to the "Settings" tab and click on the sub-tab "Postie" to configure it.</li>
17
+ <li>Make sure you enter the mailserver information correctly, including the type
18
+ of connection and the port number. Common port configurations:
19
+
20
+ <ul>
21
+ <li>pop3: 110 </li>
22
+ <li>pop3-ssl: 995</li>
23
+ <li>imap: 143</li>
24
+ <li>imap-ssl: 993</li>
25
+ </ul></li>
26
+ <li>(Postie ignores the settings under Settings-&gt;Writing-&gt;Writing-by-Email)</li>
27
+ </ul>
28
+
29
+ <h4>Automating checking e-mail</h4>
30
+
31
+ <p>By default, postie checks for new e-mail every 30 minutes. You can select from
32
+ a number of different checking intervals in the settings page, under the
33
+ mailserver tab.</p>
34
+
35
+ <p>If you would prefer to have more fine-grained control of how postie checks
36
+ for mail, you can also set up a crontab. This is for advanced users only.
37
+ If your site runs on a UNIX/linux server, and you have shell access, you can
38
+ enable mail checking using cron; if you don't know anything about cron, skip
39
+ to the cronless postie section.</p>
40
+
41
+ <p>Setup a cronjob to pull down the get&#095;mail.php
42
+ Examples:</p>
43
+
44
+ <p>*/5 * * * * /usr/bin/lynx --source <a href="http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php" rel="nofollow">http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php</a> &gt;/dev/null 2&gt;&amp;1</p>
45
+
46
+ <p>This fetches the mail every five minutes with lynx</p>
47
+
48
+ <p>*/10 * * * * /usr/bin/wget -O /dev/null <a href="http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php" rel="nofollow">http://blog.robfelty.com/wp-content/plugins/postie/get&#095;mail.php</a> &gt;/dev/null 2&gt;&amp;1</p>
49
+
50
+ <p>This fetches the mail every ten minutes with wget</p> <hr />
51
+
52
+ <h3>Upgrade Notice</h3>
53
+ <dl>
54
+ <dt>Attachments are now processed in the order they were attached.
55
+ XSS detection only issues a warning now</dt>
56
+ <dd></dd>
57
+ </dl>
58
+
59
+ <h3 id='Usage'>Usage</h3>
60
+ <ul>
61
+ <li>If you put in :start - the message processing won't start until it sees that string</li>
62
+ <li>If you put in :end - the message processing will stop once it sees that string</li>
63
+ <li>Posts can be delayed by adding a line with delayXdXhXm where X is a number.
64
+
65
+ <ul>
66
+ <li>delay:1d - 1 day</li>
67
+ <li>delay:1h - 1 hour</li>
68
+ <li>delay:1m - 1 minute</li>
69
+ <li>delay:1d2h4m - 1 day 2 hours 4m</li>
70
+ </ul></li>
71
+ <li>By putting comments:X in your message you can control if comments are allowed
72
+
73
+ <ul>
74
+ <li>comments:0 - means closed</li>
75
+ <li>comments:1 - means open</li>
76
+ <li>comments:2 - means registered only</li>
77
+ </ul></li>
78
+ <li>Replying to an e-mail gets posted as a comment.
79
+
80
+ <ul>
81
+ <li>For example, you e-mailed a post with the subject line "foo".
82
+ If you then send an e-mail with the subject line "Re: foo", it will
83
+ get posted as a comment to the "foo" post. This works by the subject
84
+ line, so if you have two posts with titles "foo", then the comment
85
+ will get placed in the more recent post.</li>
86
+ </ul></li>
87
+ <li>Custom excerpt
88
+
89
+ <ul>
90
+ <li>You can include a custom excerpt of an e-mail by putting it between
91
+ :excerptstart and :excerptend</li>
92
+ <li>You can include images in the excerpt by using the shortcode #eimg1#,
93
+ #eimg2# etc.</li>
94
+ </ul></li>
95
+ </ul>
96
+
97
+ <h4>Post type</h4>
98
+
99
+ <p>You can specify the post type by including it as the first part of the subject
100
+ E.g. //</p>
101
+
102
+ <h4>Category and tag handling</h4>
103
+
104
+ <ul>
105
+ <li>If you put a category name in the subject with a : it will be used
106
+ as the category for the post</li>
107
+ <li>If you put a category id number in the subject with a : it will
108
+ be used as the category for the post</li>
109
+ <li><p>If you put the first part of a category name it will be posted in
110
+ the first category that the system finds that matches - so if you put</p>
111
+
112
+ <p>Subject: Gen: New News</p>
113
+
114
+ <p>The system will post that in General.</p></li>
115
+ <li><p>All of the above also applies if you put the category in brackets []</p></li>
116
+ <li><p>Using [] or you can post to multiple categories at once</p>
117
+
118
+ <p>Subject: [1] [Mo] [Br] My Subject</p>
119
+
120
+ <p>On my blog it would post to General (Id 1), Moblog, and Brewing all at one time</p></li>
121
+ <li><p>Using - or you can post to multiple categories at once</p>
122
+
123
+ <p>Subject: -1- -Mo- -Br- My Subject</p>
124
+
125
+ <p>On my blog it would post to General (Id 1), Moblog, and Brewing all at one time</p></li>
126
+ </ul>
127
+
128
+ <h4>Tags</h4>
129
+
130
+ <ul>
131
+ <li>You can add tags by adding a line in the body of the message like so:
132
+ tags: foo, bar</li>
133
+ <li>You can also set a default tag to be applied if no tags are included.</li>
134
+ </ul>
135
+
136
+ <h4>Image Handling</h4>
137
+
138
+ <ul>
139
+ <li>Allows you to attach images to your email and automatically post
140
+ them to your blog</li>
141
+ <li>You can publish images in the text of your message by using #img1#
142
+ #img2# - each one will be replaced with the HTML for the image
143
+ you attached</li>
144
+ <li><p>Captions - you can also add a caption like so:</p>
145
+
146
+ <ul>
147
+ <li>#img1 caption='foo'#</li>
148
+ <li>#img2 caption='bar'#</li>
149
+ </ul>
150
+
151
+ <p>Or, if you use IPTC captions, this caption will be used (adding a caption
152
+ in many photo editing programs (for example Picasa), will add an IPTC caption)</p>
153
+
154
+ <p>Note that the images are processed in the order they are attached as of version
155
+ 1.4.6.</p></li>
156
+ <li><p>Image templates
157
+ Postie now uses the default wordpress image template, but you can specify a
158
+ different one if you wish.</p>
159
+
160
+ <p>You can also specify a custom image template. I use the following custom
161
+ template:</p>
162
+
163
+ <p><code>&lt;div class='imageframe alignleft'&gt;&lt;a href='{IMAGE}'&gt;&lt;img src="{THUMBNAIL}"
164
+ alt="{CAPTION}" title="{CAPTION}"
165
+ class="attachment" /&gt;&lt;/a&gt;&lt;div
166
+ class='imagecaption'&gt;{CAPTION}&lt;/div&gt;&lt;/div&gt;</code></p>
167
+
168
+ <ul>
169
+ <li>{THUMBNAIL} gets replaced with the url to the thumbnail image</li>
170
+ <li>{MEDIUM} gets replaced with the url to the medium-sized image</li>
171
+ <li>{LARGE} gets replaced with the url to the large-sized image</li>
172
+ <li>{FULL} gets replaced with the url to the full-sized image</li>
173
+ <li>{FILENAME} gets replaced with the absolute path to the full-size image</li>
174
+ <li>{RELFILENAME} gets replaced with the relative path to the full-size image</li>
175
+ <li>{CAPTION} gets replaced with the caption you specified (if any)</li>
176
+ <li>{WIDTH} gets replaced with width of the photo</li>
177
+ <li>{HEIGHT} gets replaced with the height of the photo</li>
178
+ </ul></li>
179
+ </ul>
180
+
181
+ <h4>Interoperability</h4>
182
+
183
+ <ul>
184
+ <li>If your mail client doesn't support setting the subject (nokia) you
185
+ can do so by putting #your title here# at the beginning of your message</li>
186
+ <li>POP3,POP3-SSL,IMAP,IMAP-SSL now supported - last three require
187
+ php-imap support</li>
188
+ <li>The program understands enough about mime to not duplicate post
189
+ if you send an HTML and plain text message</li>
190
+ <li>Automatically confirms that you are installed correctly</li>
191
+ </ul>
192
+ <hr />
193
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,905 +1,909 @@
1
- === Postie ===
2
- Contributors: WayneAllen
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HPK99BJ88V4C2
4
- Author URI: http://allens-home.com/
5
- Plugin URI: http://PostiePlugin.com/
6
- Tags: e-mail, email
7
- Requires at least: 2.8
8
- Tested up to: 3.4.2
9
- Stable tag: 1.4.5
10
- License: GPLv2 or later
11
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
-
13
- The Postie plugin allows you to blog via e-mail, including many advanced
14
- features not found in WordPress's default post by e-mail feature.
15
-
16
- == Description ==
17
- Postie offers many advanced features for posting to your blog via e-mail,
18
- including the ability to assign categories by name, included pictures and
19
- videos, and automatically strip off signatures. It also has support for both
20
- imap and pop3, with the option for ssl with both. For usage notes, see the
21
- [other notes](other_notes) page
22
-
23
- = What's new? =
24
-
25
- * 1.4.5 (2012.11.14)
26
- * Fixed bug in XSS attack vulnerability code. Thanks to R Reid http://blog.strictly-software.com/2012/03/fixing-postie-plugin-for-wordpress-to.html
27
- * Fixed bug where emails with multiple categories has the incorrect title
28
- * Fixed bugs where PHP setting were not being changed correctly - thanks to Peter Chester http://tri.be/author/peter/
29
- * New maintainer
30
-
31
- * 1.4.4 (2012.08.10)
32
- * Fixed possible XSS attack vulnerability
33
-
34
- * 1.4.3 (2011.12.12)
35
- * Removed get_user_by function to make compatible with wp 3.3 - now requires
36
- 2.8+
37
-
38
- * 1.4.2 (2011.01.29)
39
- * Fixed mailto link bug (thanks to Jason McNeil)
40
- * Fixed bug with attachments with non-ascii characters in filename (thanks to
41
- mtakada)
42
- * checking for socket errors when checking mail (thanks elysian)
43
- * fixed issue with multiple files not being inserted correctly
44
- * Added support for ISO 8859-15 (thanks paolog)
45
- * fixed sql injection problem (thanks Jose P. Espinal for pointing it out)
46
-
47
- * 1.4.1 (2010.06.18)
48
- * Images appear in correct order when using images append = false
49
- * Images are sorted in order of filename before inserting into post
50
- * Fixed formatting problem with wordpress_default image template
51
- * Captions now correctly work with wordpress >3.0 and <3.0
52
- * Fixed auto_gallery feature
53
- * Default port is now 110
54
- * Added more configuration tests
55
- * Added background color to settings page to make input boxes more visible
56
- * Removed extra quote character in captions from #img# placeholders (thanks
57
- SteelD for pointing out the error)
58
- * Added support for big5 and gb-1232 encodings (thanks Chow)
59
- * Fixed issue with configurations items stored as arrays, which caused
60
- problems with validating authorized addresses
61
- * Fixed bug with replaceImageCIDs function
62
- * On hosts which allow it, we set max execution time to 300 seconds and
63
- memory_limit to infinity to allow processing of large e-mails (especially
64
- with large attachments)
65
-
66
- == Installation ==
67
- * Either:
68
- * Put the postie.zip file in wp-content/plugins/ and unzip it
69
- * Or:
70
- * Use the automatic installer (WP 2.7+)
71
- * Login to WordPress as an administrator
72
- * Goto the Plugins tab in the WordPress Admin Site
73
- * Activate "Postie"
74
- * Goto to the "Settings" tab and click on the sub-tab "Postie" to configure it.
75
- * Make sure you enter the mailserver information correctly, including the type
76
- of connection and the port number. Common port configurations:
77
- * pop3: 110
78
- * pop3-ssl: 995
79
- * imap: 143
80
- * imap-ssl: 993
81
- * (Postie ignores the settings under Settings->Writing->Writing-by-Email)
82
-
83
- = Automating checking e-mail =
84
-
85
- By default, postie checks for new e-mail every 30 minutes. You can select from
86
- a number of different checking intervals in the settings page, under the
87
- mailserver tab.
88
-
89
- If you would prefer to have more fine-grained control of how postie checks
90
- for mail, you can also set up a crontab. This is for advanced users only.
91
- If your site runs on a UNIX/linux server, and you have shell access, you can
92
- enable mail checking using cron; if you don't know anything about cron, skip
93
- to the cronless postie section.
94
-
95
- Setup a cronjob to pull down the get\_mail.php
96
- Examples:
97
-
98
- */5 * * * * /usr/bin/lynx --source http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php >/dev/null 2>&1
99
-
100
- This fetches the mail every five minutes with lynx
101
-
102
- */10 * * * * /usr/bin/wget -O /dev/null http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php >/dev/null 2>&1
103
-
104
- This fetches the mail every ten minutes with wget
105
-
106
- == Usage ==
107
- * If you put in :start - the message processing won't start until it sees that string
108
- * If you put in :end - the message processing will stop once it sees that string
109
- * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
110
- * delay:1d - 1 day
111
- * delay:1h - 1 hour
112
- * delay:1m - 1 minute
113
- * delay:1d2h4m - 1 day 2 hours 4m
114
- * By putting comments:X in your message you can control if comments are allowed
115
- * comments:0 - means closed
116
- * comments:1 - means open
117
- * comments:2 - means registered only
118
- * Replying to an e-mail gets posted as a comment.
119
- * For example, you e-mailed a post with the subject line "foo".
120
- If you then send an e-mail with the subject line "Re: foo", it will
121
- get posted as a comment to the "foo" post. This works by the subject
122
- line, so if you have two posts with titles "foo", then the comment
123
- will get placed in the more recent post.
124
- * Custom excerpt
125
- * You can include a custom excerpt of an e-mail by putting it between
126
- :excerptstart and :excerptend
127
- * You can include images in the excerpt by using the shortcode #eimg1#,
128
- #eimg2# etc.
129
-
130
- = Category and tag handling =
131
- * If you put a category name in the subject with a : it will be used
132
- as the category for the post
133
- * If you put a category id number in the subject with a : it will
134
- be used as the category for the post
135
- * If you put the first part of a category name it will be posted in
136
- the first category that the system finds that matches - so if you put
137
-
138
- Subject: Gen: New News
139
-
140
- The system will post that in General.
141
-
142
- * All of the above also applies if you put the category in brackets []
143
- * Using [] or you can post to multiple categories at once
144
-
145
- Subject: [1] [Mo] [Br] My Subject
146
-
147
- On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
148
-
149
- * Using - or you can post to multiple categories at once
150
-
151
- Subject: -1- -Mo- -Br- My Subject
152
-
153
- On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
154
- * You can add tags by adding a line in the body of the message like so:
155
- tags: foo, bar
156
- * You can also set a default tag to be applied if no tags are included.
157
-
158
- = Image Handling =
159
- * Allows you to attach images to your email and automatically post
160
- them to your blog
161
- * You can publish images in the text of your message by using #img1#
162
- #img2# - each one will be replaced with the HTML for the image
163
- you attached
164
- * Captions - you can also add a caption like so:
165
-
166
- * #img1 caption='foo'#
167
- * #img2 caption='bar'#
168
-
169
- Or, if you use IPTC captions, this caption will be used (adding a caption
170
- in many photo editing programs (for example Picasa), will add an IPTC caption)
171
-
172
- * Image templates
173
- Postie now uses the default wordpress image template, but you can specify a
174
- different one if you wish.
175
-
176
- You can also specify a custom image template. I use the following custom
177
- template:
178
-
179
- <div class='imageframe alignleft'><a href='{IMAGE}'><img src="{THUMBNAIL}"
180
- alt="{CAPTION}" title="{CAPTION}"
181
- class="attachment" /></a><div
182
- class='imagecaption'>{CAPTION}</div></div>
183
-
184
- * {THUMBNAIL} gets replaced with the url to the thumbnail image
185
- * {MEDIUM} gets replaced with the url to the medium-sized image
186
- * {LARGE} gets replaced with the url to the large-sized image
187
- * {FULL} gets replaced with the url to the full-sized image
188
- * {FILENAME} gets replaced with the absolute path to the full-size image
189
- * {RELFILENAME} gets replaced with the relative path to the full-size image
190
- * {CAPTION} gets replaced with the caption you specified (if any)
191
- * {WIDTH} gets replaced with width of the photo
192
- * {HEIGHT} gets replaced with the height of the photo
193
-
194
- = Interoperability =
195
- * If your mail client doesn't support setting the subject (nokia) you
196
- can do so by putting #your title here# at the begining of your message
197
- * POP3,POP3-SSL,IMAP,IMAP-SSL now supported - last three require
198
- php-imap support
199
- * The program understands enough about mime to not duplicate post
200
- if you send an HTML and plain text message
201
- * Automatically confirms that you are installed correctly
202
-
203
- == Screenshots ==
204
-
205
- 1. Postie options (showing video and audio templates)
206
-
207
- == Frequently Asked Questions ==
208
-
209
- = Postie won't connect to my mailserver. Why Not? =
210
-
211
- Make sure the port you are using is open. For example, bluehost seems to block
212
- ports 993 and 995 (for pop3-ssl and imap-ssl) by default. I have heard that
213
- you can request that they open them for you ( you might have to pay extra).
214
-
215
- You can check for open ports with the following command on your server:
216
- netstat -ln|grep -E ':::(993|995|143)'
217
-
218
- If nothing shows up, then the ports are not open.
219
-
220
- = How can I get postie to display inline images? =
221
-
222
- Make sure that you send e-mail formatted as html (richtext), and set postie to
223
- prefer html messages (in the message tab of the postie settings)
224
-
225
- = Mail is not showing up right when I send html (rich formatted) e-mail! =
226
-
227
- Make sure you set the preferred text type to html
228
-
229
- = Do I need to any code to my theme for postie to work? =
230
-
231
- No.
232
-
233
- = I read somewhere to add an iframe to my footer. Should I do this? =
234
-
235
- No. Do not add an iframe in your footer to get postie to check mail
236
- periodically. To check e-mail periodically, either set-up a cron job, or use
237
- cronless postie. See installation instructions
238
-
239
- = My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl =
240
-
241
- You must have php-imap installed on your server for this to work. Ask your
242
- hosting provider about this.
243
-
244
- = Can I use postie to check a gmail account? =
245
-
246
- Yes. You can use either pop3-ssl or imap-ssl with a gmail account. Before
247
- attempting to use with postie, make sure that you enable pop or imap in your
248
- gmail preferences.
249
-
250
- * Pop3 settings:
251
- * protocol - pop3-ssl
252
- * server - pop.gmail.com
253
- * port - 995
254
- * userid - your username (e.g. if your e-mail address is foo@gmail.com,
255
- this would be just foo)
256
- * password - your password
257
- * IMAP settings:
258
- * protocol - imap-ssl
259
- * server - imap.gmail.com
260
- * port - 993
261
- * userid - your username (e.g. if your e-mail address is foo@gmail.com,
262
- this would be just foo)
263
- * password - your password
264
-
265
- = My posts show up as being posted by 'admin' instead of me. Why? =
266
-
267
- If your admin account is linked to bar@gmail.com, and you send mail from
268
- bar@gmail.com, it will show up as being posted by admin. If you have a
269
- wordpress user named "John Doe", which is linked to johndoe@gmail.com, make
270
- sure that you send e-mails from johndoe@gmail.com. It doesn't matter which
271
- e-mail address postie is checking. That is, if you send mail from
272
- johndoe@gmail.com to foo@gmail.com, it gets posted as "John Doe".
273
-
274
- If you send an e-mail to your postie address from an e-mail address that is no
275
- t linked to a wordpress user, it will get posted as admin.
276
-
277
- = Images aren't showing up at all? =
278
-
279
- There are a couple possible reasons for this. First, check to see if you can
280
- add an image through wordpress's normal posting mechanism. If not, then there
281
- is probably 1 or 2 problems:
282
- 1. Your server does not have the php-gd library installed. Ask your hosting
283
- provider about this.
284
-
285
- 2. Your wp-content/uploads directory is not writable by the webserver. Make
286
- sure that it is
287
-
288
- = Can I delete the wp-files directory needed by postie version <1.3.0? =
289
-
290
- If you have posts published already by older versions of postie, getting rid
291
- of those directories will delete any files you might have had associated with
292
- those old posts. If you don't have any such posts, then you can safely delete
293
- them.
294
-
295
- = How can I get rid of stupid stuff my e-mail provider adds to my messages? =
296
-
297
- To strip off stuff that they add at the beginning of a message, start your
298
- post with :start
299
-
300
- To strip off stuff that they add at the end of a message, end your
301
- post with :end
302
-
303
- = How can I add custom attachment icons? =
304
-
305
- Simply upload the icons you want to the postie/icons/custom directory. You
306
- must name the icons according to the following scheme:
307
- {filetype}-{size}.png
308
-
309
- For example, for word documents, you could use:
310
-
311
- `doc-32.png`
312
-
313
- for a 32x32 pixel icon. (You can actually create any size icon you want, but
314
- if you name it 32, then it will only be used if you select to use size 32
315
- icons)
316
-
317
- See the other directories in icons for more examples.
318
-
319
- Currently the following filetypes are supported:
320
-
321
- * doc - microsoft word (including docx)
322
- * ppt - microsoft powerpoint (including pptx)
323
- * xls - microsoft excel (including xlsx)
324
- * numbers - iWork numbres spreadsheet
325
- * pages - iWork pages document
326
- * key - iWork keynote presentation
327
- * pdf - portable document format
328
- * rtf - rich text format
329
- * txt - plain text document
330
-
331
- = Can I add special text to the body of the post when using postie? =
332
-
333
- Yes. You can create your own function, and use the postie_post filter.
334
- Two short examples are included in the filterPostie.php.sample file
335
-
336
- = Can I add special text to the title of the post when using postie? =
337
-
338
- Yes. You can create your own function, and use the postie_post filter.
339
- Two short examples are included in the filterPostie.php.sample file
340
-
341
- = Can I select tags or categories based on the content of the e-mail? =
342
-
343
- Yes. You can create your own function, and use the postie_post filter.
344
- See the filterPostie.php.sample file for examples.
345
-
346
- = Is the IMAP extension required for postie? =
347
-
348
- The IMAP extension is not required, but it is strongly recommended, especially
349
- is you are using non-English text. There is more information on php.net about
350
- installing the IMAP extension. If you have control over your server, it is
351
- often not hard to install.
352
-
353
- On Ubuntu, try
354
- sudo apt-get install php5-imap
355
-
356
- On Fedora, try
357
- sudo yuminstall php-imap
358
-
359
- The IMAP extension is known to be installed on the following popular webhosts:
360
- * Dreamhost
361
-
362
- = How can I embed youtube or vimeo videos? =
363
-
364
- Simply put the url in the body of your e-mail. (Make sure that you have the
365
- option to convert url into links turned on)
366
-
367
- == CHANGELOG ==
368
-
369
- = 1.4.5 =
370
- * TODO - fix corruption of rtf attachments
371
- * TODO - add port checking in tests
372
- * TODO - non-image uploads get ignored in content when using autogallery - see
373
- replaceimageplaceholders
374
-
375
- = 1.4.4 (2012.08.10) =
376
- * Fixed possible XSS attack vulnerability
377
-
378
- = 1.4.3 =
379
- * Removed get_user_by function to make compatible with wp 3.3 - now requires
380
- 2.8+
381
-
382
- = 1.4.2 (2011.01.29) =
383
- * Fixed mailto link bug (thanks to Jason McNeil)
384
- * Fixed bug with attachments with non-ascii characters in filename (thanks to
385
- mtakada)
386
- * checking for socket errors when checking mail (thanks elysian)
387
- * fixed issue with multiple files not being inserted correctly
388
- * Added support for ISO 8859-15 (thanks paolog)
389
- * fixed sql injection problem (thanks Jose P. Espinal for pointing it out)
390
- * Fixed namespace clashing for get_config function
391
-
392
- = 1.4.1 (2010.06.18) =
393
- * Images appear in correct order when using images append = false
394
- * Fixed formatting problem with wordpress_default image template
395
- * Captions now correctly work with wordpress >3.0 and <3.0
396
- * Fixed auto_gallery feature
397
- * Default port is now 110
398
- * Added more configuration tests
399
- * Added background color to settings page to make input boxes more visible
400
- * Removed extra quote character in captions from #img# placeholders (thanks
401
- SteelD for pointing out the error)
402
- * Added support for big5 and gb-1232 encodings (thanks Chow)
403
- * Fixed issue with configurations items stored as arrays, which caused
404
- problems with validating authorized addresses
405
- * Fixed bug with replaceImageCIDs function
406
- * On hosts which allow it, we set max execution time to 300 seconds and
407
- memory_limit to infinity to allow processing of large e-mails (especially
408
- with large attachments)
409
- * Images are sorted in order of filename before inserting into post
410
-
411
- = 1.4 (2010.04.25) =
412
- * Now using wordpress settings api (thanks for much help from Andrew S)
413
- * Cronless postie is now integrated with postie instead of a separate plugin
414
- * filterPostie.php moved to filterPostie.php.sample
415
- * Can use fetchmails.php to fetch mail from multiple mailboxes
416
- * Fixed problem with embedding youtube videos from html (richtext) e-mail
417
- * Added support for embedding vimeo vidoes
418
- * Fixed problem with selecting "none" as icon set for attachments (thanks
419
- tonyvitali)
420
- * Fixed problems with cronless postie settings
421
- * Fixed bug with embedding youtube and vimeo videos whose ID contains a -
422
- (thanks Jim Kehoe)
423
- * Post_author is now included with attachments
424
- * fixed confirmation_email settings so that now you can select between sender,
425
- admin, both, or none (thanks to redsalmon for pointing out bug)
426
- * Added option to automatically insert galleries
427
- * Updated FAQ and readme
428
-
429
- = 1.3.4 (2009.10.05) =
430
- * Fixed problem with images not posting under cron
431
- * Fixed issue with disappearing password
432
-
433
- = 1.3.3 (2009.09.11) =
434
- * Fixed problem with double titles
435
- * Fixed error in wp-mu
436
- * Cronless postie now correctly updates when changing the setting in the
437
- postie settings
438
- * Small fix in handling of names of attachments (thanks to Teejot)
439
- * Fixed delay option (thanks to redbrandonk)
440
- * Cronless option value is now correctly deleted when deactivating the
441
- cronless postie plugin
442
-
443
- = 1.3.2 (2009.08.27) =
444
- * tags are now always an array, even if no default tags are set
445
- * Subject is showing up again if you do not have the IMAP extension
446
- installed
447
- * More information on the IMAP extension and more user-friendly
448
- installation
449
- * Fixed problems with smtp server settings in 1.3.1
450
- * Added russian translation (thanks to fatcow.com)
451
-
452
- = 1.3.1 (2009.08.24) =
453
- * Changed GetContent filter to postie_post
454
- * Added database upgrade hook on activation
455
- * Fixed bug where content would be empty if trying to remove signature,
456
- and signature list was emtpy
457
- * Updated FAQ and readme
458
-
459
- = 1.3.0 (2009.08.14) =
460
- * Features
461
- * Added mpeg4 to default list of videotypes
462
- * Added support for KOI8-R character set (cyrillic)
463
- * Added support for iso-8859-2 character set (eastern european)
464
- * Added option to include custom icons for attachments
465
- * Added option to send confirmation message to sender
466
- * Enhanced e-mails for unauthorized users
467
- * Added option to send unauthorized e-mail back to sender
468
- * Added option to only allow e-mails from a specified list of smtp
469
- servers
470
- * Added option to use shortcode for embedding videos (works with the
471
- videos plugin http://www.daburna.de/download/videos-plugin.zip
472
- * Better handling of comment authors (thanks to Petter for suggestion)
473
- * Simplified message options (now includes an advanced options section)
474
- * Added filter ability for post content
475
- * Bug fixes
476
- * No longer including wp-config.php
477
- * If tmpdir is not writable, try a different tmpdir
478
- * More subject encoding fixes
479
- * Updated image templates, which were causing problems for cron
480
- * Fixed in text captions
481
- * Fixed SQL problems when updating options
482
- * Fixed name clashes with other plugins
483
- * Fixed custom image field
484
-
485
- = 1.3.beta (2009.07.01) =
486
- * Mores fixes for character issues in subject
487
- * Now handling Windows-1256 (arabic) character set
488
- * Fixed image uploading on windows servers
489
- * Fixed replying to message adds comment
490
- * Uploading pictures via MMS should now work
491
- * Fixed some issues with e-mails from outloook 12
492
- * Greatly reduced number of database queries
493
- * No longer requiring config_handler.php
494
-
495
- = 1.3.alpha (2009.06.05) =
496
- * Now using default wordpress image and upload handling, which means:
497
- * No more creating special directories for postie
498
- * No more confusion about imagemagick
499
- * Can now use the [gallery] feature of wordpress
500
- * Attachments are now connected to posts in the database
501
- * All image resizing uses wordpress's default settings (under media)
502
- * Configuration, settings and documentation improvements
503
- * Completely redesigned settings page (mostly thanks to Rainman)
504
- * Reset configuration no longer deletes mailserver settings
505
- * Now including help files and faq directly in settings page
506
- * More media features
507
- * Automatically turn links to youtube into an embedded player
508
- * Added option to embed audio files with custom templates
509
- * Video options are now template based
510
- * Image options are now solely template based, with several new default
511
- templates
512
- * Bug fixes
513
- * Uploading images from vodafone phones should now work
514
- * Correctly handling Windows-1252 encoding
515
- * Correctly handling non-ascii characters in subject line
516
-
517
- = 1.2.3 (2009.05.17) =
518
- * Fixed headers already sent bug
519
- * Converted shortcode `<?` to proper `<?php` (thanks brack)
520
- * Deleting mails after processing again
521
-
522
- = 1.2.2 (2009.05.15) =
523
- * Show empty categories for default category in options
524
- * Image scaling fixed so that the smaller value of max image width and max
525
- image height is used
526
- * Fixed some issues with parsing html e-mail
527
- * Got rid of stupid mime tag (thanks Jeroen)
528
- * No longer adding slashes before calling wp_insert_post
529
- * When using custom image field, each image has a unique key
530
-
531
-
532
- = 1.2.1 (2009.05.07) =
533
- * Got rid of stupid version checking
534
- * Improved cronless postie instructions and configuration
535
- * Internationalization is working now
536
- * Dutch localization (thanks to gvmelle http://gvmelle.com )
537
- * Fixed caption bug when using image magick
538
- * Added option to not filter new lines (when using markdown syntax)
539
- * Fixed autoplay option
540
- * Can now use wildcards in excluding filenames
541
- * Producing better quality thumbnails (thanks to robcarey)
542
-
543
- = 1.2 (2009.04.22) =
544
- * More video options:
545
- * Can embed 3gp, mp4, mov videos
546
- * Can specify video width, video height, player width, and player height
547
- in the settings page
548
- * Can specify custom image template
549
- * Image handling improvements:
550
- * Only downscale images, not up-scale (thanks Jarven)
551
- * More custom image template options
552
- * IPTC captions now also work when not resizing images
553
- * Added option to use custom field for images (for Datapusher)
554
- * Fixed some issues with image templates and line break handling
555
- * Custom image template now works even when not resizing images
556
- * Documentation improvements:
557
- * Added links to settings, forum, and readme in plugin description
558
- * Updated readme (thanks to Venkatraman Dhamodaran)
559
- * Added better instructions on how to use cronless postie
560
- * Text processing improvements:
561
- * Added option to automatically convert urls into links
562
- * Added feature to include a custom excerpt
563
- * Miscellaneous improvements
564
- * Improved internationalization (thanks to Håvard Broberg
565
- (nanablag@nanablag.com))
566
- * Bug Fixes
567
- * Removed debugging info in get_mail.php (security issue) thanks to
568
- [Jens]( http://svalgaard.net/jens/)
569
- * No longer directly including pluggable.php (should
570
- prevent conflicts with other plugins such as registerplus
571
-
572
-
573
- = 1.1.5 (2009.03.10) =
574
- * Added option to have postie posts be pending review, published, or draft
575
- * Settings panel only shows up for administrators
576
- * Need not be user "admin" to modify settings or to post from non-registered
577
- users
578
- * Can now set administrator name. Authorized e-mail addresses which don't
579
- have a user get posted under this name
580
- * Will use IPTC captions if available
581
- * Added option to replace newline characters with <br />
582
-
583
- = 1.1.4 (2009.03.06) =
584
- * Added more image options (open in new window, custom image template)
585
- * can now add captions to images
586
- * Can now add tags (including default tag option)
587
-
588
- = 1.1.3 (2009.02.20) =
589
- * Fixed delayed posting
590
- * updated readme some
591
-
592
- = 1.1.2 (2008.07.12) =
593
- * now maintained by Robert Felty
594
- * allow negative delays
595
- * will glean author information from forwarded or redirected e*mails
596
- * replying to an e*mail adds a comment to a post
597
- * fixed category handling to work with taxonomy
598
- * fixed one syntax error
599
- * added option to wrap posts and comments in <pre%gt; tags
600
-
601
-
602
- = 1.1.1 =
603
-
604
- Below is all the of the version information. As far as I can tell there once was a guy named John Blade. He took some of the original wp-mail.php code
605
- and started hacking away on it. He actually got pretty far. About the time I discovered WordPress and his little hack - called WP-Mail at the time - he
606
- went on a vacation or something. There were some problems with the script, and it was missing some features I wanted. I hacked away at it and got it
607
- into a place where it did what I wanted. I started posting about it since I figured other people might want the features.
608
-
609
- John didn't release any more versions at least up til July 2005. So I started accepting submissions and feature requests from people to help make the
610
- code better. In June/July 2005 I discovered a little plugin by Chris J Davis (http://www.chrisjdavis.org/cjd-notepad/) called notepad. I added a small
611
- feature to it (basically a bookmarklet). In the process I started looking at his code and realized how much you could do with the plugin system
612
- available in Word Press.
613
-
614
- So I decided to make an offical fork. I put up an article on my blog asking for new names. I picked Postie. I then modified the code to be a proper
615
- plugin. And the rest is history :)
616
-
617
- * BUGFIX -problem with subject
618
- * BUGFIX -cronless postie typo
619
-
620
- = 1.1 =
621
- * FEATURE: Updated and tested with WordPress 2.1
622
- * BUGFIX:Removed deprecated functions
623
- * FEATURE: Cronless Postie now uses the WordPress native Psuedo Cron.
624
-
625
- = 1.0 =
626
- * BUGFIX: TestWPVersion broke with 2.1
627
- * FEATURE: end: now marks the end of a message (Dan Cunningham)
628
- * FEATURE: Better Readme (Michael Rasmussen)
629
- * FEATURE: Smart Sharpen Option -EXPERIMENTAL- (Jonas Rhodin)
630
- * BUGFIX: Issue with google imap fixed (Jim Hodgson)
631
- * BUGFIX: Fixed espacing issue in subjects (Paul Clip)
632
- * BUGFIX: Typo in Div fixed (phil)
633
-
634
- = 0.9.9.3.2 =
635
- * BUGFIX: Typo
636
- = 0.9.9.3.1 =
637
- * BUGFIX: Removed debugging code
638
-
639
- = 0.9.9.3 =
640
- * BUGFIX: If your email address matches an existing user - then it will post as that user - even if you allow anyone to post.
641
- * BUGFIX: Replaced get_settings('home') with get_settings('siteurl')
642
- * BUGFIX: Better handling for Japanese charactersets - Thanks to http://www.souzouzone.jp/blog/archives/009531.html
643
- * BUGFIX: Better thumbnail window opening code - thanks to Gabi & Duntello!
644
- * FEATURE: Added an option to set the MAX Height of an image - idea from Duntello
645
- * BUGFIX: Modified the FilterNewLines for better flowed text handling - You now HAVE TO PUT TWO NEW LINES to end a paragraph.
646
- * FEATURE: Added new CSS tags to support positioning images/attachments/3gp videos
647
- * BUGFIX: Tries to use the date in the message (Thanks Ravan) I tried this once before and it never worked - hopefully this time it will.
648
- * BUGFIX: Added a workaround to fix the problem with Subscribe2 - it will now notify on posts that are not set to show up in the future.
649
-
650
-
651
-
652
- = 0.9.9.2 =
653
- * BUGFIX: Looks for the NOOP error and disgards it
654
- * FEATURE: Postie now detects the version of WordPress being used
655
- * FEATURE: Smarter Parsing of VodaPhone
656
- * FEATURE: Easy place to add new code to handle other brain-dead mail clients
657
- * BUGFIX: Handles insertion of single quotes properly
658
- * BUGFIX: Thumbnails should now link properly
659
-
660
- = 0.9.9.1 =
661
- * BUGFIX: Needed a strtolower in places to catch all iso-8859 - thx to Gitte Wange for the catch
662
- * BUGFIX: Fixed issue with the category not being posted properly
663
-
664
- = 0.9.9 =
665
- * UPDATE TO WP 2.0
666
- * BUGFIX: Config Page now works
667
- * FEATURES: Supports role based posting
668
- * BUGFIX: Posting updates the category counts.
669
-
670
- = 0.9.8.6 =
671
- * BUGFIX: Fixed problems with config page <%php became <?php
672
- *
673
- = 0.9.8.5 =
674
- * BUGFIX: onClick changed to onclick
675
- * BUGFIX: strolower added to test for iso - thanks daniele
676
- * BUGFIX: Added a class to the 3gp video tags
677
- * FEATURE: Added the option to put the images before the article
678
- * BUGFIX: Added in selection for charsets - thanks Psykotik - this may cause problems for other encodings
679
- * FEATURE: Added option to turn of quoted printable decoding
680
- * FEATURE: :start tag - now postie looks for this tag before looking for you message - handy if your service provider prepends a message
681
- * FEATURE: Template for translation now included
682
- = 0.9.8.4 =
683
- * BUGFIX: Fixed problem with config_form.php - select had "NULL" instead of ""
684
- * BUGFIX: 3g2 now supported
685
- * BUGFIX: More line break issues addressed
686
- * BUGFIX: QuickTime controls are now visible even if the movie is done playing
687
- * BUGFIX: Email addresses in the format <some@domain.com> (Full Name) supported
688
- * BUGFIX: Some images that were not being resized - are now
689
- * BUGFIX: HTML problems - if you posted plain text with HTML on it ignored all images
690
- * BUGFIX: The test system blew up on the thumbnails
691
- * BUGFIX: Selected HTML for preferred text is now shown in the config form properly
692
- * BUGFIX: Postie now complains if it is not in its own directory
693
- * BUGFIX: Postie doesn't include PEAR if it is already available
694
- * BUGFIX: In Test mode rejected emails are simply dropped
695
- * BUGFIX: Markdown messes up Postie - it will warn you if you turn it on.
696
- *
697
- = 0.9.8.3 =
698
- * BUGFIX: Fixed issue with the line feed replacement
699
- * BUGFIX: Added Banned File Config back in
700
- * FEATURE: Added in a link around 3gp video embedded via QT
701
- * BUGFIX: Email that has both Plain and HTML content will show the HTML content and not the plain if html is preferred
702
-
703
- = 0.9.8.2 =
704
- * BUGFIX: Fixed an extra new line after attachin non-image files.
705
- * BUGFIX: The Test system now displays any missing gd functions
706
- * BUGFIX: The test system was only using ImageMagick
707
-
708
- = 0.9.8.1 =
709
- * BUGFIX: The test images are now included in the zip
710
-
711
- = 0.9.8 =
712
- * BUGFIX: New Lines detected and handled properly in cases where the mail client doesn't put a space before the new line (Miss Distance)
713
- * BUGFIX: 3gp mime type added (Paco Cotera)
714
- * BUGFIX: Authorized Email Addresses are not case-insensitive
715
- * FEATURE: The larger image now does a proper pop up
716
- * BUGFIX: Fixed Timeing Issue - turns out it wasn't reading the db at all
717
- * FEATURE: New Test Screen - to help track down problems
718
-
719
- = 0.9.7 =
720
- * BUGFIX: removed all short tags
721
- * BUGFIX: There were spacing issues in the way I wrote the QT embed statements
722
- * FEATURE: Added calls to WP-Cron - should work with that properly now if you activate Cronless Postie
723
- * FEATURE: ImageMagick version works without any calls to GD
724
- * BUGFIX: Postie now correctly handles cases wjere tjere are multiple blogs in one db
725
- * BUGFIX: Turned off warnings when using without GD
726
- * FEATURE: add the rotate:X to your message to rotate all images
727
- * FEATURE: new filter_postie_thumbnail_with_full which makes it easy to show a thumbnail on the front page but full image on the single page - see FAQ
728
-
729
- = 0.9.6 =
730
- * BUGFIX: handles email addresses that are no name and just <email@email.com> (Steve Cooley Reported)
731
- * FEATURE: Basic support for embedding flash files
732
- * BUGFIX: Postie now handles creating the correct URL on non Unix platforms
733
- * BUGFIX: Fixed problem with file attachments not being put in the right place.
734
- * FEATURE: You can now choose to use imagemagick convert to handle making thumbnails
735
- * BUGFIX: Rewrote Cronless Postie to use direct sockets
736
- * BUGFIX: Time offset is now settable just for Postie - hopefully this will fix problems for cases where the normal time offset doesn't work properly.
737
- * FEATURE: First draft of frame for a 3GP video
738
- * FEATURE: Option to embed 3GP in QuickTime Controller.
739
-
740
- = 0.9.5.2 =
741
- * BUGFIX: gmt varialble not being set correctly
742
- * BUGFIX: Changed the name of the Check Mail button to fix an issue with mod_security
743
- * BUGFIX: Fixed issue with Cronless-Postie
744
- * BUGFIX: There was an argument passed by reference incorrectly
745
- * FEATURE: Added in Cronless Postie Readme
746
- * FEATURE: Added in Postie Readme
747
-
748
- = 0.9.5.1 =
749
- * BUGFIX: Confirmed POP3-SSL on debian-3.0
750
- * BUGFIX: Updated the plugin version
751
- * BUGFIX: Stopped displaying the email account
752
- *
753
- = 0.9.5 =
754
- * BUGFIX: Postie handles cases where you do not have GD
755
- * FEATURE: You can now set the access level for posting - so other people can use the gate way
756
- * BUGFIX: Fixed issue when admininstrator email is not tied to a user account.
757
- * FEATURE: Can now reset all Postie configurations back to defaults
758
- * BUGFIX: HTML Emails with embedded images are now handled properly.
759
- * BUGFIX: The time difference should work correctly now
760
- * BUGFIX: Postie's configs are completely seperate from Writing-By-Mail
761
- * FEATURE: Warning if you use Gmail to make sure you turn on POP support
762
- * BUGFIX: Manual Check Mail Button in interface
763
- * BUGFIX: fixed issue of compatability with cjd-notepad
764
- * BUGFIX: Windows Works Now
765
-
766
-
767
- = 0.9.4 =
768
- * BUGFIX: Cronless Postie - fixed the include statement
769
- * BUGFIX: Authorized Addresses now supports a single address
770
- * FEATURE: All configuration in Postie done in a single screen
771
- * FEATURE: AUTHORIZATION can be completely overridden
772
- * BUGFIX: line 1159 - didn't handle cases where the table didn't exist already very well
773
- * FEATURE: Detects if you can do IMAP
774
- * FEATURE: Added IMAP Support
775
- * FEATURE: Added IMAP-SSL Support
776
- * FEATURE: Added POP3-SSL Support
777
-
778
- = 0.9.3 =
779
- * Bug fixes for IIS
780
- = 0.9.2 =
781
- * Moved to more of a DIRECTORY_SEPARATOR structure
782
- = 0.9.1 =
783
- * Added a define to fix a problem with over including
784
- = 0.9 =
785
- * Converted to an honest to god plugin
786
- * BUGFIX: If you put a single category:subject it now works
787
- * BUGFIX: ? Special characters may be supported? The test post now shows a lot of umlats and accents?
788
- * BUGFIX: The last ] in a subject with categories is now filtered out
789
- * FEATURE: -1- subject - will put the post in category 1
790
- = 0.312.13 =
791
- * Code clean up - The main loop is finally readable by even non programmers
792
- * FEATURE - You can now post to multiple categories at one time by using the [#],[Category Name], [Cat] in the subject
793
- * FEATURE - You can now select a category by just including the begining characters [G] will select General
794
- * if you don't have any other categories that start with g
795
- * FEATURE - Jay Talbot - added a new feature so you can have multiple email addresses be allowed in
796
- * Make multi category posting more obvious
797
- * BUG FIX: Timezones of GMT+? should now work properly
798
- * BUG FIX: Able to handle mis-mime typed images as long as they are named with .jpg/.gif/.png
799
-
800
- = 0.312.12 =
801
- * Code clean up - slowing shrinking the main to make it easiery to fix things
802
- * FEATURE: Be able to turn on/off allowing comments in an email
803
- * BUG FIX: AppleDouble now mostly supported
804
- * BUG FIX: MIME handling improved.
805
- * BUG FIX: Fix issue with timing delay
806
- = 0.312.11 =
807
- * FEATURE: Patterns to define where a sig starts are user configurable
808
- * FEATURE: Add filter options for banned file names
809
- * BUG FIX: Made it possible to turn off posting to the db for testing purposes
810
- = 0.312.10 =
811
- * FEATURE: Added in code to diplay the mime type of the file being linked to
812
- * BUG FIX: It now tests for the existance of the directories and makes sure
813
- * that the web server can write to them
814
- = 0.312.9 =
815
- * FEATURE:Should handle jpg as well as jpeg as the file type
816
- * BUG FIX: Now correctly handles the subject in the message
817
- * BUG FIX: Should handle Text preferences correctly
818
- = 0.312.8 =
819
- * Some general code tidying.
820
- * FEATURE: Can now have email from invalid email addresses automatically forwared
821
- * to the admin's email account. This forward includes all attachments.
822
- * Props to David Luden for getting this started.
823
- * Minor change: The system will continue if it runs into a message that doesn't have
824
- * any content - it will also continue to process if it gets an email from
825
- * someone not in the system. In the past this could result in deleted mail
826
- * if your cron job didn't run often enough.
827
- = 0.312.7 =
828
- * Confirm the handling of 3gp video for cell phones o
829
- * Added in new directive SUPPORTED_FILE_TYPES -if the mime type is listed here then the system will try to make a link to it without making a thumb nail.
830
- = 0.312.6 =
831
- * Bug Fix: Ok the last bug I fixed - actually caused another bug - man I should set up some unit tests. Now it handles mail from the nokia mail client correctly.
832
- = 0.312.5 =
833
- * Bug Fix : The system was accepting all test/* types. Now you can set a preference (defaults to text/plain)
834
- * to use as the main text for the post.
835
- = 0.312.4 =
836
- * Added in sanitize_title call suggested by Jemima
837
- * Added in ability to provide a subject in an mms - by using #Subject#
838
- * Fixed an issue with the time stamp system so it now automatically uses the gmt_offset from WordPress
839
- * Fixed issue with the delay:1d1h tag that prevented it from being removed from the body.
840
- * Fixed issue with the delay tag that caused problems if it was the last thing before an image.
841
-
842
- = 0.312.3-HEY (2005-05) =
843
- * > Some changes and Bugfixes by Adrian Heydecker
844
- * > Not (yet) in main development branch.
845
- * Fixed bug: JPEG-thumbnails had a bigger filesize than full images caused by bad hardcoded compression value.
846
- * Fixed bug: If images and signatures were present but no placeholder tags, the images were deleted together with the signature.
847
- * Fixed bug: Generates valid postnames for users of mod_rewrite. Permalinks to posts should now work even when whitespaces are present in the subject line.
848
- * Added support for Quoted Printable encoded mail.
849
- * Added ability to encode Wordpress-posts in charset ISO-8859-1 instead of UTF-8.
850
- * Added ability to choose JPEG-compression value for thumbnails.
851
- * Added ability to add class="" and style="" to images.
852
- * Added ability to use a different mailadress (eg. mobile) without setting up a new Wordpress-account.
853
-
854
- = 0.312.2 =
855
- * BUGFIX: It now removes the delay tag from the message
856
- = 0.312.1 =
857
- * Added modification for placeholder support for images (David Luden)
858
- * Added in support to automatically scale down big images (Dirk Elmendorf)
859
- * Fixed bug with multiple emails all getting the contents of the first image tag (Dirk Elmendorf)
860
- * Added option to allow HTML in the body and subject of the email (Dirk Elmendorf)
861
- * Switch config options to defines to reduce the number of global variables (Dirk Elmendorf)
862
- * Added tests to make sure there is a trailing slash on the DIR definitions (Dirk Elmendorf)
863
- * Add tests to see if they have gd installed (Dirk Elmendorf)
864
- * Seperate the scaling out to a function for easier usage (Dirk Elmendorf)
865
- * Add delay feature for future posting. (Dirk Elmendorf)
866
- * Added in ability to use strtotime if it is available (Dirk ELmendorf)
867
-
868
- * Todo
869
- * Have option to have the email that is rejected forwarded on to another address.
870
- * Fix bug that id still diplays the delay tag in the body
871
- = 0.312 - 2005-03 =
872
- * CHANGE FOR DEFAULT E-mail Categories, instead of [General] Subject you can now use General: Subject in the subject line. Less typing, and there must be a space after the colon.
873
- * Fixed bugs with no default posting for categories and user
874
- = 0.311 - 2005-01 =
875
- * eep, major bug for pop3 server. Next time I test my code more before I released, fixed so that pop3 now works.`
876
- = 0.31 - 2004-12 & 2005-01 =
877
- * (Has it been this long, best get back into the swing of things... did most of this coding on my holiday as I didn't have a machine to play WoW on :)
878
- * moved the deletion of pop3 emails into a check so that e-mails aren't deleted without proper checking.
879
- * added HTML 'decoding' (basic support for Thunderbird & Outlook)
880
- * updated the Category search so that it matches words as well as numbers (i.e. [General] Subjectname will work instead of just [1] Subjectname)
881
- * Changed time function from time to strtotime (as per Senior Pez's suggestion), but found out that strtotime isn't in default php distro so removed...
882
-
883
- = 0.3 - 2004-09 =
884
- * Added UBB decoding support
885
- * Added default title (when there is no subject assigned)
886
- * Started doing a little code cleanup, been reading Advanced PHP Book :)
887
- *
888
- = 0.2 - 2004-08 =
889
- * Stopped using pear body decoding in favour of own decoding (may be slower but more modifiable) because of enriched text decoding
890
- * Added base64_decode checking (may help mobile phone users)
891
- * Fixed Subject line for non-english users (htmlentities instead of just trim)
892
- * Fixed error in some pop hanging -> more graceful exit on event on no emails in inbox ($pop3->quit)
893
- * Added work around for email addresses with exta <> in field (ie: <blade@lansmash.com> instead of blade@lasmash.com
894
- * Added some ===basic=== enriched text support
895
- * Updated readme file for easier install
896
- * Easy modify of globals (such as PHOTOSDIR and FILESDIR)
897
- * Cleaned up some pear stuff in install
898
- *
899
- = 0.1 - 2004-06 =
900
- * First release
901
-
902
- == Upgrade Notice ==
903
-
904
- = 1.4.4 =
905
- Fixed possible XSS attack vulnerability
 
 
 
 
1
+ === Postie ===
2
+ Contributors: WayneAllen
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HPK99BJ88V4C2
4
+ Author URI: http://allens-home.com/
5
+ Plugin URI: http://PostiePlugin.com/
6
+ Tags: e-mail, email
7
+ Requires at least: 3.0
8
+ Tested up to: 3.4.2
9
+ Stable tag: 1.4.6
10
+ License: GPLv2 or later
11
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
+
13
+ The Postie plugin allows you to blog via e-mail, including many advanced
14
+ features not found in WordPress's default post by e-mail feature.
15
+
16
+ == Description ==
17
+ Postie offers many advanced features for posting to your blog via e-mail,
18
+ including the ability to assign categories by name, included pictures and
19
+ videos, and automatically strip off signatures. It also has support for both
20
+ imap and pop3, with the option for ssl with both. For usage notes, see the
21
+ [other notes](other_notes) page
22
+
23
+ == Screenshots ==
24
+
25
+ 1. Postie options (showing video and audio templates)
26
+ == Installation ==
27
+ * Either:
28
+ * Put the postie.zip file in wp-content/plugins/ and unzip it
29
+ * Or:
30
+ * Use the automatic installer (WP 2.7+)
31
+ * Login to WordPress as an administrator
32
+ * Goto the Plugins tab in the WordPress Admin Site
33
+ * Activate "Postie"
34
+ * Goto to the "Settings" tab and click on the sub-tab "Postie" to configure it.
35
+ * Make sure you enter the mailserver information correctly, including the type
36
+ of connection and the port number. Common port configurations:
37
+ * pop3: 110
38
+ * pop3-ssl: 995
39
+ * imap: 143
40
+ * imap-ssl: 993
41
+ * (Postie ignores the settings under Settings->Writing->Writing-by-Email)
42
+
43
+ = Automating checking e-mail =
44
+
45
+ By default, postie checks for new e-mail every 30 minutes. You can select from
46
+ a number of different checking intervals in the settings page, under the
47
+ mailserver tab.
48
+
49
+ If you would prefer to have more fine-grained control of how postie checks
50
+ for mail, you can also set up a crontab. This is for advanced users only.
51
+ If your site runs on a UNIX/linux server, and you have shell access, you can
52
+ enable mail checking using cron; if you don't know anything about cron, skip
53
+ to the cronless postie section.
54
+
55
+ Setup a cronjob to pull down the get\_mail.php
56
+ Examples:
57
+
58
+ */5 * * * * /usr/bin/lynx --source http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php >/dev/null 2>&1
59
+
60
+ This fetches the mail every five minutes with lynx
61
+
62
+ */10 * * * * /usr/bin/wget -O /dev/null http://blog.robfelty.com/wp-content/plugins/postie/get\_mail.php >/dev/null 2>&1
63
+
64
+ This fetches the mail every ten minutes with wget
65
+ == Usage ==
66
+ * If you put in :start - the message processing won't start until it sees that string
67
+ * If you put in :end - the message processing will stop once it sees that string
68
+ * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
69
+ * delay:1d - 1 day
70
+ * delay:1h - 1 hour
71
+ * delay:1m - 1 minute
72
+ * delay:1d2h4m - 1 day 2 hours 4m
73
+ * By putting comments:X in your message you can control if comments are allowed
74
+ * comments:0 - means closed
75
+ * comments:1 - means open
76
+ * comments:2 - means registered only
77
+ * Replying to an e-mail gets posted as a comment.
78
+ * For example, you e-mailed a post with the subject line "foo".
79
+ If you then send an e-mail with the subject line "Re: foo", it will
80
+ get posted as a comment to the "foo" post. This works by the subject
81
+ line, so if you have two posts with titles "foo", then the comment
82
+ will get placed in the more recent post.
83
+ * Custom excerpt
84
+ * You can include a custom excerpt of an e-mail by putting it between
85
+ :excerptstart and :excerptend
86
+ * You can include images in the excerpt by using the shortcode #eimg1#,
87
+ #eimg2# etc.
88
+
89
+ = Post type =
90
+ You can specify the post type by including it as the first part of the subject
91
+ E.g. <post type>//<real subject>
92
+
93
+ = Category and tag handling =
94
+ * If you put a category name in the subject with a : it will be used
95
+ as the category for the post
96
+ * If you put a category id number in the subject with a : it will
97
+ be used as the category for the post
98
+ * If you put the first part of a category name it will be posted in
99
+ the first category that the system finds that matches - so if you put
100
+
101
+ Subject: Gen: New News
102
+
103
+ The system will post that in General.
104
+
105
+ * All of the above also applies if you put the category in brackets []
106
+ * Using [] or you can post to multiple categories at once
107
+
108
+ Subject: [1] [Mo] [Br] My Subject
109
+
110
+ On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
111
+
112
+ * Using - or you can post to multiple categories at once
113
+
114
+ Subject: -1- -Mo- -Br- My Subject
115
+
116
+ On my blog it would post to General (Id 1), Moblog, and Brewing all at one time
117
+
118
+ = Tags =
119
+ * You can add tags by adding a line in the body of the message like so:
120
+ tags: foo, bar
121
+ * You can also set a default tag to be applied if no tags are included.
122
+
123
+ = Image Handling =
124
+ * Allows you to attach images to your email and automatically post
125
+ them to your blog
126
+ * You can publish images in the text of your message by using #img1#
127
+ #img2# - each one will be replaced with the HTML for the image
128
+ you attached
129
+ * Captions - you can also add a caption like so:
130
+
131
+ * #img1 caption='foo'#
132
+ * #img2 caption='bar'#
133
+
134
+ Or, if you use IPTC captions, this caption will be used (adding a caption
135
+ in many photo editing programs (for example Picasa), will add an IPTC caption)
136
+
137
+ Note that the images are processed in the order they are attached as of version
138
+ 1.4.6.
139
+
140
+ * Image templates
141
+ Postie now uses the default wordpress image template, but you can specify a
142
+ different one if you wish.
143
+
144
+ You can also specify a custom image template. I use the following custom
145
+ template:
146
+
147
+ `<div class='imageframe alignleft'><a href='{IMAGE}'><img src="{THUMBNAIL}"
148
+ alt="{CAPTION}" title="{CAPTION}"
149
+ class="attachment" /></a><div
150
+ class='imagecaption'>{CAPTION}</div></div>`
151
+
152
+ * {THUMBNAIL} gets replaced with the url to the thumbnail image
153
+ * {MEDIUM} gets replaced with the url to the medium-sized image
154
+ * {LARGE} gets replaced with the url to the large-sized image
155
+ * {FULL} gets replaced with the url to the full-sized image
156
+ * {FILENAME} gets replaced with the absolute path to the full-size image
157
+ * {RELFILENAME} gets replaced with the relative path to the full-size image
158
+ * {CAPTION} gets replaced with the caption you specified (if any)
159
+ * {WIDTH} gets replaced with width of the photo
160
+ * {HEIGHT} gets replaced with the height of the photo
161
+
162
+ = Interoperability =
163
+ * If your mail client doesn't support setting the subject (nokia) you
164
+ can do so by putting #your title here# at the beginning of your message
165
+ * POP3,POP3-SSL,IMAP,IMAP-SSL now supported - last three require
166
+ php-imap support
167
+ * The program understands enough about mime to not duplicate post
168
+ if you send an HTML and plain text message
169
+ * Automatically confirms that you are installed correctly
170
+ == Frequently Asked Questions ==
171
+
172
+ = Postie won't connect to my mailserver. Why Not? =
173
+
174
+ Make sure the port you are using is open. For example, bluehost seems to block
175
+ ports 993 and 995 (for pop3-ssl and imap-ssl) by default. I have heard that
176
+ you can request that they open them for you ( you might have to pay extra).
177
+
178
+ You can check for open ports with the following command on your server:
179
+ netstat -ln|grep -E ':::(993|995|143)'
180
+
181
+ If nothing shows up, then the ports are not open.
182
+
183
+ = How can I get postie to display inline images? =
184
+
185
+ Make sure that you send e-mail formatted as html (richtext), and set postie to
186
+ prefer html messages (in the message tab of the postie settings)
187
+
188
+ = Mail is not showing up right when I send html (rich formatted) e-mail! =
189
+
190
+ Make sure you set the preferred text type to html
191
+
192
+ = Do I need to any code to my theme for postie to work? =
193
+
194
+ No.
195
+
196
+ = I read somewhere to add an iframe to my footer. Should I do this? =
197
+
198
+ No. Do not add an iframe in your footer to get postie to check mail
199
+ periodically. To check e-mail periodically, either set-up a cron job, or use
200
+ cronless postie. See installation instructions
201
+
202
+ = My mail host requires SSL, but postie will not allow me to select pop3-ssl or imap-ssl =
203
+
204
+ You must have php-imap installed on your server for this to work. Ask your
205
+ hosting provider about this.
206
+
207
+ = Can I use postie to check a gmail account? =
208
+
209
+ Yes. You can use either pop3-ssl or imap-ssl with a gmail account. Before
210
+ attempting to use with postie, make sure that you enable pop or imap in your
211
+ gmail preferences.
212
+
213
+ * Pop3 settings:
214
+ * protocol - pop3-ssl
215
+ * server - pop.gmail.com
216
+ * port - 995
217
+ * userid - your username (e.g. if your e-mail address is foo@gmail.com,
218
+ this would be just foo)
219
+ * password - your password
220
+ * IMAP settings:
221
+ * protocol - imap-ssl
222
+ * server - imap.gmail.com
223
+ * port - 993
224
+ * userid - your username (e.g. if your e-mail address is foo@gmail.com,
225
+ this would be just foo)
226
+ * password - your password
227
+
228
+ = My posts show up as being posted by 'admin' instead of me. Why? =
229
+
230
+ If your admin account is linked to bar@gmail.com, and you send mail from
231
+ bar@gmail.com, it will show up as being posted by admin. If you have a
232
+ wordpress user named "John Doe", which is linked to johndoe@gmail.com, make
233
+ sure that you send e-mails from johndoe@gmail.com. It doesn't matter which
234
+ e-mail address postie is checking. That is, if you send mail from
235
+ johndoe@gmail.com to foo@gmail.com, it gets posted as "John Doe".
236
+
237
+ If you send an e-mail to your postie address from an e-mail address that is no
238
+ t linked to a wordpress user, it will get posted as admin.
239
+
240
+ = Images aren't showing up at all? =
241
+
242
+ There are a couple possible reasons for this. First, check to see if you can
243
+ add an image through wordpress's normal posting mechanism. If not, then there
244
+ is probably 1 or 2 problems:
245
+ 1. Your server does not have the php-gd library installed. Ask your hosting
246
+ provider about this.
247
+
248
+ 2. Your wp-content/uploads directory is not writable by the webserver. Make
249
+ sure that it is
250
+
251
+ = Can I delete the wp-files directory needed by postie version <1.3.0? =
252
+
253
+ If you have posts published already by older versions of postie, getting rid
254
+ of those directories will delete any files you might have had associated with
255
+ those old posts. If you don't have any such posts, then you can safely delete
256
+ them.
257
+
258
+ = How can I get rid of stupid stuff my e-mail provider adds to my messages? =
259
+
260
+ To strip off stuff that they add at the beginning of a message, start your
261
+ post with :start
262
+
263
+ To strip off stuff that they add at the end of a message, end your
264
+ post with :end
265
+
266
+ = How can I add custom attachment icons? =
267
+
268
+ Simply upload the icons you want to the postie/icons/custom directory. You
269
+ must name the icons according to the following scheme:
270
+ `{filetype}-{size}.png`
271
+
272
+ For example, for word documents, you could use:
273
+
274
+ `doc-32.png`
275
+
276
+ for a 32x32 pixel icon. (You can actually create any size icon you want, but
277
+ if you name it 32, then it will only be used if you select to use size 32
278
+ icons)
279
+
280
+ See the other directories in icons for more examples.
281
+
282
+ Currently the following filetypes are supported:
283
+
284
+ * doc - microsoft word (including docx)
285
+ * ppt - microsoft powerpoint (including pptx)
286
+ * xls - microsoft excel (including xlsx)
287
+ * numbers - iWork numbres spreadsheet
288
+ * pages - iWork pages document
289
+ * key - iWork keynote presentation
290
+ * pdf - portable document format
291
+ * rtf - rich text format
292
+ * txt - plain text document
293
+
294
+ = Can I add special text to the body of the post when using postie? =
295
+
296
+ Yes. You can create your own function, and use the postie_post filter.
297
+ Two short examples are included in the filterPostie.php.sample file
298
+
299
+ = Can I add special text to the title of the post when using postie? =
300
+
301
+ Yes. You can create your own function, and use the postie_post filter.
302
+ Two short examples are included in the filterPostie.php.sample file
303
+
304
+ = Can I select tags or categories based on the content of the e-mail? =
305
+
306
+ Yes. You can create your own function, and use the postie_post filter.
307
+ See the filterPostie.php.sample file for examples.
308
+
309
+ = Is the IMAP extension required for postie? =
310
+
311
+ The IMAP extension is not required, but it is strongly recommended, especially
312
+ is you are using non-English text. There is more information on php.net about
313
+ installing the IMAP extension. If you have control over your server, it is
314
+ often not hard to install.
315
+
316
+ On Ubuntu, try
317
+ `sudo apt-get install php5-imap`
318
+
319
+ On Fedora, try
320
+ `sudo yuminstall php-imap`
321
+
322
+ The IMAP extension is known to be installed on the following popular webhosts:
323
+ * Dreamhost
324
+
325
+ = How can I embed youtube or vimeo videos? =
326
+
327
+ Simply put the url in the body of your e-mail. (Make sure that you have the
328
+ option to convert url into links turned on)
329
+
330
+ = Something is going wrong, how do I see what is happening? =
331
+
332
+ Add the following lines to your wp-config.php file
333
+ `define('WP_DEBUG', true);
334
+ define('WP_DEBUG_LOG', true);
335
+ define('POSTIE_DEBUG', true);`
336
+
337
+ Various errors, warning and informational will be written to the wp-content\debug.log
338
+ file. There may also be all sorts of warnings and messages in your site as well
339
+ depending on how well behaved your other plugins and themes are, so you will not
340
+ want to leave these settings set to true all the time.
341
+
342
+ = Why doesn't Postie automatically publish my emails when running manually works =
343
+
344
+ WordPress cron (which Postie relies on) doesn't run unless a page is accessed on the
345
+ site. So if you send an email, but nobody accesses the site for 3 days Postie won't
346
+ be given the chance to fetch the email and publish the post.
347
+
348
+ To ensure that Postie runs smoothly on a low or no volume site you need to ensure that
349
+ a page gets hit (any page is fine). Use something like cron + curl on Linux or install
350
+ curl on Windows and use the Scheduled Tasks control panel. If you are using a hosting company
351
+ that doesn't allow you access to cron you can use a service like
352
+ <a href="https://www.setcronjob.com/" target="_blank">SetCronJob</a>.
353
+
354
+ It is also possible to turn the WordPress cron off. Please make sure something like
355
+ define('DISABLE_WP_CRON', true); is not in your wp-config.php file.
356
+ == Upgrade Notice ==
357
+ * Attachments are now processed in the order they were attached.
358
+ * XSS detection only issues a warning now
359
+
360
+ == CHANGELOG ==
361
+
362
+ = 1.4.6 (2012.12.06) =
363
+ * Changed XSS check to only emit warning until a better solution can be developed
364
+ * Fixed bug where authorized addresses were being checked with case sensitive rather than insensitive.
365
+ * Started using PHP Simple HTML DOM Parser http://simplehtmldom.sourceforge.net/
366
+ * Started process of logging all error messages to the log as well as the page (where appropriate)
367
+ * Fixed bug where "Preferred Text Type" was not displaying the saved value in settings page.
368
+ * Fixed bug where Postie was wiping out all other cron schedules.
369
+ * Fixed a number of missing internationalization strings (no translations added however)
370
+ * Added documentation for the comments: command
371
+ * Added feature to specify a custom post type in the subject line. Thanks to Raam Dev http://raamdev.com for his code.
372
+ * Removed a number of deprecated WordPress functions.
373
+ * Fixed numerous warning messages
374
+ * Added phpUnit tests
375
+ * Allow wp-config.php to be in alternate location as described here: http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php
376
+ * Fix a bug that didn't replace the #img# tags correctly.
377
+
378
+ = 1.4.5 (2012.11.14) =
379
+ * Fixed bug in XSS attack vulnerability code. Thanks to R Reid http://blog.strictly-software.com/2012/03/fixing-postie-plugin-for-wordpress-to.html
380
+ * Fixed bug where emails with multiple categories has the incorrect title
381
+ * Fixed bugs where PHP setting were not being changed correctly - thanks to Peter Chester http://tri.be/author/peter/
382
+ * New maintainer
383
+
384
+ = 1.4.4 (2012.08.10) =
385
+ * Fixed possible XSS attack vulnerability
386
+
387
+ = 1.4.3 =
388
+ * Removed get_user_by function to make compatible with wp 3.3 - now requires
389
+ 2.8+
390
+
391
+ = 1.4.2 (2011.01.29) =
392
+ * Fixed mailto link bug (thanks to Jason McNeil)
393
+ * Fixed bug with attachments with non-ascii characters in filename (thanks to
394
+ mtakada)
395
+ * checking for socket errors when checking mail (thanks elysian)
396
+ * fixed issue with multiple files not being inserted correctly
397
+ * Added support for ISO 8859-15 (thanks paolog)
398
+ * fixed sql injection problem (thanks Jose P. Espinal for pointing it out)
399
+ * Fixed namespace clashing for get_config function
400
+
401
+ = 1.4.1 (2010.06.18) =
402
+ * Images appear in correct order when using images append = false
403
+ * Fixed formatting problem with wordpress_default image template
404
+ * Captions now correctly work with wordpress >3.0 and <3.0
405
+ * Fixed auto_gallery feature
406
+ * Default port is now 110
407
+ * Added more configuration tests
408
+ * Added background color to settings page to make input boxes more visible
409
+ * Removed extra quote character in captions from #img# placeholders (thanks
410
+ SteelD for pointing out the error)
411
+ * Added support for big5 and gb-1232 encodings (thanks Chow)
412
+ * Fixed issue with configurations items stored as arrays, which caused
413
+ problems with validating authorized addresses
414
+ * Fixed bug with replaceImageCIDs function
415
+ * On hosts which allow it, we set max execution time to 300 seconds and
416
+ memory_limit to infinity to allow processing of large e-mails (especially
417
+ with large attachments)
418
+ * Images are sorted in order of filename before inserting into post
419
+
420
+ = 1.4 (2010.04.25) =
421
+ * Now using wordpress settings api (thanks for much help from Andrew S)
422
+ * Cronless postie is now integrated with postie instead of a separate plugin
423
+ * filterPostie.php moved to filterPostie.php.sample
424
+ * Can use fetchmails.php to fetch mail from multiple mailboxes
425
+ * Fixed problem with embedding youtube videos from html (richtext) e-mail
426
+ * Added support for embedding vimeo vidoes
427
+ * Fixed problem with selecting "none" as icon set for attachments (thanks
428
+ tonyvitali)
429
+ * Fixed problems with cronless postie settings
430
+ * Fixed bug with embedding youtube and vimeo videos whose ID contains a -
431
+ (thanks Jim Kehoe)
432
+ * Post_author is now included with attachments
433
+ * fixed confirmation_email settings so that now you can select between sender,
434
+ admin, both, or none (thanks to redsalmon for pointing out bug)
435
+ * Added option to automatically insert galleries
436
+ * Updated FAQ and readme
437
+
438
+ = 1.3.4 (2009.10.05) =
439
+ * Fixed problem with images not posting under cron
440
+ * Fixed issue with disappearing password
441
+
442
+ = 1.3.3 (2009.09.11) =
443
+ * Fixed problem with double titles
444
+ * Fixed error in wp-mu
445
+ * Cronless postie now correctly updates when changing the setting in the
446
+ postie settings
447
+ * Small fix in handling of names of attachments (thanks to Teejot)
448
+ * Fixed delay option (thanks to redbrandonk)
449
+ * Cronless option value is now correctly deleted when deactivating the
450
+ cronless postie plugin
451
+
452
+ = 1.3.2 (2009.08.27) =
453
+ * tags are now always an array, even if no default tags are set
454
+ * Subject is showing up again if you do not have the IMAP extension
455
+ installed
456
+ * More information on the IMAP extension and more user-friendly
457
+ installation
458
+ * Fixed problems with smtp server settings in 1.3.1
459
+ * Added russian translation (thanks to fatcow.com)
460
+
461
+ = 1.3.1 (2009.08.24) =
462
+ * Changed GetContent filter to postie_post
463
+ * Added database upgrade hook on activation
464
+ * Fixed bug where content would be empty if trying to remove signature,
465
+ and signature list was emtpy
466
+ * Updated FAQ and readme
467
+
468
+ = 1.3.0 (2009.08.14) =
469
+ * Features
470
+ * Added mpeg4 to default list of videotypes
471
+ * Added support for KOI8-R character set (cyrillic)
472
+ * Added support for iso-8859-2 character set (eastern european)
473
+ * Added option to include custom icons for attachments
474
+ * Added option to send confirmation message to sender
475
+ * Enhanced e-mails for unauthorized users
476
+ * Added option to send unauthorized e-mail back to sender
477
+ * Added option to only allow e-mails from a specified list of smtp
478
+ servers
479
+ * Added option to use shortcode for embedding videos (works with the
480
+ videos plugin http://www.daburna.de/download/videos-plugin.zip
481
+ * Better handling of comment authors (thanks to Petter for suggestion)
482
+ * Simplified message options (now includes an advanced options section)
483
+ * Added filter ability for post content
484
+ * Bug fixes
485
+ * No longer including wp-config.php
486
+ * If tmpdir is not writable, try a different tmpdir
487
+ * More subject encoding fixes
488
+ * Updated image templates, which were causing problems for cron
489
+ * Fixed in text captions
490
+ * Fixed SQL problems when updating options
491
+ * Fixed name clashes with other plugins
492
+ * Fixed custom image field
493
+
494
+ = 1.3.beta (2009.07.01) =
495
+ * Mores fixes for character issues in subject
496
+ * Now handling Windows-1256 (arabic) character set
497
+ * Fixed image uploading on windows servers
498
+ * Fixed replying to message adds comment
499
+ * Uploading pictures via MMS should now work
500
+ * Fixed some issues with e-mails from outloook 12
501
+ * Greatly reduced number of database queries
502
+ * No longer requiring config_handler.php
503
+
504
+ = 1.3.alpha (2009.06.05) =
505
+ * Now using default wordpress image and upload handling, which means:
506
+ * No more creating special directories for postie
507
+ * No more confusion about imagemagick
508
+ * Can now use the [gallery] feature of wordpress
509
+ * Attachments are now connected to posts in the database
510
+ * All image resizing uses wordpress's default settings (under media)
511
+ * Configuration, settings and documentation improvements
512
+ * Completely redesigned settings page (mostly thanks to Rainman)
513
+ * Reset configuration no longer deletes mailserver settings
514
+ * Now including help files and faq directly in settings page
515
+ * More media features
516
+ * Automatically turn links to youtube into an embedded player
517
+ * Added option to embed audio files with custom templates
518
+ * Video options are now template based
519
+ * Image options are now solely template based, with several new default
520
+ templates
521
+ * Bug fixes
522
+ * Uploading images from vodafone phones should now work
523
+ * Correctly handling Windows-1252 encoding
524
+ * Correctly handling non-ascii characters in subject line
525
+
526
+ = 1.2.3 (2009.05.17) =
527
+ * Fixed headers already sent bug
528
+ * Converted shortcode `<?` to proper `<?php` (thanks brack)
529
+ * Deleting mails after processing again
530
+
531
+ = 1.2.2 (2009.05.15) =
532
+ * Show empty categories for default category in options
533
+ * Image scaling fixed so that the smaller value of max image width and max
534
+ image height is used
535
+ * Fixed some issues with parsing html e-mail
536
+ * Got rid of stupid mime tag (thanks Jeroen)
537
+ * No longer adding slashes before calling wp_insert_post
538
+ * When using custom image field, each image has a unique key
539
+
540
+
541
+ = 1.2.1 (2009.05.07) =
542
+ * Got rid of stupid version checking
543
+ * Improved cronless postie instructions and configuration
544
+ * Internationalization is working now
545
+ * Dutch localization (thanks to gvmelle http://gvmelle.com )
546
+ * Fixed caption bug when using image magick
547
+ * Added option to not filter new lines (when using markdown syntax)
548
+ * Fixed autoplay option
549
+ * Can now use wildcards in excluding filenames
550
+ * Producing better quality thumbnails (thanks to robcarey)
551
+
552
+ = 1.2 (2009.04.22) =
553
+ * More video options:
554
+ * Can embed 3gp, mp4, mov videos
555
+ * Can specify video width, video height, player width, and player height
556
+ in the settings page
557
+ * Can specify custom image template
558
+ * Image handling improvements:
559
+ * Only downscale images, not up-scale (thanks Jarven)
560
+ * More custom image template options
561
+ * IPTC captions now also work when not resizing images
562
+ * Added option to use custom field for images (for Datapusher)
563
+ * Fixed some issues with image templates and line break handling
564
+ * Custom image template now works even when not resizing images
565
+ * Documentation improvements:
566
+ * Added links to settings, forum, and readme in plugin description
567
+ * Updated readme (thanks to Venkatraman Dhamodaran)
568
+ * Added better instructions on how to use cronless postie
569
+ * Text processing improvements:
570
+ * Added option to automatically convert urls into links
571
+ * Added feature to include a custom excerpt
572
+ * Miscellaneous improvements
573
+ * Improved internationalization (thanks to Håvard Broberg
574
+ (nanablag@nanablag.com))
575
+ * Bug Fixes
576
+ * Removed debugging info in get_mail.php (security issue) thanks to
577
+ [Jens]( http://svalgaard.net/jens/)
578
+ * No longer directly including pluggable.php (should
579
+ prevent conflicts with other plugins such as registerplus
580
+
581
+
582
+ = 1.1.5 (2009.03.10) =
583
+ * Added option to have postie posts be pending review, published, or draft
584
+ * Settings panel only shows up for administrators
585
+ * Need not be user "admin" to modify settings or to post from non-registered
586
+ users
587
+ * Can now set administrator name. Authorized e-mail addresses which don't
588
+ have a user get posted under this name
589
+ * Will use IPTC captions if available
590
+ * Added option to replace newline characters with <br />
591
+
592
+ = 1.1.4 (2009.03.06) =
593
+ * Added more image options (open in new window, custom image template)
594
+ * can now add captions to images
595
+ * Can now add tags (including default tag option)
596
+
597
+ = 1.1.3 (2009.02.20) =
598
+ * Fixed delayed posting
599
+ * updated readme some
600
+
601
+ = 1.1.2 (2008.07.12) =
602
+ * now maintained by Robert Felty
603
+ * allow negative delays
604
+ * will glean author information from forwarded or redirected e*mails
605
+ * replying to an e*mail adds a comment to a post
606
+ * fixed category handling to work with taxonomy
607
+ * fixed one syntax error
608
+ * added option to wrap posts and comments in <pre%gt; tags
609
+
610
+
611
+ = 1.1.1 =
612
+
613
+ Below is all the of the version information. As far as I can tell there once was a guy named John Blade. He took some of the original wp-mail.php code
614
+ and started hacking away on it. He actually got pretty far. About the time I discovered WordPress and his little hack - called WP-Mail at the time - he
615
+ went on a vacation or something. There were some problems with the script, and it was missing some features I wanted. I hacked away at it and got it
616
+ into a place where it did what I wanted. I started posting about it since I figured other people might want the features.
617
+
618
+ John didn't release any more versions at least up til July 2005. So I started accepting submissions and feature requests from people to help make the
619
+ code better. In June/July 2005 I discovered a little plugin by Chris J Davis (http://www.chrisjdavis.org/cjd-notepad/) called notepad. I added a small
620
+ feature to it (basically a bookmarklet). In the process I started looking at his code and realized how much you could do with the plugin system
621
+ available in Word Press.
622
+
623
+ So I decided to make an offical fork. I put up an article on my blog asking for new names. I picked Postie. I then modified the code to be a proper
624
+ plugin. And the rest is history :)
625
+
626
+ * BUGFIX -problem with subject
627
+ * BUGFIX -cronless postie typo
628
+
629
+ = 1.1 =
630
+ * FEATURE: Updated and tested with WordPress 2.1
631
+ * BUGFIX:Removed deprecated functions
632
+ * FEATURE: Cronless Postie now uses the WordPress native Psuedo Cron.
633
+
634
+ = 1.0 =
635
+ * BUGFIX: TestWPVersion broke with 2.1
636
+ * FEATURE: end: now marks the end of a message (Dan Cunningham)
637
+ * FEATURE: Better Readme (Michael Rasmussen)
638
+ * FEATURE: Smart Sharpen Option -EXPERIMENTAL- (Jonas Rhodin)
639
+ * BUGFIX: Issue with google imap fixed (Jim Hodgson)
640
+ * BUGFIX: Fixed espacing issue in subjects (Paul Clip)
641
+ * BUGFIX: Typo in Div fixed (phil)
642
+
643
+ = 0.9.9.3.2 =
644
+ * BUGFIX: Typo
645
+ = 0.9.9.3.1 =
646
+ * BUGFIX: Removed debugging code
647
+
648
+ = 0.9.9.3 =
649
+ * BUGFIX: If your email address matches an existing user - then it will post as that user - even if you allow anyone to post.
650
+ * BUGFIX: Replaced get_settings('home') with get_settings('siteurl')
651
+ * BUGFIX: Better handling for Japanese charactersets - Thanks to http://www.souzouzone.jp/blog/archives/009531.html
652
+ * BUGFIX: Better thumbnail window opening code - thanks to Gabi & Duntello!
653
+ * FEATURE: Added an option to set the MAX Height of an image - idea from Duntello
654
+ * BUGFIX: Modified the FilterNewLines for better flowed text handling - You now HAVE TO PUT TWO NEW LINES to end a paragraph.
655
+ * FEATURE: Added new CSS tags to support positioning images/attachments/3gp videos
656
+ * BUGFIX: Tries to use the date in the message (Thanks Ravan) I tried this once before and it never worked - hopefully this time it will.
657
+ * BUGFIX: Added a workaround to fix the problem with Subscribe2 - it will now notify on posts that are not set to show up in the future.
658
+
659
+
660
+
661
+ = 0.9.9.2 =
662
+ * BUGFIX: Looks for the NOOP error and disgards it
663
+ * FEATURE: Postie now detects the version of WordPress being used
664
+ * FEATURE: Smarter Parsing of VodaPhone
665
+ * FEATURE: Easy place to add new code to handle other brain-dead mail clients
666
+ * BUGFIX: Handles insertion of single quotes properly
667
+ * BUGFIX: Thumbnails should now link properly
668
+
669
+ = 0.9.9.1 =
670
+ * BUGFIX: Needed a strtolower in places to catch all iso-8859 - thx to Gitte Wange for the catch
671
+ * BUGFIX: Fixed issue with the category not being posted properly
672
+
673
+ = 0.9.9 =
674
+ * UPDATE TO WP 2.0
675
+ * BUGFIX: Config Page now works
676
+ * FEATURES: Supports role based posting
677
+ * BUGFIX: Posting updates the category counts.
678
+
679
+ = 0.9.8.6 =
680
+ * BUGFIX: Fixed problems with config page <%php became <?php
681
+ *
682
+ = 0.9.8.5 =
683
+ * BUGFIX: onClick changed to onclick
684
+ * BUGFIX: strolower added to test for iso - thanks daniele
685
+ * BUGFIX: Added a class to the 3gp video tags
686
+ * FEATURE: Added the option to put the images before the article
687
+ * BUGFIX: Added in selection for charsets - thanks Psykotik - this may cause problems for other encodings
688
+ * FEATURE: Added option to turn of quoted printable decoding
689
+ * FEATURE: :start tag - now postie looks for this tag before looking for you message - handy if your service provider prepends a message
690
+ * FEATURE: Template for translation now included
691
+ = 0.9.8.4 =
692
+ * BUGFIX: Fixed problem with config_form.php - select had "NULL" instead of ""
693
+ * BUGFIX: 3g2 now supported
694
+ * BUGFIX: More line break issues addressed
695
+ * BUGFIX: QuickTime controls are now visible even if the movie is done playing
696
+ * BUGFIX: Email addresses in the format <some@domain.com> (Full Name) supported
697
+ * BUGFIX: Some images that were not being resized - are now
698
+ * BUGFIX: HTML problems - if you posted plain text with HTML on it ignored all images
699
+ * BUGFIX: The test system blew up on the thumbnails
700
+ * BUGFIX: Selected HTML for preferred text is now shown in the config form properly
701
+ * BUGFIX: Postie now complains if it is not in its own directory
702
+ * BUGFIX: Postie doesn't include PEAR if it is already available
703
+ * BUGFIX: In Test mode rejected emails are simply dropped
704
+ * BUGFIX: Markdown messes up Postie - it will warn you if you turn it on.
705
+ *
706
+ = 0.9.8.3 =
707
+ * BUGFIX: Fixed issue with the line feed replacement
708
+ * BUGFIX: Added Banned File Config back in
709
+ * FEATURE: Added in a link around 3gp video embedded via QT
710
+ * BUGFIX: Email that has both Plain and HTML content will show the HTML content and not the plain if html is preferred
711
+
712
+ = 0.9.8.2 =
713
+ * BUGFIX: Fixed an extra new line after attachin non-image files.
714
+ * BUGFIX: The Test system now displays any missing gd functions
715
+ * BUGFIX: The test system was only using ImageMagick
716
+
717
+ = 0.9.8.1 =
718
+ * BUGFIX: The test images are now included in the zip
719
+
720
+ = 0.9.8 =
721
+ * BUGFIX: New Lines detected and handled properly in cases where the mail client doesn't put a space before the new line (Miss Distance)
722
+ * BUGFIX: 3gp mime type added (Paco Cotera)
723
+ * BUGFIX: Authorized Email Addresses are not case-insensitive
724
+ * FEATURE: The larger image now does a proper pop up
725
+ * BUGFIX: Fixed Timeing Issue - turns out it wasn't reading the db at all
726
+ * FEATURE: New Test Screen - to help track down problems
727
+
728
+ = 0.9.7 =
729
+ * BUGFIX: removed all short tags
730
+ * BUGFIX: There were spacing issues in the way I wrote the QT embed statements
731
+ * FEATURE: Added calls to WP-Cron - should work with that properly now if you activate Cronless Postie
732
+ * FEATURE: ImageMagick version works without any calls to GD
733
+ * BUGFIX: Postie now correctly handles cases wjere tjere are multiple blogs in one db
734
+ * BUGFIX: Turned off warnings when using without GD
735
+ * FEATURE: add the rotate:X to your message to rotate all images
736
+ * FEATURE: new filter_postie_thumbnail_with_full which makes it easy to show a thumbnail on the front page but full image on the single page - see FAQ
737
+
738
+ = 0.9.6 =
739
+ * BUGFIX: handles email addresses that are no name and just <email@email.com> (Steve Cooley Reported)
740
+ * FEATURE: Basic support for embedding flash files
741
+ * BUGFIX: Postie now handles creating the correct URL on non Unix platforms
742
+ * BUGFIX: Fixed problem with file attachments not being put in the right place.
743
+ * FEATURE: You can now choose to use imagemagick convert to handle making thumbnails
744
+ * BUGFIX: Rewrote Cronless Postie to use direct sockets
745
+ * BUGFIX: Time offset is now settable just for Postie - hopefully this will fix problems for cases where the normal time offset doesn't work properly.
746
+ * FEATURE: First draft of frame for a 3GP video
747
+ * FEATURE: Option to embed 3GP in QuickTime Controller.
748
+
749
+ = 0.9.5.2 =
750
+ * BUGFIX: gmt varialble not being set correctly
751
+ * BUGFIX: Changed the name of the Check Mail button to fix an issue with mod_security
752
+ * BUGFIX: Fixed issue with Cronless-Postie
753
+ * BUGFIX: There was an argument passed by reference incorrectly
754
+ * FEATURE: Added in Cronless Postie Readme
755
+ * FEATURE: Added in Postie Readme
756
+
757
+ = 0.9.5.1 =
758
+ * BUGFIX: Confirmed POP3-SSL on debian-3.0
759
+ * BUGFIX: Updated the plugin version
760
+ * BUGFIX: Stopped displaying the email account
761
+ *
762
+ = 0.9.5 =
763
+ * BUGFIX: Postie handles cases where you do not have GD
764
+ * FEATURE: You can now set the access level for posting - so other people can use the gate way
765
+ * BUGFIX: Fixed issue when admininstrator email is not tied to a user account.
766
+ * FEATURE: Can now reset all Postie configurations back to defaults
767
+ * BUGFIX: HTML Emails with embedded images are now handled properly.
768
+ * BUGFIX: The time difference should work correctly now
769
+ * BUGFIX: Postie's configs are completely seperate from Writing-By-Mail
770
+ * FEATURE: Warning if you use Gmail to make sure you turn on POP support
771
+ * BUGFIX: Manual Check Mail Button in interface
772
+ * BUGFIX: fixed issue of compatability with cjd-notepad
773
+ * BUGFIX: Windows Works Now
774
+
775
+
776
+ = 0.9.4 =
777
+ * BUGFIX: Cronless Postie - fixed the include statement
778
+ * BUGFIX: Authorized Addresses now supports a single address
779
+ * FEATURE: All configuration in Postie done in a single screen
780
+ * FEATURE: AUTHORIZATION can be completely overridden
781
+ * BUGFIX: line 1159 - didn't handle cases where the table didn't exist already very well
782
+ * FEATURE: Detects if you can do IMAP
783
+ * FEATURE: Added IMAP Support
784
+ * FEATURE: Added IMAP-SSL Support
785
+ * FEATURE: Added POP3-SSL Support
786
+
787
+ = 0.9.3 =
788
+ * Bug fixes for IIS
789
+ = 0.9.2 =
790
+ * Moved to more of a DIRECTORY_SEPARATOR structure
791
+ = 0.9.1 =
792
+ * Added a define to fix a problem with over including
793
+ = 0.9 =
794
+ * Converted to an honest to god plugin
795
+ * BUGFIX: If you put a single category:subject it now works
796
+ * BUGFIX: ? Special characters may be supported? The test post now shows a lot of umlats and accents?
797
+ * BUGFIX: The last ] in a subject with categories is now filtered out
798
+ * FEATURE: -1- subject - will put the post in category 1
799
+ = 0.312.13 =
800
+ * Code clean up - The main loop is finally readable by even non programmers
801
+ * FEATURE - You can now post to multiple categories at one time by using the [#],[Category Name], [Cat] in the subject
802
+ * FEATURE - You can now select a category by just including the begining characters [G] will select General
803
+ * if you don't have any other categories that start with g
804
+ * FEATURE - Jay Talbot - added a new feature so you can have multiple email addresses be allowed in
805
+ * Make multi category posting more obvious
806
+ * BUG FIX: Timezones of GMT+? should now work properly
807
+ * BUG FIX: Able to handle mis-mime typed images as long as they are named with .jpg/.gif/.png
808
+
809
+ = 0.312.12 =
810
+ * Code clean up - slowing shrinking the main to make it easiery to fix things
811
+ * FEATURE: Be able to turn on/off allowing comments in an email
812
+ * BUG FIX: AppleDouble now mostly supported
813
+ * BUG FIX: MIME handling improved.
814
+ * BUG FIX: Fix issue with timing delay
815
+ = 0.312.11 =
816
+ * FEATURE: Patterns to define where a sig starts are user configurable
817
+ * FEATURE: Add filter options for banned file names
818
+ * BUG FIX: Made it possible to turn off posting to the db for testing purposes
819
+ = 0.312.10 =
820
+ * FEATURE: Added in code to diplay the mime type of the file being linked to
821
+ * BUG FIX: It now tests for the existance of the directories and makes sure
822
+ * that the web server can write to them
823
+ = 0.312.9 =
824
+ * FEATURE:Should handle jpg as well as jpeg as the file type
825
+ * BUG FIX: Now correctly handles the subject in the message
826
+ * BUG FIX: Should handle Text preferences correctly
827
+ = 0.312.8 =
828
+ * Some general code tidying.
829
+ * FEATURE: Can now have email from invalid email addresses automatically forwared
830
+ * to the admin's email account. This forward includes all attachments.
831
+ * Props to David Luden for getting this started.
832
+ * Minor change: The system will continue if it runs into a message that doesn't have
833
+ * any content - it will also continue to process if it gets an email from
834
+ * someone not in the system. In the past this could result in deleted mail
835
+ * if your cron job didn't run often enough.
836
+ = 0.312.7 =
837
+ * Confirm the handling of 3gp video for cell phones o
838
+ * Added in new directive SUPPORTED_FILE_TYPES -if the mime type is listed here then the system will try to make a link to it without making a thumb nail.
839
+ = 0.312.6 =
840
+ * Bug Fix: Ok the last bug I fixed - actually caused another bug - man I should set up some unit tests. Now it handles mail from the nokia mail client correctly.
841
+ = 0.312.5 =
842
+ * Bug Fix : The system was accepting all test/* types. Now you can set a preference (defaults to text/plain)
843
+ * to use as the main text for the post.
844
+ = 0.312.4 =
845
+ * Added in sanitize_title call suggested by Jemima
846
+ * Added in ability to provide a subject in an mms - by using #Subject#
847
+ * Fixed an issue with the time stamp system so it now automatically uses the gmt_offset from WordPress
848
+ * Fixed issue with the delay:1d1h tag that prevented it from being removed from the body.
849
+ * Fixed issue with the delay tag that caused problems if it was the last thing before an image.
850
+
851
+ = 0.312.3-HEY (2005-05) =
852
+ * > Some changes and Bugfixes by Adrian Heydecker
853
+ * > Not (yet) in main development branch.
854
+ * Fixed bug: JPEG-thumbnails had a bigger filesize than full images caused by bad hardcoded compression value.
855
+ * Fixed bug: If images and signatures were present but no placeholder tags, the images were deleted together with the signature.
856
+ * Fixed bug: Generates valid postnames for users of mod_rewrite. Permalinks to posts should now work even when whitespaces are present in the subject line.
857
+ * Added support for Quoted Printable encoded mail.
858
+ * Added ability to encode Wordpress-posts in charset ISO-8859-1 instead of UTF-8.
859
+ * Added ability to choose JPEG-compression value for thumbnails.
860
+ * Added ability to add class="" and style="" to images.
861
+ * Added ability to use a different mailadress (eg. mobile) without setting up a new Wordpress-account.
862
+
863
+ = 0.312.2 =
864
+ * BUGFIX: It now removes the delay tag from the message
865
+ = 0.312.1 =
866
+ * Added modification for placeholder support for images (David Luden)
867
+ * Added in support to automatically scale down big images (Dirk Elmendorf)
868
+ * Fixed bug with multiple emails all getting the contents of the first image tag (Dirk Elmendorf)
869
+ * Added option to allow HTML in the body and subject of the email (Dirk Elmendorf)
870
+ * Switch config options to defines to reduce the number of global variables (Dirk Elmendorf)
871
+ * Added tests to make sure there is a trailing slash on the DIR definitions (Dirk Elmendorf)
872
+ * Add tests to see if they have gd installed (Dirk Elmendorf)
873
+ * Seperate the scaling out to a function for easier usage (Dirk Elmendorf)
874
+ * Add delay feature for future posting. (Dirk Elmendorf)
875
+ * Added in ability to use strtotime if it is available (Dirk ELmendorf)
876
+
877
+ * Todo
878
+ * Have option to have the email that is rejected forwarded on to another address.
879
+ * Fix bug that id still diplays the delay tag in the body
880
+ = 0.312 - 2005-03 =
881
+ * CHANGE FOR DEFAULT E-mail Categories, instead of [General] Subject you can now use General: Subject in the subject line. Less typing, and there must be a space after the colon.
882
+ * Fixed bugs with no default posting for categories and user
883
+ = 0.311 - 2005-01 =
884
+ * eep, major bug for pop3 server. Next time I test my code more before I released, fixed so that pop3 now works.`
885
+ = 0.31 - 2004-12 & 2005-01 =
886
+ * (Has it been this long, best get back into the swing of things... did most of this coding on my holiday as I didn't have a machine to play WoW on :)
887
+ * moved the deletion of pop3 emails into a check so that e-mails aren't deleted without proper checking.
888
+ * added HTML 'decoding' (basic support for Thunderbird & Outlook)
889
+ * updated the Category search so that it matches words as well as numbers (i.e. [General] Subjectname will work instead of just [1] Subjectname)
890
+ * Changed time function from time to strtotime (as per Senior Pez's suggestion), but found out that strtotime isn't in default php distro so removed...
891
+
892
+ = 0.3 - 2004-09 =
893
+ * Added UBB decoding support
894
+ * Added default title (when there is no subject assigned)
895
+ * Started doing a little code cleanup, been reading Advanced PHP Book :)
896
+ *
897
+ = 0.2 - 2004-08 =
898
+ * Stopped using pear body decoding in favour of own decoding (may be slower but more modifiable) because of enriched text decoding
899
+ * Added base64_decode checking (may help mobile phone users)
900
+ * Fixed Subject line for non-english users (htmlentities instead of just trim)
901
+ * Fixed error in some pop hanging -> more graceful exit on event on no emails in inbox ($pop3->quit)
902
+ * Added work around for email addresses with exta <> in field (ie: <blade@lansmash.com> instead of blade@lasmash.com
903
+ * Added some ===basic=== enriched text support
904
+ * Updated readme file for easier install
905
+ * Easy modify of globals (such as PHOTOSDIR and FILESDIR)
906
+ * Cleaned up some pear stuff in install
907
+ *
908
+ = 0.1 - 2004-06 =
909
+ * First release
simple_html_dom.php ADDED
@@ -0,0 +1,1722 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Website: http://sourceforge.net/projects/simplehtmldom/
4
+ * Additional projects that may be used: http://sourceforge.net/projects/debugobject/
5
+ * Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
6
+ * Contributions by:
7
+ * Yousuke Kumakura (Attribute filters)
8
+ * Vadim Voituk (Negative indexes supports of "find" method)
9
+ * Antcs (Constructor with automatically load contents either text or file/url)
10
+ *
11
+ * all affected sections have comments starting with "PaperG"
12
+ *
13
+ * Paperg - Added case insensitive testing of the value of the selector.
14
+ * Paperg - Added tag_start for the starting index of tags - NOTE: This works but not accurately.
15
+ * This tag_start gets counted AFTER \r\n have been crushed out, and after the remove_noice calls so it will not reflect the REAL position of the tag in the source,
16
+ * it will almost always be smaller by some amount.
17
+ * We use this to determine how far into the file the tag in question is. This "percentage will never be accurate as the $dom->size is the "real" number of bytes the dom was created from.
18
+ * but for most purposes, it's a really good estimation.
19
+ * Paperg - Added the forceTagsClosed to the dom constructor. Forcing tags closed is great for malformed html, but it CAN lead to parsing errors.
20
+ * Allow the user to tell us how much they trust the html.
21
+ * Paperg add the text and plaintext to the selectors for the find syntax. plaintext implies text in the innertext of a node. text implies that the tag is a text node.
22
+ * This allows for us to find tags based on the text they contain.
23
+ * Create find_ancestor_tag to see if a tag is - at any level - inside of another specific tag.
24
+ * Paperg: added parse_charset so that we know about the character set of the source document.
25
+ * NOTE: If the user's system has a routine called get_last_retrieve_url_contents_content_type availalbe, we will assume it's returning the content-type header from the
26
+ * last transfer or curl_exec, and we will parse that and use it in preference to any other method of charset detection.
27
+ *
28
+ * Found infinite loop in the case of broken html in restore_noise. Rewrote to protect from that.
29
+ * PaperG (John Schlick) Added get_display_size for "IMG" tags.
30
+ *
31
+ * Licensed under The MIT License
32
+ * Redistributions of files must retain the above copyright notice.
33
+ *
34
+ * @author S.C. Chen <me578022@gmail.com>
35
+ * @author John Schlick
36
+ * @author Rus Carroll
37
+ * @version 1.5 ($Rev: 202 $)
38
+ * @package PlaceLocalInclude
39
+ * @subpackage simple_html_dom
40
+ */
41
+
42
+ /**
43
+ * All of the Defines for the classes below.
44
+ * @author S.C. Chen <me578022@gmail.com>
45
+ */
46
+ define('HDOM_TYPE_ELEMENT', 1);
47
+ define('HDOM_TYPE_COMMENT', 2);
48
+ define('HDOM_TYPE_TEXT', 3);
49
+ define('HDOM_TYPE_ENDTAG', 4);
50
+ define('HDOM_TYPE_ROOT', 5);
51
+ define('HDOM_TYPE_UNKNOWN', 6);
52
+ define('HDOM_QUOTE_DOUBLE', 0);
53
+ define('HDOM_QUOTE_SINGLE', 1);
54
+ define('HDOM_QUOTE_NO', 3);
55
+ define('HDOM_INFO_BEGIN', 0);
56
+ define('HDOM_INFO_END', 1);
57
+ define('HDOM_INFO_QUOTE', 2);
58
+ define('HDOM_INFO_SPACE', 3);
59
+ define('HDOM_INFO_TEXT', 4);
60
+ define('HDOM_INFO_INNER', 5);
61
+ define('HDOM_INFO_OUTER', 6);
62
+ define('HDOM_INFO_ENDSPACE',7);
63
+ define('DEFAULT_TARGET_CHARSET', 'UTF-8');
64
+ define('DEFAULT_BR_TEXT', "\r\n");
65
+ define('DEFAULT_SPAN_TEXT', " ");
66
+ define('MAX_FILE_SIZE', 600000);
67
+ // helper functions
68
+ // -----------------------------------------------------------------------------
69
+ // get html dom from file
70
+ // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1.
71
+ function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
72
+ {
73
+ // We DO force the tags to be terminated.
74
+ $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
75
+ // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done.
76
+ $contents = file_get_contents($url, $use_include_path, $context, $offset);
77
+ // Paperg - use our own mechanism for getting the contents as we want to control the timeout.
78
+ //$contents = retrieve_url_contents($url);
79
+ if (empty($contents) || strlen($contents) > MAX_FILE_SIZE)
80
+ {
81
+ return false;
82
+ }
83
+ // The second parameter can force the selectors to all be lowercase.
84
+ $dom->load($contents, $lowercase, $stripRN);
85
+ return $dom;
86
+ }
87
+
88
+ // get html dom from string
89
+ function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
90
+ {
91
+ $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
92
+ if (empty($str) || strlen($str) > MAX_FILE_SIZE)
93
+ {
94
+ $dom->clear();
95
+ return false;
96
+ }
97
+ $dom->load($str, $lowercase, $stripRN);
98
+ return $dom;
99
+ }
100
+
101
+ // dump html dom tree
102
+ function dump_html_tree($node, $show_attr=true, $deep=0)
103
+ {
104
+ $node->dump($node);
105
+ }
106
+
107
+
108
+ /**
109
+ * simple html dom node
110
+ * PaperG - added ability for "find" routine to lowercase the value of the selector.
111
+ * PaperG - added $tag_start to track the start position of the tag in the total byte index
112
+ *
113
+ * @package PlaceLocalInclude
114
+ */
115
+ class simple_html_dom_node
116
+ {
117
+ public $nodetype = HDOM_TYPE_TEXT;
118
+ public $tag = 'text';
119
+ public $attr = array();
120
+ public $children = array();
121
+ public $nodes = array();
122
+ public $parent = null;
123
+ // The "info" array - see HDOM_INFO_... for what each element contains.
124
+ public $_ = array();
125
+ public $tag_start = 0;
126
+ private $dom = null;
127
+
128
+ function __construct($dom)
129
+ {
130
+ $this->dom = $dom;
131
+ $dom->nodes[] = $this;
132
+ }
133
+
134
+ function __destruct()
135
+ {
136
+ $this->clear();
137
+ }
138
+
139
+ function __toString()
140
+ {
141
+ return $this->outertext();
142
+ }
143
+
144
+ // clean up memory due to php5 circular references memory leak...
145
+ function clear()
146
+ {
147
+ $this->dom = null;
148
+ $this->nodes = null;
149
+ $this->parent = null;
150
+ $this->children = null;
151
+ }
152
+
153
+ // dump node's tree
154
+ function dump($show_attr=true, $deep=0)
155
+ {
156
+ $lead = str_repeat(' ', $deep);
157
+
158
+ echo $lead.$this->tag;
159
+ if ($show_attr && count($this->attr)>0)
160
+ {
161
+ echo '(';
162
+ foreach ($this->attr as $k=>$v)
163
+ echo "[$k]=>\"".$this->$k.'", ';
164
+ echo ')';
165
+ }
166
+ echo "\n";
167
+
168
+ if ($this->nodes)
169
+ {
170
+ foreach ($this->nodes as $c)
171
+ {
172
+ $c->dump($show_attr, $deep+1);
173
+ }
174
+ }
175
+ }
176
+
177
+
178
+ // Debugging function to dump a single dom node with a bunch of information about it.
179
+ function dump_node($echo=true)
180
+ {
181
+
182
+ $string = $this->tag;
183
+ if (count($this->attr)>0)
184
+ {
185
+ $string .= '(';
186
+ foreach ($this->attr as $k=>$v)
187
+ {
188
+ $string .= "[$k]=>\"".$this->$k.'", ';
189
+ }
190
+ $string .= ')';
191
+ }
192
+ if (count($this->_)>0)
193
+ {
194
+ $string .= ' $_ (';
195
+ foreach ($this->_ as $k=>$v)
196
+ {
197
+ if (is_array($v))
198
+ {
199
+ $string .= "[$k]=>(";
200
+ foreach ($v as $k2=>$v2)
201
+ {
202
+ $string .= "[$k2]=>\"".$v2.'", ';
203
+ }
204
+ $string .= ")";
205
+ } else {
206
+ $string .= "[$k]=>\"".$v.'", ';
207
+ }
208
+ }
209
+ $string .= ")";
210
+ }
211
+
212
+ if (isset($this->text))
213
+ {
214
+ $string .= " text: (" . $this->text . ")";
215
+ }
216
+
217
+ $string .= " HDOM_INNER_INFO: '";
218
+ if (isset($node->_[HDOM_INFO_INNER]))
219
+ {
220
+ $string .= $node->_[HDOM_INFO_INNER] . "'";
221
+ }
222
+ else
223
+ {
224
+ $string .= ' NULL ';
225
+ }
226
+
227
+ $string .= " children: " . count($this->children);
228
+ $string .= " nodes: " . count($this->nodes);
229
+ $string .= " tag_start: " . $this->tag_start;
230
+ $string .= "\n";
231
+
232
+ if ($echo)
233
+ {
234
+ echo $string;
235
+ return;
236
+ }
237
+ else
238
+ {
239
+ return $string;
240
+ }
241
+ }
242
+
243
+ // returns the parent of node
244
+ // If a node is passed in, it will reset the parent of the current node to that one.
245
+ function parent($parent=null)
246
+ {
247
+ // I am SURE that this doesn't work properly.
248
+ // It fails to unset the current node from it's current parents nodes or children list first.
249
+ if ($parent !== null)
250
+ {
251
+ $this->parent = $parent;
252
+ $this->parent->nodes[] = $this;
253
+ $this->parent->children[] = $this;
254
+ }
255
+
256
+ return $this->parent;
257
+ }
258
+
259
+ // verify that node has children
260
+ function has_child()
261
+ {
262
+ return !empty($this->children);
263
+ }
264
+
265
+ // returns children of node
266
+ function children($idx=-1)
267
+ {
268
+ if ($idx===-1)
269
+ {
270
+ return $this->children;
271
+ }
272
+ if (isset($this->children[$idx])) return $this->children[$idx];
273
+ return null;
274
+ }
275
+
276
+ // returns the first child of node
277
+ function first_child()
278
+ {
279
+ if (count($this->children)>0)
280
+ {
281
+ return $this->children[0];
282
+ }
283
+ return null;
284
+ }
285
+
286
+ // returns the last child of node
287
+ function last_child()
288
+ {
289
+ if (($count=count($this->children))>0)
290
+ {
291
+ return $this->children[$count-1];
292
+ }
293
+ return null;
294
+ }
295
+
296
+ // returns the next sibling of node
297
+ function next_sibling()
298
+ {
299
+ if ($this->parent===null)
300
+ {
301
+ return null;
302
+ }
303
+
304
+ $idx = 0;
305
+ $count = count($this->parent->children);
306
+ while ($idx<$count && $this!==$this->parent->children[$idx])
307
+ {
308
+ ++$idx;
309
+ }
310
+ if (++$idx>=$count)
311
+ {
312
+ return null;
313
+ }
314
+ return $this->parent->children[$idx];
315
+ }
316
+
317
+ // returns the previous sibling of node
318
+ function prev_sibling()
319
+ {
320
+ if ($this->parent===null) return null;
321
+ $idx = 0;
322
+ $count = count($this->parent->children);
323
+ while ($idx<$count && $this!==$this->parent->children[$idx])
324
+ ++$idx;
325
+ if (--$idx<0) return null;
326
+ return $this->parent->children[$idx];
327
+ }
328
+
329
+ // function to locate a specific ancestor tag in the path to the root.
330
+ function find_ancestor_tag($tag)
331
+ {
332
+ global $debug_object;
333
+ if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
334
+
335
+ // Start by including ourselves in the comparison.
336
+ $returnDom = $this;
337
+
338
+ while (!is_null($returnDom))
339
+ {
340
+ if (is_object($debug_object)) { $debug_object->debugLog(2, "Current tag is: " . $returnDom->tag); }
341
+
342
+ if ($returnDom->tag == $tag)
343
+ {
344
+ break;
345
+ }
346
+ $returnDom = $returnDom->parent;
347
+ }
348
+ return $returnDom;
349
+ }
350
+
351
+ // get dom node's inner html
352
+ function innertext()
353
+ {
354
+ if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
355
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
356
+
357
+ $ret = '';
358
+ foreach ($this->nodes as $n)
359
+ $ret .= $n->outertext();
360
+ return $ret;
361
+ }
362
+
363
+ // get dom node's outer text (with tag)
364
+ function outertext()
365
+ {
366
+ global $debug_object;
367
+ if (is_object($debug_object))
368
+ {
369
+ $text = '';
370
+ if ($this->tag == 'text')
371
+ {
372
+ if (!empty($this->text))
373
+ {
374
+ $text = " with text: " . $this->text;
375
+ }
376
+ }
377
+ $debug_object->debugLog(1, 'Innertext of tag: ' . $this->tag . $text);
378
+ }
379
+
380
+ if ($this->tag==='root') return $this->innertext();
381
+
382
+ // trigger callback
383
+ if ($this->dom && $this->dom->callback!==null)
384
+ {
385
+ call_user_func_array($this->dom->callback, array($this));
386
+ }
387
+
388
+ if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER];
389
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
390
+
391
+ // render begin tag
392
+ if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]])
393
+ {
394
+ $ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup();
395
+ } else {
396
+ $ret = "";
397
+ }
398
+
399
+ // render inner text
400
+ if (isset($this->_[HDOM_INFO_INNER]))
401
+ {
402
+ // If it's a br tag... don't return the HDOM_INNER_INFO that we may or may not have added.
403
+ if ($this->tag != "br")
404
+ {
405
+ $ret .= $this->_[HDOM_INFO_INNER];
406
+ }
407
+ } else {
408
+ if ($this->nodes)
409
+ {
410
+ foreach ($this->nodes as $n)
411
+ {
412
+ $ret .= $this->convert_text($n->outertext());
413
+ }
414
+ }
415
+ }
416
+
417
+ // render end tag
418
+ if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
419
+ $ret .= '</'.$this->tag.'>';
420
+ return $ret;
421
+ }
422
+
423
+ // get dom node's plain text
424
+ function text()
425
+ {
426
+ if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
427
+ switch ($this->nodetype)
428
+ {
429
+ case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
430
+ case HDOM_TYPE_COMMENT: return '';
431
+ case HDOM_TYPE_UNKNOWN: return '';
432
+ }
433
+ if (strcasecmp($this->tag, 'script')===0) return '';
434
+ if (strcasecmp($this->tag, 'style')===0) return '';
435
+
436
+ $ret = '';
437
+ // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
438
+ // NOTE: This indicates that there is a problem where it's set to NULL without a clear happening.
439
+ // WHY is this happening?
440
+ if (!is_null($this->nodes))
441
+ {
442
+ foreach ($this->nodes as $n)
443
+ {
444
+ $ret .= $this->convert_text($n->text());
445
+ }
446
+
447
+ // If this node is a span... add a space at the end of it so multiple spans don't run into each other. This is plaintext after all.
448
+ if ($this->tag == "span")
449
+ {
450
+ $ret .= $this->dom->default_span_text;
451
+ }
452
+
453
+
454
+ }
455
+ return $ret;
456
+ }
457
+
458
+ function xmltext()
459
+ {
460
+ $ret = $this->innertext();
461
+ $ret = str_ireplace('<![CDATA[', '', $ret);
462
+ $ret = str_replace(']]>', '', $ret);
463
+ return $ret;
464
+ }
465
+
466
+ // build node's text with tag
467
+ function makeup()
468
+ {
469
+ // text, comment, unknown
470
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
471
+
472
+ $ret = '<'.$this->tag;
473
+ $i = -1;
474
+
475
+ foreach ($this->attr as $key=>$val)
476
+ {
477
+ ++$i;
478
+
479
+ // skip removed attribute
480
+ if ($val===null || $val===false)
481
+ continue;
482
+
483
+ $ret .= $this->_[HDOM_INFO_SPACE][$i][0];
484
+ //no value attr: nowrap, checked selected...
485
+ if ($val===true)
486
+ $ret .= $key;
487
+ else {
488
+ switch ($this->_[HDOM_INFO_QUOTE][$i])
489
+ {
490
+ case HDOM_QUOTE_DOUBLE: $quote = '"'; break;
491
+ case HDOM_QUOTE_SINGLE: $quote = '\''; break;
492
+ default: $quote = '';
493
+ }
494
+ $ret .= $key.$this->_[HDOM_INFO_SPACE][$i][1].'='.$this->_[HDOM_INFO_SPACE][$i][2].$quote.$val.$quote;
495
+ }
496
+ }
497
+ $ret = $this->dom->restore_noise($ret);
498
+ return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>';
499
+ }
500
+
501
+ // find elements by css selector
502
+ //PaperG - added ability for find to lowercase the value of the selector.
503
+ function find($selector, $idx=null, $lowercase=false)
504
+ {
505
+ $selectors = $this->parse_selector($selector);
506
+ if (($count=count($selectors))===0) return array();
507
+ $found_keys = array();
508
+
509
+ // find each selector
510
+ for ($c=0; $c<$count; ++$c)
511
+ {
512
+ // The change on the below line was documented on the sourceforge code tracker id 2788009
513
+ // used to be: if (($levle=count($selectors[0]))===0) return array();
514
+ if (($levle=count($selectors[$c]))===0) return array();
515
+ if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
516
+
517
+ $head = array($this->_[HDOM_INFO_BEGIN]=>1);
518
+
519
+ // handle descendant selectors, no recursive!
520
+ for ($l=0; $l<$levle; ++$l)
521
+ {
522
+ $ret = array();
523
+ foreach ($head as $k=>$v)
524
+ {
525
+ $n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k];
526
+ //PaperG - Pass this optional parameter on to the seek function.
527
+ $n->seek($selectors[$c][$l], $ret, $lowercase);
528
+ }
529
+ $head = $ret;
530
+ }
531
+
532
+ foreach ($head as $k=>$v)
533
+ {
534
+ if (!isset($found_keys[$k]))
535
+ $found_keys[$k] = 1;
536
+ }
537
+ }
538
+
539
+ // sort keys
540
+ ksort($found_keys);
541
+
542
+ $found = array();
543
+ foreach ($found_keys as $k=>$v)
544
+ $found[] = $this->dom->nodes[$k];
545
+
546
+ // return nth-element or array
547
+ if (is_null($idx)) return $found;
548
+ else if ($idx<0) $idx = count($found) + $idx;
549
+ return (isset($found[$idx])) ? $found[$idx] : null;
550
+ }
551
+
552
+ // seek for given conditions
553
+ // PaperG - added parameter to allow for case insensitive testing of the value of a selector.
554
+ protected function seek($selector, &$ret, $lowercase=false)
555
+ {
556
+ global $debug_object;
557
+ if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
558
+
559
+ list($tag, $key, $val, $exp, $no_key) = $selector;
560
+
561
+ // xpath index
562
+ if ($tag && $key && is_numeric($key))
563
+ {
564
+ $count = 0;
565
+ foreach ($this->children as $c)
566
+ {
567
+ if ($tag==='*' || $tag===$c->tag) {
568
+ if (++$count==$key) {
569
+ $ret[$c->_[HDOM_INFO_BEGIN]] = 1;
570
+ return;
571
+ }
572
+ }
573
+ }
574
+ return;
575
+ }
576
+
577
+ $end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0;
578
+ if ($end==0) {
579
+ $parent = $this->parent;
580
+ while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) {
581
+ $end -= 1;
582
+ $parent = $parent->parent;
583
+ }
584
+ $end += $parent->_[HDOM_INFO_END];
585
+ }
586
+
587
+ for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) {
588
+ $node = $this->dom->nodes[$i];
589
+
590
+ $pass = true;
591
+
592
+ if ($tag==='*' && !$key) {
593
+ if (in_array($node, $this->children, true))
594
+ $ret[$i] = 1;
595
+ continue;
596
+ }
597
+
598
+ // compare tag
599
+ if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;}
600
+ // compare key
601
+ if ($pass && $key) {
602
+ if ($no_key) {
603
+ if (isset($node->attr[$key])) $pass=false;
604
+ } else {
605
+ if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
606
+ }
607
+ }
608
+ // compare value
609
+ if ($pass && $key && $val && $val!=='*') {
610
+ // If they have told us that this is a "plaintext" search then we want the plaintext of the node - right?
611
+ if ($key == "plaintext") {
612
+ // $node->plaintext actually returns $node->text();
613
+ $nodeKeyValue = $node->text();
614
+ } else {
615
+ // this is a normal search, we want the value of that attribute of the tag.
616
+ $nodeKeyValue = $node->attr[$key];
617
+ }
618
+ if (is_object($debug_object)) {$debug_object->debugLog(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}
619
+
620
+ //PaperG - If lowercase is set, do a case insensitive test of the value of the selector.
621
+ if ($lowercase) {
622
+ $check = $this->match($exp, strtolower($val), strtolower($nodeKeyValue));
623
+ } else {
624
+ $check = $this->match($exp, $val, $nodeKeyValue);
625
+ }
626
+ if (is_object($debug_object)) {$debug_object->debugLog(2, "after match: " . ($check ? "true" : "false"));}
627
+
628
+ // handle multiple class
629
+ if (!$check && strcasecmp($key, 'class')===0) {
630
+ foreach (explode(' ',$node->attr[$key]) as $k) {
631
+ // Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form.
632
+ if (!empty($k)) {
633
+ if ($lowercase) {
634
+ $check = $this->match($exp, strtolower($val), strtolower($k));
635
+ } else {
636
+ $check = $this->match($exp, $val, $k);
637
+ }
638
+ if ($check) break;
639
+ }
640
+ }
641
+ }
642
+ if (!$check) $pass = false;
643
+ }
644
+ if ($pass) $ret[$i] = 1;
645
+ unset($node);
646
+ }
647
+ // It's passed by reference so this is actually what this function returns.
648
+ if (is_object($debug_object)) {$debug_object->debugLog(1, "EXIT - ret: ", $ret);}
649
+ }
650
+
651
+ protected function match($exp, $pattern, $value) {
652
+ global $debug_object;
653
+ if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}
654
+
655
+ switch ($exp) {
656
+ case '=':
657
+ return ($value===$pattern);
658
+ case '!=':
659
+ return ($value!==$pattern);
660
+ case '^=':
661
+ return preg_match("/^".preg_quote($pattern,'/')."/", $value);
662
+ case '$=':
663
+ return preg_match("/".preg_quote($pattern,'/')."$/", $value);
664
+ case '*=':
665
+ if ($pattern[0]=='/') {
666
+ return preg_match($pattern, $value);
667
+ }
668
+ return preg_match("/".$pattern."/i", $value);
669
+ }
670
+ return false;
671
+ }
672
+
673
+ protected function parse_selector($selector_string) {
674
+ global $debug_object;
675
+ if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}
676
+
677
+ // pattern of CSS selectors, modified from mootools
678
+ // Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does.
679
+ // Note: if you try to look at this attribute, yo MUST use getAttribute since $dom->x:y will fail the php syntax check.
680
+ // Notice the \[ starting the attbute? and the @? following? This implies that an attribute can begin with an @ sign that is not captured.
681
+ // This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression.
682
+ // farther study is required to determine of this should be documented or removed.
683
+ // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
684
+ $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
685
+ preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
686
+ if (is_object($debug_object)) {$debug_object->debugLog(2, "Matches Array: ", $matches);}
687
+
688
+ $selectors = array();
689
+ $result = array();
690
+ //print_r($matches);
691
+
692
+ foreach ($matches as $m) {
693
+ $m[0] = trim($m[0]);
694
+ if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
695
+ // for browser generated xpath
696
+ if ($m[1]==='tbody') continue;
697
+
698
+ list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
699
+ if (!empty($m[2])) {$key='id'; $val=$m[2];}
700
+ if (!empty($m[3])) {$key='class'; $val=$m[3];}
701
+ if (!empty($m[4])) {$key=$m[4];}
702
+ if (!empty($m[5])) {$exp=$m[5];}
703
+ if (!empty($m[6])) {$val=$m[6];}
704
+
705
+ // convert to lowercase
706
+ if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);}
707
+ //elements that do NOT have the specified attribute
708
+ if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;}
709
+
710
+ $result[] = array($tag, $key, $val, $exp, $no_key);
711
+ if (trim($m[7])===',') {
712
+ $selectors[] = $result;
713
+ $result = array();
714
+ }
715
+ }
716
+ if (count($result)>0)
717
+ $selectors[] = $result;
718
+ return $selectors;
719
+ }
720
+
721
+ function __get($name) {
722
+ if (isset($this->attr[$name]))
723
+ {
724
+ return $this->convert_text($this->attr[$name]);
725
+ }
726
+ switch ($name) {
727
+ case 'outertext': return $this->outertext();
728
+ case 'innertext': return $this->innertext();
729
+ case 'plaintext': return $this->text();
730
+ case 'xmltext': return $this->xmltext();
731
+ default: return array_key_exists($name, $this->attr);
732
+ }
733
+ }
734
+
735
+ function __set($name, $value) {
736
+ switch ($name) {
737
+ case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
738
+ case 'innertext':
739
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;
740
+ return $this->_[HDOM_INFO_INNER] = $value;
741
+ }
742
+ if (!isset($this->attr[$name])) {
743
+ $this->_[HDOM_INFO_SPACE][] = array(' ', '', '');
744
+ $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
745
+ }
746
+ $this->attr[$name] = $value;
747
+ }
748
+
749
+ function __isset($name) {
750
+ switch ($name) {
751
+ case 'outertext': return true;
752
+ case 'innertext': return true;
753
+ case 'plaintext': return true;
754
+ }
755
+ //no value attr: nowrap, checked selected...
756
+ return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]);
757
+ }
758
+
759
+ function __unset($name) {
760
+ if (isset($this->attr[$name]))
761
+ unset($this->attr[$name]);
762
+ }
763
+
764
+ // PaperG - Function to convert the text from one character set to another if the two sets are not the same.
765
+ function convert_text($text)
766
+ {
767
+ global $debug_object;
768
+ if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}
769
+
770
+ $converted_text = $text;
771
+
772
+ $sourceCharset = "";
773
+ $targetCharset = "";
774
+
775
+ if ($this->dom)
776
+ {
777
+ $sourceCharset = strtoupper($this->dom->_charset);
778
+ $targetCharset = strtoupper($this->dom->_target_charset);
779
+ }
780
+ if (is_object($debug_object)) {$debug_object->debugLog(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}
781
+
782
+ if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0))
783
+ {
784
+ // Check if the reported encoding could have been incorrect and the text is actually already UTF-8
785
+ if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text)))
786
+ {
787
+ $converted_text = $text;
788
+ }
789
+ else
790
+ {
791
+ $converted_text = iconv($sourceCharset, $targetCharset, $text);
792
+ }
793
+ }
794
+
795
+ // Lets make sure that we don't have that silly BOM issue with any of the utf-8 text we output.
796
+ if ($targetCharset == 'UTF-8')
797
+ {
798
+ if (substr($converted_text, 0, 3) == "\xef\xbb\xbf")
799
+ {
800
+ $converted_text = substr($converted_text, 3);
801
+ }
802
+ if (substr($converted_text, -3) == "\xef\xbb\xbf")
803
+ {
804
+ $converted_text = substr($converted_text, 0, -3);
805
+ }
806
+ }
807
+
808
+ return $converted_text;
809
+ }
810
+
811
+ /**
812
+ * Returns true if $string is valid UTF-8 and false otherwise.
813
+ *
814
+ * @param mixed $str String to be tested
815
+ * @return boolean
816
+ */
817
+ static function is_utf8($str)
818
+ {
819
+ $c=0; $b=0;
820
+ $bits=0;
821
+ $len=strlen($str);
822
+ for($i=0; $i<$len; $i++)
823
+ {
824
+ $c=ord($str[$i]);
825
+ if($c > 128)
826
+ {
827
+ if(($c >= 254)) return false;
828
+ elseif($c >= 252) $bits=6;
829
+ elseif($c >= 248) $bits=5;
830
+ elseif($c >= 240) $bits=4;
831
+ elseif($c >= 224) $bits=3;
832
+ elseif($c >= 192) $bits=2;
833
+ else return false;
834
+ if(($i+$bits) > $len) return false;
835
+ while($bits > 1)
836
+ {
837
+ $i++;
838
+ $b=ord($str[$i]);
839
+ if($b < 128 || $b > 191) return false;
840
+ $bits--;
841
+ }
842
+ }
843
+ }
844
+ return true;
845
+ }
846
+ /*
847
+ function is_utf8($string)
848
+ {
849
+ //this is buggy
850
+ return (utf8_encode(utf8_decode($string)) == $string);
851
+ }
852
+ */
853
+
854
+ /**
855
+ * Function to try a few tricks to determine the displayed size of an img on the page.
856
+ * NOTE: This will ONLY work on an IMG tag. Returns FALSE on all other tag types.
857
+ *
858
+ * @author John Schlick
859
+ * @version April 19 2012
860
+ * @return array an array containing the 'height' and 'width' of the image on the page or -1 if we can't figure it out.
861
+ */
862
+ function get_display_size()
863
+ {
864
+ global $debug_object;
865
+
866
+ $width = -1;
867
+ $height = -1;
868
+
869
+ if ($this->tag !== 'img')
870
+ {
871
+ return false;
872
+ }
873
+
874
+ // See if there is aheight or width attribute in the tag itself.
875
+ if (isset($this->attr['width']))
876
+ {
877
+ $width = $this->attr['width'];
878
+ }
879
+
880
+ if (isset($this->attr['height']))
881
+ {
882
+ $height = $this->attr['height'];
883
+ }
884
+
885
+ // Now look for an inline style.
886
+ if (isset($this->attr['style']))
887
+ {
888
+ // Thanks to user gnarf from stackoverflow for this regular expression.
889
+ $attributes = array();
890
+ preg_match_all("/([\w-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER);
891
+ foreach ($matches as $match) {
892
+ $attributes[$match[1]] = $match[2];
893
+ }
894
+
895
+ // If there is a width in the style attributes:
896
+ if (isset($attributes['width']) && $width == -1)
897
+ {
898
+ // check that the last two characters are px (pixels)
899
+ if (strtolower(substr($attributes['width'], -2)) == 'px')
900
+ {
901
+ $proposed_width = substr($attributes['width'], 0, -2);
902
+ // Now make sure that it's an integer and not something stupid.
903
+ if (filter_var($proposed_width, FILTER_VALIDATE_INT))
904
+ {
905
+ $width = $proposed_width;
906
+ }
907
+ }
908
+ }
909
+
910
+ // If there is a width in the style attributes:
911
+ if (isset($attributes['height']) && $height == -1)
912
+ {
913
+ // check that the last two characters are px (pixels)
914
+ if (strtolower(substr($attributes['height'], -2)) == 'px')
915
+ {
916
+ $proposed_height = substr($attributes['height'], 0, -2);
917
+ // Now make sure that it's an integer and not something stupid.
918
+ if (filter_var($proposed_height, FILTER_VALIDATE_INT))
919
+ {
920
+ $height = $proposed_height;
921
+ }
922
+ }
923
+ }
924
+
925
+ }
926
+
927
+ // Future enhancement:
928
+ // Look in the tag to see if there is a class or id specified that has a height or width attribute to it.
929
+
930
+ // Far future enhancement
931
+ // Look at all the parent tags of this image to see if they specify a class or id that has an img selector that specifies a height or width
932
+ // Note that in this case, the class or id will have the img subselector for it to apply to the image.
933
+
934
+ // ridiculously far future development
935
+ // If the class or id is specified in a SEPARATE css file thats not on the page, go get it and do what we were just doing for the ones on the page.
936
+
937
+ $result = array('height' => $height,
938
+ 'width' => $width);
939
+ return $result;
940
+ }
941
+
942
+ // camel naming conventions
943
+ function getAllAttributes() {return $this->attr;}
944
+ function getAttribute($name) {return $this->__get($name);}
945
+ function setAttribute($name, $value) {$this->__set($name, $value);}
946
+ function hasAttribute($name) {return $this->__isset($name);}
947
+ function removeAttribute($name) {$this->__set($name, null);}
948
+ function getElementById($id) {return $this->find("#$id", 0);}
949
+ function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
950
+ function getElementByTagName($name) {return $this->find($name, 0);}
951
+ function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);}
952
+ function parentNode() {return $this->parent();}
953
+ function childNodes($idx=-1) {return $this->children($idx);}
954
+ function firstChild() {return $this->first_child();}
955
+ function lastChild() {return $this->last_child();}
956
+ function nextSibling() {return $this->next_sibling();}
957
+ function previousSibling() {return $this->prev_sibling();}
958
+ function hasChildNodes() {return $this->has_child();}
959
+ function nodeName() {return $this->tag;}
960
+ function appendChild($node) {$node->parent($this); return $node;}
961
+
962
+ }
963
+
964
+ /**
965
+ * simple html dom parser
966
+ * Paperg - in the find routine: allow us to specify that we want case insensitive testing of the value of the selector.
967
+ * Paperg - change $size from protected to public so we can easily access it
968
+ * Paperg - added ForceTagsClosed in the constructor which tells us whether we trust the html or not. Default is to NOT trust it.
969
+ *
970
+ * @package PlaceLocalInclude
971
+ */
972
+ class simple_html_dom
973
+ {
974
+ public $root = null;
975
+ public $nodes = array();
976
+ public $callback = null;
977
+ public $lowercase = false;
978
+ // Used to keep track of how large the text was when we started.
979
+ public $original_size;
980
+ public $size;
981
+ protected $pos;
982
+ protected $doc;
983
+ protected $char;
984
+ protected $cursor;
985
+ protected $parent;
986
+ protected $noise = array();
987
+ protected $token_blank = " \t\r\n";
988
+ protected $token_equal = ' =/>';
989
+ protected $token_slash = " />\r\n\t";
990
+ protected $token_attr = ' >';
991
+ // Note that this is referenced by a child node, and so it needs to be public for that node to see this information.
992
+ public $_charset = '';
993
+ public $_target_charset = '';
994
+ protected $default_br_text = "";
995
+ public $default_span_text = "";
996
+
997
+ // use isset instead of in_array, performance boost about 30%...
998
+ protected $self_closing_tags = array('img'=>1, 'br'=>1, 'input'=>1, 'meta'=>1, 'link'=>1, 'hr'=>1, 'base'=>1, 'embed'=>1, 'spacer'=>1);
999
+ protected $block_tags = array('root'=>1, 'body'=>1, 'form'=>1, 'div'=>1, 'span'=>1, 'table'=>1);
1000
+ // Known sourceforge issue #2977341
1001
+ // B tags that are not closed cause us to return everything to the end of the document.
1002
+ protected $optional_closing_tags = array(
1003
+ 'tr'=>array('tr'=>1, 'td'=>1, 'th'=>1),
1004
+ 'th'=>array('th'=>1),
1005
+ 'td'=>array('td'=>1),
1006
+ 'li'=>array('li'=>1),
1007
+ 'dt'=>array('dt'=>1, 'dd'=>1),
1008
+ 'dd'=>array('dd'=>1, 'dt'=>1),
1009
+ 'dl'=>array('dd'=>1, 'dt'=>1),
1010
+ 'p'=>array('p'=>1),
1011
+ 'nobr'=>array('nobr'=>1),
1012
+ 'b'=>array('b'=>1),
1013
+ 'option'=>array('option'=>1),
1014
+ );
1015
+
1016
+ function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1017
+ {
1018
+ if ($str)
1019
+ {
1020
+ if (preg_match("/^http:\/\//i",$str) || is_file($str))
1021
+ {
1022
+ $this->load_file($str);
1023
+ }
1024
+ else
1025
+ {
1026
+ $this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
1027
+ }
1028
+ }
1029
+ // Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html.
1030
+ if (!$forceTagsClosed) {
1031
+ $this->optional_closing_array=array();
1032
+ }
1033
+ $this->_target_charset = $target_charset;
1034
+ }
1035
+
1036
+ function __destruct()
1037
+ {
1038
+ $this->clear();
1039
+ }
1040
+
1041
+ // load html from string
1042
+ function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1043
+ {
1044
+ global $debug_object;
1045
+
1046
+ // prepare
1047
+ $this->prepare($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
1048
+ // strip out comments
1049
+ $this->remove_noise("'<!--(.*?)-->'is");
1050
+ // strip out cdata
1051
+ $this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);
1052
+ // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037
1053
+ // Script tags removal now preceeds style tag removal.
1054
+ // strip out <script> tags
1055
+ $this->remove_noise("'<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>'is");
1056
+ $this->remove_noise("'<\s*script\s*>(.*?)<\s*/\s*script\s*>'is");
1057
+ // strip out <style> tags
1058
+ $this->remove_noise("'<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>'is");
1059
+ $this->remove_noise("'<\s*style\s*>(.*?)<\s*/\s*style\s*>'is");
1060
+ // strip out preformatted tags
1061
+ $this->remove_noise("'<\s*(?:code)[^>]*>(.*?)<\s*/\s*(?:code)\s*>'is");
1062
+ // strip out server side scripts
1063
+ $this->remove_noise("'(<\?)(.*?)(\?>)'s", true);
1064
+ // strip smarty scripts
1065
+ $this->remove_noise("'(\{\w)(.*?)(\})'s", true);
1066
+
1067
+ // parsing
1068
+ while ($this->parse());
1069
+ // end
1070
+ $this->root->_[HDOM_INFO_END] = $this->cursor;
1071
+ $this->parse_charset();
1072
+
1073
+ // make load function chainable
1074
+ return $this;
1075
+
1076
+ }
1077
+
1078
+ // load html from file
1079
+ function load_file()
1080
+ {
1081
+ $args = func_get_args();
1082
+ $this->load(call_user_func_array('file_get_contents', $args), true);
1083
+ // Throw an error if we can't properly load the dom.
1084
+ if (($error=error_get_last())!==null) {
1085
+ $this->clear();
1086
+ return false;
1087
+ }
1088
+ }
1089
+
1090
+ // set callback function
1091
+ function set_callback($function_name)
1092
+ {
1093
+ $this->callback = $function_name;
1094
+ }
1095
+
1096
+ // remove callback function
1097
+ function remove_callback()
1098
+ {
1099
+ $this->callback = null;
1100
+ }
1101
+
1102
+ // save dom as string
1103
+ function save($filepath='')
1104
+ {
1105
+ $ret = $this->root->innertext();
1106
+ if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1107
+ return $ret;
1108
+ }
1109
+
1110
+ // find dom node by css selector
1111
+ // Paperg - allow us to specify that we want case insensitive testing of the value of the selector.
1112
+ function find($selector, $idx=null, $lowercase=false)
1113
+ {
1114
+ return $this->root->find($selector, $idx, $lowercase);
1115
+ }
1116
+
1117
+ // clean up memory due to php5 circular references memory leak...
1118
+ function clear()
1119
+ {
1120
+ foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1121
+ // This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1122
+ if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1123
+ if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1124
+ if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1125
+ unset($this->doc);
1126
+ unset($this->noise);
1127
+ }
1128
+
1129
+ function dump($show_attr=true)
1130
+ {
1131
+ $this->root->dump($show_attr);
1132
+ }
1133
+
1134
+ // prepare HTML data and init everything
1135
+ protected function prepare($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1136
+ {
1137
+ $this->clear();
1138
+
1139
+ // set the length of content before we do anything to it.
1140
+ $this->size = strlen($str);
1141
+ // Save the original size of the html that we got in. It might be useful to someone.
1142
+ $this->original_size = $this->size;
1143
+
1144
+ //before we save the string as the doc... strip out the \r \n's if we are told to.
1145
+ if ($stripRN) {
1146
+ $str = str_replace("\r", " ", $str);
1147
+ $str = str_replace("\n", " ", $str);
1148
+
1149
+ // set the length of content since we have changed it.
1150
+ $this->size = strlen($str);
1151
+ }
1152
+
1153
+ $this->doc = $str;
1154
+ $this->pos = 0;
1155
+ $this->cursor = 1;
1156
+ $this->noise = array();
1157
+ $this->nodes = array();
1158
+ $this->lowercase = $lowercase;
1159
+ $this->default_br_text = $defaultBRText;
1160
+ $this->default_span_text = $defaultSpanText;
1161
+ $this->root = new simple_html_dom_node($this);
1162
+ $this->root->tag = 'root';
1163
+ $this->root->_[HDOM_INFO_BEGIN] = -1;
1164
+ $this->root->nodetype = HDOM_TYPE_ROOT;
1165
+ $this->parent = $this->root;
1166
+ if ($this->size>0) $this->char = $this->doc[0];
1167
+ }
1168
+
1169
+ // parse html content
1170
+ protected function parse()
1171
+ {
1172
+ if (($s = $this->copy_until_char('<'))==='')
1173
+ {
1174
+ return $this->read_tag();
1175
+ }
1176
+
1177
+ // text
1178
+ $node = new simple_html_dom_node($this);
1179
+ ++$this->cursor;
1180
+ $node->_[HDOM_INFO_TEXT] = $s;
1181
+ $this->link_nodes($node, false);
1182
+ return true;
1183
+ }
1184
+
1185
+ // PAPERG - dkchou - added this to try to identify the character set of the page we have just parsed so we know better how to spit it out later.
1186
+ // NOTE: IF you provide a routine called get_last_retrieve_url_contents_content_type which returns the CURLINFO_CONTENT_TYPE from the last curl_exec
1187
+ // (or the content_type header from the last transfer), we will parse THAT, and if a charset is specified, we will use it over any other mechanism.
1188
+ protected function parse_charset()
1189
+ {
1190
+ global $debug_object;
1191
+
1192
+ $charset = null;
1193
+
1194
+ if (function_exists('get_last_retrieve_url_contents_content_type'))
1195
+ {
1196
+ $contentTypeHeader = get_last_retrieve_url_contents_content_type();
1197
+ $success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches);
1198
+ if ($success)
1199
+ {
1200
+ $charset = $matches[1];
1201
+ if (is_object($debug_object)) {$debug_object->debugLog(2, 'header content-type found charset of: ' . $charset);}
1202
+ }
1203
+
1204
+ }
1205
+
1206
+ if (empty($charset))
1207
+ {
1208
+ $el = $this->root->find('meta[http-equiv=Content-Type]',0);
1209
+ if (!empty($el))
1210
+ {
1211
+ $fullvalue = $el->content;
1212
+ if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag found' . $fullvalue);}
1213
+
1214
+ if (!empty($fullvalue))
1215
+ {
1216
+ $success = preg_match('/charset=(.+)/', $fullvalue, $matches);
1217
+ if ($success)
1218
+ {
1219
+ $charset = $matches[1];
1220
+ }
1221
+ else
1222
+ {
1223
+ // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1224
+ if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
1225
+ $charset = 'ISO-8859-1';
1226
+ }
1227
+ }
1228
+ }
1229
+ }
1230
+
1231
+ // If we couldn't find a charset above, then lets try to detect one based on the text we got...
1232
+ if (empty($charset))
1233
+ {
1234
+ // Have php try to detect the encoding from the text given to us.
1235
+ $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
1236
+ if (is_object($debug_object)) {$debug_object->debugLog(2, 'mb_detect found: ' . $charset);}
1237
+
1238
+ // and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...
1239
+ if ($charset === false)
1240
+ {
1241
+ if (is_object($debug_object)) {$debug_object->debugLog(2, 'since mb_detect failed - using default of utf-8');}
1242
+ $charset = 'UTF-8';
1243
+ }
1244
+ }
1245
+
1246
+ // Since CP1252 is a superset, if we get one of it's subsets, we want it instead.
1247
+ if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1')))
1248
+ {
1249
+ if (is_object($debug_object)) {$debug_object->debugLog(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}
1250
+ $charset = 'CP1252';
1251
+ }
1252
+
1253
+ if (is_object($debug_object)) {$debug_object->debugLog(1, 'EXIT - ' . $charset);}
1254
+
1255
+ return $this->_charset = $charset;
1256
+ }
1257
+
1258
+ // read tag info
1259
+ protected function read_tag()
1260
+ {
1261
+ if ($this->char!=='<')
1262
+ {
1263
+ $this->root->_[HDOM_INFO_END] = $this->cursor;
1264
+ return false;
1265
+ }
1266
+ $begin_tag_pos = $this->pos;
1267
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1268
+
1269
+ // end tag
1270
+ if ($this->char==='/')
1271
+ {
1272
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1273
+ // This represents the change in the simple_html_dom trunk from revision 180 to 181.
1274
+ // $this->skip($this->token_blank_t);
1275
+ $this->skip($this->token_blank);
1276
+ $tag = $this->copy_until_char('>');
1277
+
1278
+ // skip attributes in end tag
1279
+ if (($pos = strpos($tag, ' '))!==false)
1280
+ $tag = substr($tag, 0, $pos);
1281
+
1282
+ $parent_lower = strtolower($this->parent->tag);
1283
+ $tag_lower = strtolower($tag);
1284
+
1285
+ if ($parent_lower!==$tag_lower)
1286
+ {
1287
+ if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower]))
1288
+ {
1289
+ $this->parent->_[HDOM_INFO_END] = 0;
1290
+ $org_parent = $this->parent;
1291
+
1292
+ while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1293
+ $this->parent = $this->parent->parent;
1294
+
1295
+ if (strtolower($this->parent->tag)!==$tag_lower) {
1296
+ $this->parent = $org_parent; // restore origonal parent
1297
+ if ($this->parent->parent) $this->parent = $this->parent->parent;
1298
+ $this->parent->_[HDOM_INFO_END] = $this->cursor;
1299
+ return $this->as_text_node($tag);
1300
+ }
1301
+ }
1302
+ else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1303
+ {
1304
+ $this->parent->_[HDOM_INFO_END] = 0;
1305
+ $org_parent = $this->parent;
1306
+
1307
+ while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1308
+ $this->parent = $this->parent->parent;
1309
+
1310
+ if (strtolower($this->parent->tag)!==$tag_lower)
1311
+ {
1312
+ $this->parent = $org_parent; // restore origonal parent
1313
+ $this->parent->_[HDOM_INFO_END] = $this->cursor;
1314
+ return $this->as_text_node($tag);
1315
+ }
1316
+ }
1317
+ else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1318
+ {
1319
+ $this->parent->_[HDOM_INFO_END] = 0;
1320
+ $this->parent = $this->parent->parent;
1321
+ }
1322
+ else
1323
+ return $this->as_text_node($tag);
1324
+ }
1325
+
1326
+ $this->parent->_[HDOM_INFO_END] = $this->cursor;
1327
+ if ($this->parent->parent) $this->parent = $this->parent->parent;
1328
+
1329
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1330
+ return true;
1331
+ }
1332
+
1333
+ $node = new simple_html_dom_node($this);
1334
+ $node->_[HDOM_INFO_BEGIN] = $this->cursor;
1335
+ ++$this->cursor;
1336
+ $tag = $this->copy_until($this->token_slash);
1337
+ $node->tag_start = $begin_tag_pos;
1338
+
1339
+ // doctype, cdata & comments...
1340
+ if (isset($tag[0]) && $tag[0]==='!') {
1341
+ $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
1342
+
1343
+ if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') {
1344
+ $node->nodetype = HDOM_TYPE_COMMENT;
1345
+ $node->tag = 'comment';
1346
+ } else {
1347
+ $node->nodetype = HDOM_TYPE_UNKNOWN;
1348
+ $node->tag = 'unknown';
1349
+ }
1350
+ if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1351
+ $this->link_nodes($node, true);
1352
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1353
+ return true;
1354
+ }
1355
+
1356
+ // text
1357
+ if ($pos=strpos($tag, '<')!==false) {
1358
+ $tag = '<' . substr($tag, 0, -1);
1359
+ $node->_[HDOM_INFO_TEXT] = $tag;
1360
+ $this->link_nodes($node, false);
1361
+ $this->char = $this->doc[--$this->pos]; // prev
1362
+ return true;
1363
+ }
1364
+
1365
+ if (!preg_match("/^[\w-:]+$/", $tag)) {
1366
+ $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
1367
+ if ($this->char==='<') {
1368
+ $this->link_nodes($node, false);
1369
+ return true;
1370
+ }
1371
+
1372
+ if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1373
+ $this->link_nodes($node, false);
1374
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1375
+ return true;
1376
+ }
1377
+
1378
+ // begin tag
1379
+ $node->nodetype = HDOM_TYPE_ELEMENT;
1380
+ $tag_lower = strtolower($tag);
1381
+ $node->tag = ($this->lowercase) ? $tag_lower : $tag;
1382
+
1383
+ // handle optional closing tags
1384
+ if (isset($this->optional_closing_tags[$tag_lower]) )
1385
+ {
1386
+ while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)]))
1387
+ {
1388
+ $this->parent->_[HDOM_INFO_END] = 0;
1389
+ $this->parent = $this->parent->parent;
1390
+ }
1391
+ $node->parent = $this->parent;
1392
+ }
1393
+
1394
+ $guard = 0; // prevent infinity loop
1395
+ $space = array($this->copy_skip($this->token_blank), '', '');
1396
+
1397
+ // attributes
1398
+ do
1399
+ {
1400
+ if ($this->char!==null && $space[0]==='')
1401
+ {
1402
+ break;
1403
+ }
1404
+ $name = $this->copy_until($this->token_equal);
1405
+ if ($guard===$this->pos)
1406
+ {
1407
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1408
+ continue;
1409
+ }
1410
+ $guard = $this->pos;
1411
+
1412
+ // handle endless '<'
1413
+ if ($this->pos>=$this->size-1 && $this->char!=='>') {
1414
+ $node->nodetype = HDOM_TYPE_TEXT;
1415
+ $node->_[HDOM_INFO_END] = 0;
1416
+ $node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name;
1417
+ $node->tag = 'text';
1418
+ $this->link_nodes($node, false);
1419
+ return true;
1420
+ }
1421
+
1422
+ // handle mismatch '<'
1423
+ if ($this->doc[$this->pos-1]=='<') {
1424
+ $node->nodetype = HDOM_TYPE_TEXT;
1425
+ $node->tag = 'text';
1426
+ $node->attr = array();
1427
+ $node->_[HDOM_INFO_END] = 0;
1428
+ $node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos-$begin_tag_pos-1);
1429
+ $this->pos -= 2;
1430
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1431
+ $this->link_nodes($node, false);
1432
+ return true;
1433
+ }
1434
+
1435
+ if ($name!=='/' && $name!=='') {
1436
+ $space[1] = $this->copy_skip($this->token_blank);
1437
+ $name = $this->restore_noise($name);
1438
+ if ($this->lowercase) $name = strtolower($name);
1439
+ if ($this->char==='=') {
1440
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1441
+ $this->parse_attr($node, $name, $space);
1442
+ }
1443
+ else {
1444
+ //no value attr: nowrap, checked selected...
1445
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1446
+ $node->attr[$name] = true;
1447
+ if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1448
+ }
1449
+ $node->_[HDOM_INFO_SPACE][] = $space;
1450
+ $space = array($this->copy_skip($this->token_blank), '', '');
1451
+ }
1452
+ else
1453
+ break;
1454
+ } while ($this->char!=='>' && $this->char!=='/');
1455
+
1456
+ $this->link_nodes($node, true);
1457
+ $node->_[HDOM_INFO_ENDSPACE] = $space[0];
1458
+
1459
+ // check self closing
1460
+ if ($this->copy_until_char_escape('>')==='/')
1461
+ {
1462
+ $node->_[HDOM_INFO_ENDSPACE] .= '/';
1463
+ $node->_[HDOM_INFO_END] = 0;
1464
+ }
1465
+ else
1466
+ {
1467
+ // reset parent
1468
+ if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1469
+ }
1470
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1471
+
1472
+ // If it's a BR tag, we need to set it's text to the default text.
1473
+ // This way when we see it in plaintext, we can generate formatting that the user wants.
1474
+ // since a br tag never has sub nodes, this works well.
1475
+ if ($node->tag == "br")
1476
+ {
1477
+ $node->_[HDOM_INFO_INNER] = $this->default_br_text;
1478
+ }
1479
+
1480
+ return true;
1481
+ }
1482
+
1483
+ // parse attributes
1484
+ protected function parse_attr($node, $name, &$space)
1485
+ {
1486
+ // Per sourceforge: http://sourceforge.net/tracker/?func=detail&aid=3061408&group_id=218559&atid=1044037
1487
+ // If the attribute is already defined inside a tag, only pay atetntion to the first one as opposed to the last one.
1488
+ if (isset($node->attr[$name]))
1489
+ {
1490
+ return;
1491
+ }
1492
+
1493
+ $space[2] = $this->copy_skip($this->token_blank);
1494
+ switch ($this->char) {
1495
+ case '"':
1496
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
1497
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1498
+ $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"'));
1499
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1500
+ break;
1501
+ case '\'':
1502
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE;
1503
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1504
+ $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\''));
1505
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1506
+ break;
1507
+ default:
1508
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1509
+ $node->attr[$name] = $this->restore_noise($this->copy_until($this->token_attr));
1510
+ }
1511
+ // PaperG: Attributes should not have \r or \n in them, that counts as html whitespace.
1512
+ $node->attr[$name] = str_replace("\r", "", $node->attr[$name]);
1513
+ $node->attr[$name] = str_replace("\n", "", $node->attr[$name]);
1514
+ // PaperG: If this is a "class" selector, lets get rid of the preceeding and trailing space since some people leave it in the multi class case.
1515
+ if ($name == "class") {
1516
+ $node->attr[$name] = trim($node->attr[$name]);
1517
+ }
1518
+ }
1519
+
1520
+ // link node's parent
1521
+ protected function link_nodes(&$node, $is_child)
1522
+ {
1523
+ $node->parent = $this->parent;
1524
+ $this->parent->nodes[] = $node;
1525
+ if ($is_child)
1526
+ {
1527
+ $this->parent->children[] = $node;
1528
+ }
1529
+ }
1530
+
1531
+ // as a text node
1532
+ protected function as_text_node($tag)
1533
+ {
1534
+ $node = new simple_html_dom_node($this);
1535
+ ++$this->cursor;
1536
+ $node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
1537
+ $this->link_nodes($node, false);
1538
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1539
+ return true;
1540
+ }
1541
+
1542
+ protected function skip($chars)
1543
+ {
1544
+ $this->pos += strspn($this->doc, $chars, $this->pos);
1545
+ $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1546
+ }
1547
+
1548
+ protected function copy_skip($chars)
1549
+ {
1550
+ $pos = $this->pos;
1551
+ $len = strspn($this->doc, $chars, $pos);
1552
+ $this->pos += $len;
1553
+ $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1554
+ if ($len===0) return '';
1555
+ return substr($this->doc, $pos, $len);
1556
+ }
1557
+
1558
+ protected function copy_until($chars)
1559
+ {
1560
+ $pos = $this->pos;
1561
+ $len = strcspn($this->doc, $chars, $pos);
1562
+ $this->pos += $len;
1563
+ $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1564
+ return substr($this->doc, $pos, $len);
1565
+ }
1566
+
1567
+ protected function copy_until_char($char)
1568
+ {
1569
+ if ($this->char===null) return '';
1570
+
1571
+ if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1572
+ $ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1573
+ $this->char = null;
1574
+ $this->pos = $this->size;
1575
+ return $ret;
1576
+ }
1577
+
1578
+ if ($pos===$this->pos) return '';
1579
+ $pos_old = $this->pos;
1580
+ $this->char = $this->doc[$pos];
1581
+ $this->pos = $pos;
1582
+ return substr($this->doc, $pos_old, $pos-$pos_old);
1583
+ }
1584
+
1585
+ protected function copy_until_char_escape($char)
1586
+ {
1587
+ if ($this->char===null) return '';
1588
+
1589
+ $start = $this->pos;
1590
+ while (1)
1591
+ {
1592
+ if (($pos = strpos($this->doc, $char, $start))===false)
1593
+ {
1594
+ $ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1595
+ $this->char = null;
1596
+ $this->pos = $this->size;
1597
+ return $ret;
1598
+ }
1599
+
1600
+ if ($pos===$this->pos) return '';
1601
+
1602
+ if ($this->doc[$pos-1]==='\\') {
1603
+ $start = $pos+1;
1604
+ continue;
1605
+ }
1606
+
1607
+ $pos_old = $this->pos;
1608
+ $this->char = $this->doc[$pos];
1609
+ $this->pos = $pos;
1610
+ return substr($this->doc, $pos_old, $pos-$pos_old);
1611
+ }
1612
+ }
1613
+
1614
+ // remove noise from html content
1615
+ // save the noise in the $this->noise array.
1616
+ protected function remove_noise($pattern, $remove_tag=false)
1617
+ {
1618
+ global $debug_object;
1619
+ if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
1620
+
1621
+ $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
1622
+
1623
+ for ($i=$count-1; $i>-1; --$i)
1624
+ {
1625
+ $key = '___noise___'.sprintf('% 5d', count($this->noise)+1000);
1626
+ if (is_object($debug_object)) { $debug_object->debugLog(2, 'key is: ' . $key); }
1627
+ $idx = ($remove_tag) ? 0 : 1;
1628
+ $this->noise[$key] = $matches[$i][$idx][0];
1629
+ $this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
1630
+ }
1631
+
1632
+ // reset the length of content
1633
+ $this->size = strlen($this->doc);
1634
+ if ($this->size>0)
1635
+ {
1636
+ $this->char = $this->doc[0];
1637
+ }
1638
+ }
1639
+
1640
+ // restore noise to html content
1641
+ function restore_noise($text)
1642
+ {
1643
+ global $debug_object;
1644
+ if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
1645
+
1646
+ while (($pos=strpos($text, '___noise___'))!==false)
1647
+ {
1648
+ // Sometimes there is a broken piece of markup, and we don't GET the pos+11 etc... token which indicates a problem outside of us...
1649
+ if (strlen($text) > $pos+15)
1650
+ {
1651
+ $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15];
1652
+ if (is_object($debug_object)) { $debug_object->debugLog(2, 'located key of: ' . $key); }
1653
+
1654
+ if (isset($this->noise[$key]))
1655
+ {
1656
+ $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1657
+ }
1658
+ else
1659
+ {
1660
+ // do this to prevent an infinite loop.
1661
+ $text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1662
+ }
1663
+ }
1664
+ else
1665
+ {
1666
+ // There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1667
+ $text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
1668
+ }
1669
+ }
1670
+ return $text;
1671
+ }
1672
+
1673
+ // Sometimes we NEED one of the noise elements.
1674
+ function search_noise($text)
1675
+ {
1676
+ global $debug_object;
1677
+ if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
1678
+
1679
+ foreach($this->noise as $noiseElement)
1680
+ {
1681
+ if (strpos($noiseElement, $text)!==false)
1682
+ {
1683
+ return $noiseElement;
1684
+ }
1685
+ }
1686
+ }
1687
+ function __toString()
1688
+ {
1689
+ return $this->root->innertext();
1690
+ }
1691
+
1692
+ function __get($name)
1693
+ {
1694
+ switch ($name)
1695
+ {
1696
+ case 'outertext':
1697
+ return $this->root->innertext();
1698
+ case 'innertext':
1699
+ return $this->root->innertext();
1700
+ case 'plaintext':
1701
+ return $this->root->text();
1702
+ case 'charset':
1703
+ return $this->_charset;
1704
+ case 'target_charset':
1705
+ return $this->_target_charset;
1706
+ }
1707
+ }
1708
+
1709
+ // camel naming conventions
1710
+ function childNodes($idx=-1) {return $this->root->childNodes($idx);}
1711
+ function firstChild() {return $this->root->first_child();}
1712
+ function lastChild() {return $this->root->last_child();}
1713
+ function createElement($name, $value=null) {return @str_get_html("<$name>$value</$name>")->first_child();}
1714
+ function createTextNode($value) {return @end(str_get_html($value)->nodes);}
1715
+ function getElementById($id) {return $this->find("#$id", 0);}
1716
+ function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
1717
+ function getElementByTagName($name) {return $this->find($name, 0);}
1718
+ function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);}
1719
+ function loadFile() {$args = func_get_args();$this->load_file($args);}
1720
+ }
1721
+
1722
+ ?>
templates/audio_templates.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
 
2
  $google_reader = '<embed type="application/x-shockwave-flash" ' .
3
- 'src="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl={FILELINK}" ' .
4
- 'width="400" height="27" allowscriptaccess="never" quality="best" ' .
5
- 'bgcolor="#ffffff" wmode="window" flashvars="playerMode=embedded" />';
6
 
7
  $simple_link = '<a href="{FILELINK}">{FILENAME}</a>';
8
 
9
- $custom=$config['AUDIOTEMPLATE'];
10
- $audioTemplates=compact('google_reader','simple_link',
11
- 'custom');
12
  ?>
1
  <?php
2
+
3
  $google_reader = '<embed type="application/x-shockwave-flash" ' .
4
+ 'src="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl={FILELINK}" ' .
5
+ 'width="400" height="27" allowscriptaccess="never" quality="best" ' .
6
+ 'bgcolor="#ffffff" wmode="window" flashvars="playerMode=embedded" />';
7
 
8
  $simple_link = '<a href="{FILELINK}">{FILENAME}</a>';
9
 
10
+ $custom = isset($config) ? (array_key_exists('AUDIOTEMPLATE', $config) ? $config['AUDIOTEMPLATE'] : "") : "";
11
+ $audioTemplates = compact('google_reader', 'simple_link', 'custom');
 
12
  ?>
templates/image_templates.php CHANGED
@@ -7,6 +7,6 @@ $thumbnail_left = '<div style="float:left;margin-right:10px;"><a href="{IMAGE}">
7
  $thumbnail_right = '<div style="float:right;margin-left:10px;"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a></div>';
8
  $wordpress_default = '<div id="attachment_{ID}" class="wp-caption alignleft" style="width: {MEDIUMWIDTH};"><a rel="attachment wp-att-{ID}" href="{PAGELINK}"><img class="size-medium wp-image-{ID}" title="{TITLE}" alt="{CAPTION}" src="{MEDIUM}" /> </a><p class="wp-caption-text">{CAPTION}</p></div>';
9
  $postie_legacy = '<div class="postie-image-div"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{FILENAME}" title="{FILENAME}" style="border:none" class="postie-image" /></a></div>';
10
- $custom = $config['IMAGETEMPLATE'];
11
  $imageTemplates = compact('simple_link', 'no_wrappers', 'wordpress_default', 'thumbnail_left', 'thumbnail_right', 'robert_felty', 'postie_legacy', 'custom');
12
  ?>
7
  $thumbnail_right = '<div style="float:right;margin-left:10px;"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a></div>';
8
  $wordpress_default = '<div id="attachment_{ID}" class="wp-caption alignleft" style="width: {MEDIUMWIDTH};"><a rel="attachment wp-att-{ID}" href="{PAGELINK}"><img class="size-medium wp-image-{ID}" title="{TITLE}" alt="{CAPTION}" src="{MEDIUM}" /> </a><p class="wp-caption-text">{CAPTION}</p></div>';
9
  $postie_legacy = '<div class="postie-image-div"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{FILENAME}" title="{FILENAME}" style="border:none" class="postie-image" /></a></div>';
10
+ $custom = isset($config) ? (array_key_exists('IMAGETEMPLATE', $config) ? $config['IMAGETEMPLATE'] : "") : "";
11
  $imageTemplates = compact('simple_link', 'no_wrappers', 'wordpress_default', 'thumbnail_left', 'thumbnail_right', 'robert_felty', 'postie_legacy', 'custom');
12
  ?>
templates/video1_templates.php CHANGED
@@ -1,83 +1,83 @@
1
  <?php
2
- $small = '<object '.
3
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
4
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
5
- 'width="128"'. 'height="96"> '.
6
- '<param name="src" value="{FILELINK}" /> '.
7
- '<param name="autoplay" value="no" /> '.
8
- '<param name="controller" value="true" /> '.
9
- '<embed src="{FILELINK}" '.
10
- 'width="128" height="96"'.
11
- 'autoplay="no" controller="true" '.
12
- 'type="video/quicktime" '.
13
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
14
- 'width="128" height="110">'.
15
- '</embed> '.
16
- '</object>';
17
- $medium = '<object '.
18
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
19
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
20
- 'width="320"'. 'height="240"> '.
21
- '<param name="src" value="{FILELINK}" /> '.
22
- '<param name="autoplay" value="no" /> '.
23
- '<param name="controller" value="true" /> '.
24
- '<embed src="{FILELINK}" '.
25
- 'width="320" height="240"'.
26
- 'autoplay="no" controller="true" '.
27
- 'type="video/quicktime" '.
28
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
29
- 'width="320" height="260">'.
30
- '</embed> '.
31
- '</object>';
32
- $medium_widescreen = '<object '.
33
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
34
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
35
- 'width="480"'. 'height="270"> '.
36
- '<param name="src" value="{FILELINK}" /> '.
37
- '<param name="autoplay" value="no" /> '.
38
- '<param name="controller" value="true" /> '.
39
- '<embed src="{FILELINK}" '.
40
- 'width="480" height="270"'.
41
- 'autoplay="no" controller="true" '.
42
- 'type="video/quicktime" '.
43
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
44
- 'width="480" height="290">'.
45
- '</embed> '.
46
- '</object>';
47
- $large = '<object '.
48
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
49
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
50
- 'width="480"'. 'height="360"> '.
51
- '<param name="src" value="{FILELINK}" /> '.
52
- '<param name="autoplay" value="no" /> '.
53
- '<param name="controller" value="true" /> '.
54
- '<embed src="{FILELINK}" '.
55
- 'width="480" height="360"'.
56
- 'autoplay="no" controller="true" '.
57
- 'type="video/quicktime" '.
58
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
59
- 'width="480" height="380">'.
60
- '</embed> '.
61
- '</object>';
62
- $large_widescreen = '<object '.
63
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
64
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
65
- 'width="640"'. 'height="360"> '.
66
- '<param name="src" value="{FILELINK}" /> '.
67
- '<param name="autoplay" value="no" /> '.
68
- '<param name="controller" value="true" /> '.
69
- '<embed src="{FILELINK}" '.
70
- 'width="640" height="360"'.
71
- 'autoplay="no" controller="true" '.
72
- 'type="video/quicktime" '.
73
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
74
- 'width="640" height="380">'.
75
- '</embed> '.
76
- '</object>';
 
77
 
78
  $simple_link = '<a href="{FILELINK}">{FILENAME}</a>';
79
 
80
- $custom=$config['VIDEO1TEMPLATE'];
81
- $video1Templates=compact('simple_link','small', 'medium',
82
- 'medium_widescreen', 'large','large_widescreen', 'custom');
83
  ?>
1
  <?php
2
+
3
+ $small = '<object ' .
4
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
5
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
6
+ 'width="128"' . 'height="96"> ' .
7
+ '<param name="src" value="{FILELINK}" /> ' .
8
+ '<param name="autoplay" value="no" /> ' .
9
+ '<param name="controller" value="true" /> ' .
10
+ '<embed src="{FILELINK}" ' .
11
+ 'width="128" height="96"' .
12
+ 'autoplay="no" controller="true" ' .
13
+ 'type="video/quicktime" ' .
14
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
15
+ 'width="128" height="110">' .
16
+ '</embed> ' .
17
+ '</object>';
18
+ $medium = '<object ' .
19
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
20
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
21
+ 'width="320"' . 'height="240"> ' .
22
+ '<param name="src" value="{FILELINK}" /> ' .
23
+ '<param name="autoplay" value="no" /> ' .
24
+ '<param name="controller" value="true" /> ' .
25
+ '<embed src="{FILELINK}" ' .
26
+ 'width="320" height="240"' .
27
+ 'autoplay="no" controller="true" ' .
28
+ 'type="video/quicktime" ' .
29
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
30
+ 'width="320" height="260">' .
31
+ '</embed> ' .
32
+ '</object>';
33
+ $medium_widescreen = '<object ' .
34
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
35
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
36
+ 'width="480"' . 'height="270"> ' .
37
+ '<param name="src" value="{FILELINK}" /> ' .
38
+ '<param name="autoplay" value="no" /> ' .
39
+ '<param name="controller" value="true" /> ' .
40
+ '<embed src="{FILELINK}" ' .
41
+ 'width="480" height="270"' .
42
+ 'autoplay="no" controller="true" ' .
43
+ 'type="video/quicktime" ' .
44
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
45
+ 'width="480" height="290">' .
46
+ '</embed> ' .
47
+ '</object>';
48
+ $large = '<object ' .
49
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
50
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
51
+ 'width="480"' . 'height="360"> ' .
52
+ '<param name="src" value="{FILELINK}" /> ' .
53
+ '<param name="autoplay" value="no" /> ' .
54
+ '<param name="controller" value="true" /> ' .
55
+ '<embed src="{FILELINK}" ' .
56
+ 'width="480" height="360"' .
57
+ 'autoplay="no" controller="true" ' .
58
+ 'type="video/quicktime" ' .
59
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
60
+ 'width="480" height="380">' .
61
+ '</embed> ' .
62
+ '</object>';
63
+ $large_widescreen = '<object ' .
64
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
65
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
66
+ 'width="640"' . 'height="360"> ' .
67
+ '<param name="src" value="{FILELINK}" /> ' .
68
+ '<param name="autoplay" value="no" /> ' .
69
+ '<param name="controller" value="true" /> ' .
70
+ '<embed src="{FILELINK}" ' .
71
+ 'width="640" height="360"' .
72
+ 'autoplay="no" controller="true" ' .
73
+ 'type="video/quicktime" ' .
74
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
75
+ 'width="640" height="380">' .
76
+ '</embed> ' .
77
+ '</object>';
78
 
79
  $simple_link = '<a href="{FILELINK}">{FILENAME}</a>';
80
 
81
+ $custom = isset($config) ? (array_key_exists('VIDEO1TEMPLATE', $config) ? $config['VIDEO1TEMPLATE'] : "") : "";
82
+ $video1Templates = compact('simple_link', 'small', 'medium', 'medium_widescreen', 'large', 'large_widescreen', 'custom');
 
83
  ?>
templates/video2_templates.php CHANGED
@@ -1,84 +1,84 @@
1
  <?php
2
- $small = '<object '.
3
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
4
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
5
- 'width="128"'. 'height="96"> '.
6
- '<param name="src" value="{FILELINK}" /> '.
7
- '<param name="autoplay" value="no" /> '.
8
- '<param name="controller" value="true" /> '.
9
- '<embed src="{FILELINK}" '.
10
- 'width="128" height="96"'.
11
- 'autoplay="no" controller="true" '.
12
- 'type="video/quicktime" '.
13
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
14
- 'width="128" height="110">'.
15
- '</embed> '.
16
- '</object>';
17
- $medium = '<object '.
18
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
19
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
20
- 'width="320"'. 'height="240"> '.
21
- '<param name="src" value="{FILELINK}" /> '.
22
- '<param name="autoplay" value="no" /> '.
23
- '<param name="controller" value="true" /> '.
24
- '<embed src="{FILELINK}" '.
25
- 'width="320" height="240"'.
26
- 'autoplay="no" controller="true" '.
27
- 'type="video/quicktime" '.
28
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
29
- 'width="320" height="260">'.
30
- '</embed> '.
31
- '</object>';
32
- $medium_widescreen = '<object '.
33
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
34
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
35
- 'width="480"'. 'height="270"> '.
36
- '<param name="src" value="{FILELINK}" /> '.
37
- '<param name="autoplay" value="no" /> '.
38
- '<param name="controller" value="true" /> '.
39
- '<embed src="{FILELINK}" '.
40
- 'width="480" height="270"'.
41
- 'autoplay="no" controller="true" '.
42
- 'type="video/quicktime" '.
43
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
44
- 'width="480" height="290">'.
45
- '</embed> '.
46
- '</object>';
47
- $large = '<object '.
48
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
49
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
50
- 'width="480"'. 'height="360"> '.
51
- '<param name="src" value="{FILELINK}" /> '.
52
- '<param name="autoplay" value="no" /> '.
53
- '<param name="controller" value="true" /> '.
54
- '<embed src="{FILELINK}" '.
55
- 'width="480" height="360"'.
56
- 'autoplay="no" controller="true" '.
57
- 'type="video/quicktime" '.
58
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
59
- 'width="480" height="380">'.
60
- '</embed> '.
61
- '</object>';
62
- $large_widescreen = '<object '.
63
- 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '.
64
- 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" '.
65
- 'width="640"'. 'height="360"> '.
66
- '<param name="src" value="{FILELINK}" /> '.
67
- '<param name="autoplay" value="no" /> '.
68
- '<param name="controller" value="true" /> '.
69
- '<embed src="{FILELINK}" '.
70
- 'width="640" height="360"'.
71
- 'autoplay="no" controller="true" '.
72
- 'type="video/quicktime" '.
73
- 'pluginspage="http://www.apple.com/quicktime/download/" '.
74
- 'width="640" height="380">'.
75
- '</embed> '.
76
- '</object>';
 
77
  $flv_embed = '[flv:{FILELINK} 480 270]';
78
 
79
  $simple_link = '<a href="{FILELINK}">{FILENAME}</a>';
80
 
81
- $custom=$config['VIDEO2TEMPLATE'];
82
- $video2Templates=compact('simple_link','small', 'medium',
83
- 'medium_widescreen', 'large','large_widescreen', 'flv_embed', 'custom');
84
  ?>
1
  <?php
2
+
3
+ $small = '<object ' .
4
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
5
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
6
+ 'width="128"' . 'height="96"> ' .
7
+ '<param name="src" value="{FILELINK}" /> ' .
8
+ '<param name="autoplay" value="no" /> ' .
9
+ '<param name="controller" value="true" /> ' .
10
+ '<embed src="{FILELINK}" ' .
11
+ 'width="128" height="96"' .
12
+ 'autoplay="no" controller="true" ' .
13
+ 'type="video/quicktime" ' .
14
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
15
+ 'width="128" height="110">' .
16
+ '</embed> ' .
17
+ '</object>';
18
+ $medium = '<object ' .
19
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
20
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
21
+ 'width="320"' . 'height="240"> ' .
22
+ '<param name="src" value="{FILELINK}" /> ' .
23
+ '<param name="autoplay" value="no" /> ' .
24
+ '<param name="controller" value="true" /> ' .
25
+ '<embed src="{FILELINK}" ' .
26
+ 'width="320" height="240"' .
27
+ 'autoplay="no" controller="true" ' .
28
+ 'type="video/quicktime" ' .
29
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
30
+ 'width="320" height="260">' .
31
+ '</embed> ' .
32
+ '</object>';
33
+ $medium_widescreen = '<object ' .
34
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
35
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
36
+ 'width="480"' . 'height="270"> ' .
37
+ '<param name="src" value="{FILELINK}" /> ' .
38
+ '<param name="autoplay" value="no" /> ' .
39
+ '<param name="controller" value="true" /> ' .
40
+ '<embed src="{FILELINK}" ' .
41
+ 'width="480" height="270"' .
42
+ 'autoplay="no" controller="true" ' .
43
+ 'type="video/quicktime" ' .
44
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
45
+ 'width="480" height="290">' .
46
+ '</embed> ' .
47
+ '</object>';
48
+ $large = '<object ' .
49
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
50
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
51
+ 'width="480"' . 'height="360"> ' .
52
+ '<param name="src" value="{FILELINK}" /> ' .
53
+ '<param name="autoplay" value="no" /> ' .
54
+ '<param name="controller" value="true" /> ' .
55
+ '<embed src="{FILELINK}" ' .
56
+ 'width="480" height="360"' .
57
+ 'autoplay="no" controller="true" ' .
58
+ 'type="video/quicktime" ' .
59
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
60
+ 'width="480" height="380">' .
61
+ '</embed> ' .
62
+ '</object>';
63
+ $large_widescreen = '<object ' .
64
+ 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' .
65
+ 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' .
66
+ 'width="640"' . 'height="360"> ' .
67
+ '<param name="src" value="{FILELINK}" /> ' .
68
+ '<param name="autoplay" value="no" /> ' .
69
+ '<param name="controller" value="true" /> ' .
70
+ '<embed src="{FILELINK}" ' .
71
+ 'width="640" height="360"' .
72
+ 'autoplay="no" controller="true" ' .
73
+ 'type="video/quicktime" ' .
74
+ 'pluginspage="http://www.apple.com/quicktime/download/" ' .
75
+ 'width="640" height="380">' .
76
+ '</embed> ' .
77
+ '</object>';
78
  $flv_embed = '[flv:{FILELINK} 480 270]';
79
 
80
  $simple_link = '<a href="{FILELINK}">{FILENAME}</a>';
81
 
82
+ $custom = isset($config) ? (array_key_exists('VIDEO2TEMPLATE', $config) ? $config['VIDEO2TEMPLATE'] : "") : "";
83
+ $video2Templates = compact('simple_link', 'small', 'medium', 'medium_widescreen', 'large', 'large_widescreen', 'flv_embed', 'custom');
 
84
  ?>
test/data/greek.var ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ s:2725:"Delivered-To: postie-test@devzing.com
2
+ Received: by 10.220.227.198 with SMTP id jb6csp7585vcb;
3
+ Sat, 1 Dec 2012 22:01:23 -0800 (PST)
4
+ Received: by 10.50.152.194 with SMTP id va2mr3076277igb.25.1354428082745;
5
+ Sat, 01 Dec 2012 22:01:22 -0800 (PST)
6
+ Return-Path: <wayne@allens-home.com>
7
+ Received: from mail-ie0-f173.google.com (mail-ie0-f173.google.com [209.85.223.173])
8
+ by mx.google.com with ESMTPS id 16si4308218ige.4.2012.12.01.22.01.22
9
+ (version=TLSv1/SSLv3 cipher=OTHER);
10
+ Sat, 01 Dec 2012 22:01:22 -0800 (PST)
11
+ Received-SPF: neutral (google.com: 209.85.223.173 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) client-ip=209.85.223.173;
12
+ Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.223.173 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) smtp.mail=wayne@allens-home.com
13
+ Received: by mail-ie0-f173.google.com with SMTP id e13so3052717iej.32
14
+ for <postie-test@devzing.com>; Sat, 01 Dec 2012 22:01:22 -0800 (PST)
15
+ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
16
+ d=google.com; s=20120113;
17
+ h=mime-version:date:message-id:subject:from:to:content-type
18
+ :x-gm-message-state;
19
+ bh=S/ndwZBwTR6ONzipKKSDuVJwYg2/W1DQTwun5yF9Ogw=;
20
+ b=B/u1kvkvieG/Ow1bBoQujjCxsVxC++a9Gb2jRwlr8EP7y0yxYIImxWnt4BWJ+56mVk
21
+ SzcCdt5el37M0bDdO6AIUeSW4gzrmXF/L1WaconU4UwFPPcFvDAaWo0Z1HiFnDd91mw2
22
+ EUkwsZ4ghv2ottN7oQL2qHAzLuHOyngSu9wz4vIk0vIH5wPxbcS+RgnTT3+xskhfqJMz
23
+ VHuXQRoPeNh9len+Ntv0HRebq4NMM3cTnHt+ySkl/1aFvtBJr9WJMfoIzvBp8v12rWjL
24
+ 4STlSocKRzer/jRbAygQZQEx/cGA4XF44YYR4vDQ5V436p7ABfZyUnzsymlt4fXRdbOd
25
+ I66Q==
26
+ MIME-Version: 1.0
27
+ Received: by 10.43.125.133 with SMTP id gs5mr4962648icc.54.1354428082489; Sat,
28
+ 01 Dec 2012 22:01:22 -0800 (PST)
29
+ Received: by 10.231.82.14 with HTTP; Sat, 1 Dec 2012 22:01:22 -0800 (PST)
30
+ Date: Sat, 1 Dec 2012 22:01:22 -0800
31
+ Message-ID: <CACOA_7bdyOEd5V7bt-8hvfEc+Zk_tp6t+cVWiMfJ6n8AWMYZTA@mail.gmail.com>
32
+ Subject: greek test
33
+ From: Wayne Allen <wayne@allens-home.com>
34
+ To: postie-test@devzing.com
35
+ Content-Type: multipart/alternative; boundary=bcaec517cbe0bb0ae204cfd85c4b
36
+ X-Gm-Message-State: ALoCoQlF0sbc9qqGwJYcyICAYM4dXpRnr1a8QqejtZsnMc7PC6F+qenAXRNp+YGADf7QK5sSynvW
37
+
38
+ --bcaec517cbe0bb0ae204cfd85c4b
39
+ Content-Type: text/plain; charset=ISO-8859-7
40
+ Content-Transfer-Encoding: base64
41
+
42
+ QUJDw8TOQUJDCg==
43
+ --bcaec517cbe0bb0ae204cfd85c4b
44
+ Content-Type: text/html; charset=ISO-8859-7
45
+ Content-Transfer-Encoding: quoted-printable
46
+
47
+ <span style=3D"font-family:arial,sans-serif;font-size:13px">ABC=C3=C4=CEABC=
48
+ </span><br>
49
+
50
+ --bcaec517cbe0bb0ae204cfd85c4b--
51
+ ";
test/data/inline.var ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ s:5056:"Delivered-To: postie-test@devzing.com
2
+ Received: by 10.221.2.193 with SMTP id nv1csp416450vcb;
3
+ Mon, 26 Nov 2012 16:14:00 -0800 (PST)
4
+ Received: by 10.42.104.209 with SMTP id s17mr12163956ico.11.1353975240662;
5
+ Mon, 26 Nov 2012 16:14:00 -0800 (PST)
6
+ Return-Path: <wayne@allens-home.com>
7
+ Received: from mail-ia0-f169.google.com (mail-ia0-f169.google.com [209.85.210.169])
8
+ by mx.google.com with ESMTPS id aq7si10161123icc.18.2012.11.26.16.14.00
9
+ (version=TLSv1/SSLv3 cipher=OTHER);
10
+ Mon, 26 Nov 2012 16:14:00 -0800 (PST)
11
+ Received-SPF: neutral (google.com: 209.85.210.169 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) client-ip=209.85.210.169;
12
+ Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.169 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) smtp.mail=wayne@allens-home.com
13
+ Received: by mail-ia0-f169.google.com with SMTP id r4so10387111iaj.0
14
+ for <postie-test@devzing.com>; Mon, 26 Nov 2012 16:14:00 -0800 (PST)
15
+ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
16
+ d=google.com; s=20120113;
17
+ h=mime-version:date:message-id:subject:from:to:content-type
18
+ :x-gm-message-state;
19
+ bh=Q0xAhuQolBpYqEtGVYc17h1LtHqH6g6VJl8Eso5BUcY=;
20
+ b=OEsnsnBaw2PXKD3abdEkE5wLr0KgxaZb+vVbwbWBMrzhT4R2Kst1paLItKW2UjGGiR
21
+ 6C1X8shgWcqtjPXcMjj8VRh8dZKzGQ4fpMAomTQN9eXq5DeTNsqL4E0teJXgbGXuGEeu
22
+ 5XAo0T0coE/2DrgwlWazRF78EOYZuor93UrZGjHyFC1eylauYpL5vhab7R66aIVRcVHg
23
+ cMXtRqSAk1fbqcW+q57nDHMezqN+58cpSALhg8iW4nGo3nBNeyvtXJNIICTceyetFAHe
24
+ 26vY3fqNDxAcSzAQlTJUbJ5K9/wSRIoSFa5FEHR0s0B2hr+xXwPuRRhw+DP1sj9LEayj
25
+ O0zg==
26
+ MIME-Version: 1.0
27
+ Received: by 10.50.33.174 with SMTP id s14mr13720402igi.11.1353975240290; Mon,
28
+ 26 Nov 2012 16:14:00 -0800 (PST)
29
+ Received: by 10.231.82.14 with HTTP; Mon, 26 Nov 2012 16:14:00 -0800 (PST)
30
+ Date: Mon, 26 Nov 2012 16:14:00 -0800
31
+ Message-ID: <CACOA_7bmsDTsKPsA5omBwXZ0V2QFQrMgLViQoz0wbqmDFgc5hQ@mail.gmail.com>
32
+ Subject: inline
33
+ From: Wayne Allen <wayne@allens-home.com>
34
+ To: postie-test@devzing.com
35
+ Content-Type: multipart/related; boundary=f46d044469693b709d04cf6eed7c
36
+ X-Gm-Message-State: ALoCoQl6IZOwAkjVyUqBQYnnR0i4/GY6NPx/7EbdKOg0Hfu0fxG3y1EWsEWW2dUhxr1S6oP8tsH5
37
+
38
+ --f46d044469693b709d04cf6eed7c
39
+ Content-Type: multipart/alternative; boundary=f46d044469693b709a04cf6eed7b
40
+
41
+ --f46d044469693b709a04cf6eed7b
42
+ Content-Type: text/plain; charset=ISO-8859-1
43
+
44
+ test
45
+
46
+ [image: Inline image 1]
47
+
48
+ test
49
+
50
+ --f46d044469693b709a04cf6eed7b
51
+ Content-Type: text/html; charset=ISO-8859-1
52
+
53
+ test<div><br></div><div><img src="cid:ii_13b3f367df7284ff" alt="Inline image 1"><br></div><div><br></div><div>test</div>
54
+
55
+ --f46d044469693b709a04cf6eed7b--
56
+ --f46d044469693b709d04cf6eed7c
57
+ Content-Type: image/png; name="image.png"
58
+ Content-Transfer-Encoding: base64
59
+ Content-ID: <ii_13b3f367df7284ff>
60
+ X-Attachment-Id: ii_13b3f367df7284ff
61
+
62
+ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFkUlEQVRYw8VXW2xURRj+zjnbvfS2
63
+ banY1iJbBWql0gViBBMRYkkkMcQYIi/eHoz6QozERxPRPpoYNAaNT8TU2IQYIzxUSWiKNdw1LbZY
64
+ obXbgqWl9ML2svczzvxnzm13u+WBpJNMZ6Znzvm///uvqzDGsJrD4zx83/bem+lU+nhxwAdVVaEq
65
+ Cq0KX+3BoOt8MrHqyIiZMfcZPhk/63TWXSv75P0vO44UBMDFvGUIU0gogVAVAkJPhXguWFE5a/zD
66
+ /BKYooKpOofF32ECrE7v5s77YMACohjizJedLDBmMMBsPvj/BBBzcmwKHEJNAKxlRQB00eRCMXcS
67
+ hASjk8/YQrO1NO8yhdE3uGACxUfFigCEdvFEEgHuA9lsCFMQC5x5Ibi4vBJFJUGy8cK9aSzMTsM0
68
+ nwVeApMshFYGAIQdaKyFybXI50dd806s3RiGv9StUCoRw9AfZzF4sQvxpUUpmFlK8F1eAIozDNs/
69
+ fZfFFuOoqCiFxu2uaZpcVQTXPoLtL7/DQQQQi85iYrgfidgiebzm9aG+sQWlFdVYmLuL7o6vMTU+
70
+ Ss8YRYkRCVxW5aGjP8wVNAFZWJhPTN3w6LKqGmzd/za0Ih+u/34Kkd4ezMczXLAfmVQKqVQSV3t+
71
+ RdOOVmx+thU79r+BU9+05Xo2Y4Lh7sIAaOpEuS7CioPYsHMfdwIPrnX/jJt/nUPTnldQ27jNRb9g
72
+ pqv9C1TXP4aq2nWo37QFo3/3OkNcKJfjiKrzQOElw8ycXu5opQ/VIzpzB5G+HqwL78KahmYsLUQx
73
+ eO4XTHOqmaIhmUziztgNRK79Sfvy6lrTryzl4PSxfADEpWQyRaGWoWynQ/WXcopT3Mvvki2rGjbT
74
+ ubezHf9e6cLA2ZN0nrk9ZjgrZ0yc5/l9F4L7ScW6dHkRWgQto/CPpUkj8VGRdjVfCe2jU7fpXrDm
75
+ UTrPTt7ioaqhrjFM96duDptamwEl1ucLA5AZTmhPAc8jYG7yPxIQqKqFonkR6b+Euk1hhJ55EYmF
76
+ OdQ2PU0C0+k0nnrhADR/Ca50dmApOkMSbRD2vgAAnV4yVsVAzhIYuXoR9U3bsHH3AfSfOYHxoQG0
77
+ 7H0V/kQco/2XKSdUrW8iZzz/03FEJ0fsHGL8MUGECyciyYBggkwgw/DG+dMIBKtRVl2DJ1sPYuDM
78
+ j+j57jOkUwnLdKpWZKTqTEp+S5daw1rzpWNXIjr24WssGed0l/plEbJrQDyhI7R9D+qeaCnoVDO3
79
+ hnC95yQpI5g0VzKvsW84fOxEZFkGrFURdU6lQiIKiterYOTSaYz2XcDDG5qJDY/PJ/NAHLF7c5jl
80
+ kTA/MQKPBznaO3xApOTIsj7ApA9QIeFhqKhWOeXJRtAcw8TgBYxxpohmEcs8VXs8YmqWcENj3RbM
81
+ rP+H8vrA0UMHQ0KQ8AKRtxXqAXibwRwNhaxyGgcVKPbaIS61NBMZybOUMai3s+wyAJhAJvOleElo
82
+ L3zANIFZ3QyQ7mF/HFboWcKtveEH/BDMC8Ck3WkC0XQQCFnbqcEQJwXZVdsl2GlzyxklOA4ivAwA
83
+ ZmlqOCGoq2HM9oF82rtZQB6b6y6TZCcjT3YOUDXFdkLZDgkg1KwRCMBFgV1oXIJdbEgQssDtzgsg
84
+ k8kYsU8AYNnb2evZDDjMwPL5AnNlQaczIosB1cmA4SSSDRlGpvNQ389B6rqj1zf7ftczRwjq7tJu
85
+ Aml7/aVwDgPJRIoeLs7HINqyBzlELhE5AswkjFXkAIjOLdJa3bQFJSLWi7zwBSsf+E+x+fGxD2aH
86
+ /+nNWwsO79s10vDc3tCa0OMoLy+npjT7p5llggLTZSp5FnIm+y7jo6++VZYtRhzAEX9Z8OMAF56O
87
+ x93dnNPfGMtutezwks/y1f50bIk3scmtn3f+lp+B1RgqVnn8D2EhQytoYdIJAAAAAElFTkSuQmCC
88
+ --f46d044469693b709d04cf6eed7c--
89
+ ";
test/data/multiple images with signature.var ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ s:7438:"Delivered-To: postie-test@devzing.com
2
+ Received: by 10.220.23.143 with SMTP id r15csp1131186vcb;
3
+ Thu, 29 Nov 2012 12:58:38 -0800 (PST)
4
+ Received: by 10.50.159.170 with SMTP id xd10mr23905932igb.44.1354222718591;
5
+ Thu, 29 Nov 2012 12:58:38 -0800 (PST)
6
+ Return-Path: <wayne@allens-home.com>
7
+ Received: from mail-ia0-f170.google.com (mail-ia0-f170.google.com [209.85.210.170])
8
+ by mx.google.com with ESMTPS id t3si7237960igb.38.2012.11.29.12.58.38
9
+ (version=TLSv1/SSLv3 cipher=OTHER);
10
+ Thu, 29 Nov 2012 12:58:38 -0800 (PST)
11
+ Received-SPF: neutral (google.com: 209.85.210.170 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) client-ip=209.85.210.170;
12
+ Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.170 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) smtp.mail=wayne@allens-home.com
13
+ Received: by mail-ia0-f170.google.com with SMTP id x24so10270378iak.15
14
+ for <postie-test@devzing.com>; Thu, 29 Nov 2012 12:58:38 -0800 (PST)
15
+ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
16
+ d=google.com; s=20120113;
17
+ h=mime-version:date:message-id:subject:from:to:content-type
18
+ :x-gm-message-state;
19
+ bh=6dBv9dZdJI0ynqidMvwWLNiTUsGAqGbPYVosbIVZXBI=;
20
+ b=hZ6gFmlNIuYfaQ/iFDqO73VAEBTMjE6uvUs/fxNjHXF1n/ifBkv4DmzoVssKVXGRz/
21
+ 4wNNqgSz9g1CPz4kderoBieZe/tPTBNbg/TouZfADr5s+JirCpkz9QvwRjk1QS3J4IQJ
22
+ aDq1bcJrGASTKtUY5ug5tHJrIMetGC4TKbVdOYa8NswUh8kXEU4v3nFe2WDJbNwFY/Bb
23
+ LZTDxFM1ppIcAOwI8f2jmrwD84K8E8B6AslHJXK1ytNkfsaYrICXjiuwg3Pgg1uD0Wqu
24
+ bT0EgwNGsR8Z/NJFLcFsP5szfzy5t/S5tV07fW0r/rstWwWi++2xXLgOZtyLYaLw/Mwo
25
+ VSqA==
26
+ MIME-Version: 1.0
27
+ Received: by 10.50.33.174 with SMTP id s14mr24109385igi.11.1354222718303; Thu,
28
+ 29 Nov 2012 12:58:38 -0800 (PST)
29
+ Received: by 10.231.82.14 with HTTP; Thu, 29 Nov 2012 12:58:38 -0800 (PST)
30
+ Date: Thu, 29 Nov 2012 12:58:38 -0800
31
+ Message-ID: <CACOA_7Zqe1DMw-Ee8bf8xQGy8KhLgi2+N3uVkVbygKe5BkzEmw@mail.gmail.com>
32
+ Subject: multiple image test w/ sig
33
+ From: Wayne Allen <wayne@allens-home.com>
34
+ To: postie-test@devzing.com
35
+ Content-Type: multipart/related; boundary=f46d04446969123c9704cfa88c23
36
+ X-Gm-Message-State: ALoCoQncCKsaqxhX2Y2BNCLN/uEdbDVWzQ5tOHrKJLi/AoLL0RthL38BzLECwtgJ3umoxCWiTJf3
37
+
38
+ --f46d04446969123c9704cfa88c23
39
+ Content-Type: multipart/alternative; boundary=f46d04446969123c9404cfa88c22
40
+
41
+ --f46d04446969123c9404cfa88c22
42
+ Content-Type: text/plain; charset=ISO-8859-1
43
+
44
+ line 1
45
+
46
+ [image: Inline image 1]
47
+
48
+ line 2
49
+
50
+ [image: Inline image 2]
51
+
52
+ line 3
53
+
54
+ --
55
+ sig
56
+
57
+ --f46d04446969123c9404cfa88c22
58
+ Content-Type: text/html; charset=ISO-8859-1
59
+
60
+ line 1<div><br></div><div><img src="cid:ii_13b4df668499b613" alt="Inline image 1"><br></div><div><br></div><div>line 2</div><div><br></div><div><img src="cid:ii_13b4df686fcdac8d" alt="Inline image 2"><br></div><div><br></div>
61
+ <div>line 3</div><div><br></div><div>--</div><div>sig</div>
62
+
63
+ --f46d04446969123c9404cfa88c22--
64
+ --f46d04446969123c9704cfa88c23
65
+ Content-Type: image/png; name="image.png"
66
+ Content-Transfer-Encoding: base64
67
+ Content-ID: <ii_13b4df686fcdac8d>
68
+ X-Attachment-Id: ii_13b4df686fcdac8d
69
+
70
+ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFkUlEQVRYw8VXW2xURRj+zjnbvfS2
71
+ banY1iJbBWql0gViBBMRYkkkMcQYIi/eHoz6QozERxPRPpoYNAaNT8TU2IQYIzxUSWiKNdw1LbZY
72
+ obXbgqWl9ML2svczzvxnzm13u+WBpJNMZ6Znzvm///uvqzDGsJrD4zx83/bem+lU+nhxwAdVVaEq
73
+ Cq0KX+3BoOt8MrHqyIiZMfcZPhk/63TWXSv75P0vO44UBMDFvGUIU0gogVAVAkJPhXguWFE5a/zD
74
+ /BKYooKpOofF32ECrE7v5s77YMACohjizJedLDBmMMBsPvj/BBBzcmwKHEJNAKxlRQB00eRCMXcS
75
+ hASjk8/YQrO1NO8yhdE3uGACxUfFigCEdvFEEgHuA9lsCFMQC5x5Ibi4vBJFJUGy8cK9aSzMTsM0
76
+ nwVeApMshFYGAIQdaKyFybXI50dd806s3RiGv9StUCoRw9AfZzF4sQvxpUUpmFlK8F1eAIozDNs/
77
+ fZfFFuOoqCiFxu2uaZpcVQTXPoLtL7/DQQQQi85iYrgfidgiebzm9aG+sQWlFdVYmLuL7o6vMTU+
78
+ Ss8YRYkRCVxW5aGjP8wVNAFZWJhPTN3w6LKqGmzd/za0Ih+u/34Kkd4ezMczXLAfmVQKqVQSV3t+
79
+ RdOOVmx+thU79r+BU9+05Xo2Y4Lh7sIAaOpEuS7CioPYsHMfdwIPrnX/jJt/nUPTnldQ27jNRb9g
80
+ pqv9C1TXP4aq2nWo37QFo3/3OkNcKJfjiKrzQOElw8ycXu5opQ/VIzpzB5G+HqwL78KahmYsLUQx
81
+ eO4XTHOqmaIhmUziztgNRK79Sfvy6lrTryzl4PSxfADEpWQyRaGWoWynQ/WXcopT3Mvvki2rGjbT
82
+ ubezHf9e6cLA2ZN0nrk9ZjgrZ0yc5/l9F4L7ScW6dHkRWgQto/CPpUkj8VGRdjVfCe2jU7fpXrDm
83
+ UTrPTt7ioaqhrjFM96duDptamwEl1ucLA5AZTmhPAc8jYG7yPxIQqKqFonkR6b+Euk1hhJ55EYmF
84
+ OdQ2PU0C0+k0nnrhADR/Ca50dmApOkMSbRD2vgAAnV4yVsVAzhIYuXoR9U3bsHH3AfSfOYHxoQG0
85
+ 7H0V/kQco/2XKSdUrW8iZzz/03FEJ0fsHGL8MUGECyciyYBggkwgw/DG+dMIBKtRVl2DJ1sPYuDM
86
+ j+j57jOkUwnLdKpWZKTqTEp+S5daw1rzpWNXIjr24WssGed0l/plEbJrQDyhI7R9D+qeaCnoVDO3
87
+ hnC95yQpI5g0VzKvsW84fOxEZFkGrFURdU6lQiIKiterYOTSaYz2XcDDG5qJDY/PJ/NAHLF7c5jl
88
+ kTA/MQKPBznaO3xApOTIsj7ApA9QIeFhqKhWOeXJRtAcw8TgBYxxpohmEcs8VXs8YmqWcENj3RbM
89
+ rP+H8vrA0UMHQ0KQ8AKRtxXqAXibwRwNhaxyGgcVKPbaIS61NBMZybOUMai3s+wyAJhAJvOleElo
90
+ L3zANIFZ3QyQ7mF/HFboWcKtveEH/BDMC8Ck3WkC0XQQCFnbqcEQJwXZVdsl2GlzyxklOA4ivAwA
91
+ ZmlqOCGoq2HM9oF82rtZQB6b6y6TZCcjT3YOUDXFdkLZDgkg1KwRCMBFgV1oXIJdbEgQssDtzgsg
92
+ k8kYsU8AYNnb2evZDDjMwPL5AnNlQaczIosB1cmA4SSSDRlGpvNQ389B6rqj1zf7ftczRwjq7tJu
93
+ Aml7/aVwDgPJRIoeLs7HINqyBzlELhE5AswkjFXkAIjOLdJa3bQFJSLWi7zwBSsf+E+x+fGxD2aH
94
+ /+nNWwsO79s10vDc3tCa0OMoLy+npjT7p5llggLTZSp5FnIm+y7jo6++VZYtRhzAEX9Z8OMAF56O
95
+ x93dnNPfGMtutezwks/y1f50bIk3scmtn3f+lp+B1RgqVnn8D2EhQytoYdIJAAAAAElFTkSuQmCC
96
+ --f46d04446969123c9704cfa88c23
97
+ Content-Type: image/png; name="image.png"
98
+ Content-Transfer-Encoding: base64
99
+ Content-ID: <ii_13b4df668499b613>
100
+ X-Attachment-Id: ii_13b4df668499b613
101
+
102
+ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACvlBMVEX////JSkjYXV3cY2PkbG3q
103
+ dHXteHnJSkjgaGjJSkjNUE7cY2PzgIL1goTJSkjWW1vhaGnja2zmb3DncHHqdHXxfX7JSkjJSkjK
104
+ TErbYWHuenvJSkjPUlHbYWH2g4X3hYfJSkjJSkjUWFjRVFPZX1/4hYf5h4nja2zuenvJSkjSVlbe
105
+ ZWXfZmbrdnfxfX7zf4HJSkjJS0nMTkzXXV3ZX1/mb3Drdnf7iozJSkjJS0nKTErKa2nLTUvLTkzL
106
+ VFLLnJvMTkzMT03MVlTMnZzMzMzNT03NUE7NtbXNzc3OUE/OUU/OWVfPUVDPUlDPUlHPcG7PoKDQ
107
+ UlLQU1LQU1PQW1rQ0NDRVFPRVFTRurnSVVXSVlbSc3LS0tLTV1fTXl7TpKTUWFjUWVnU1NTVWVnV
108
+ WlrVvr7WWlrWW1vXXFzXXV3XqanX19fYXV3YXl7YqajZXl7ZX1/ZwsLZ2dnaYGDaqqrbYWHbYmLb
109
+ rKvbra3b29vcYmLcY2Pcamrcra3dY2PdZGTdr6/eZWXeZmbebGzesbHexsbe3t7fZmbfZ2ffbW3g
110
+ aGjgbm7gyMjg4ODhaGnhsrLhs7PhtLTiaWriamvitbXitbbi4uLja2zjtLTjy8vj4+PkbG3ktrbk
111
+ 5OTlbW7lbm/li4vl5eXmb3DmuLjmubrm5ubncHHnubnn5+focXLocnPo6Ojpc3Tp6enqdHXqdXbq
112
+ vr7q6urrdXbrdnfrv7/r6+vsdnfsd3jswMDs7OzteHnteXrtwMHtwcLt7e3ueXruenvu19fu7u7v
113
+ e3zvwsLwfH3wfX7ww8Tw8PDxfX7xfn/xxMTyfoDyf4Dy29vy8vLzf4HzgIL0gIL0gYP0x8j03d31
114
+ gYP1goT1ycn139/19fX2g4X3hIb34OD39/f4hYf4hoj5h4n5iIr5+fn6iIr7ioz7+/v8/Pz9/f3+
115
+ /v5MqGeGAAAAOHRSTlMAEBAQMDAwQEBQUFBQUGBgYGBgYGBgcICAgICPj4+Pj5+vr7+/v7/Pz9/f
116
+ 39/f39/v7+/v7+/v7+7kt0cAAAJNSURBVDjLrZO/alRREMa/e8+5uzcxGI3R/FlBEzGKCBZ2YiOC
117
+ TQrBOp2Vj+ED6Cv4KJaKKDayooZgEAwmJDG5e/ecOTNzxmITTdROp5mB72OmmN8H/GsVR+aJqe7z
118
+ Ag92aaf5m2F++lmn9mVhJmHl69bvhurq07rbcXUBmHCih2tpJLhRm3p215VWWBZLIqJyr0/DIxtO
119
+ P6l9VdfeeQdARSVyfLQNAB4A6sdUADDf0RJAVoucbHFPDk64peuls0uXxreyiqkSQmKlm/3tA8Ps
120
+ isu4PledmNjImpS6kmISoZsvIlACZS9EPTlf+fLUUiQajhUx0VCI4/nRhpPLyGguj5eFdaotnfQh
121
+ psCZoy69Zjigd7FAxpfLHRPuiKtDpEhGSaN83IcD5mahRea1BcfSOt9GDiElIWb+tAMH3DHAoLTa
122
+ 8y2lJnI7GAoxE/PmBhywCFhhOfPqOaQmctvsMQspS5p7Aw+QGaA+S/raayITDVpDVpWsAnggWJba
123
+ q/O3ZprI1IayDNnE1JICHhiYVLlTudu9ELmlQE1iNc2W7BXgge/dLJZ5eTFEbr9URUMUNUNNhQAP
124
+ tMgW+P5Ck1L8vFqdKSgk4i5LzjuAB7YWYXLhWkwpfuwXbnhaEzUiWWx7OHqWnwB2F1wMH15nZRmU
125
+ 3Igl0bQ+GBn2pj3Qn/PvXioLM0VRZlHZXT8kauwGAMx8+8lYmQ3AWzpkUmwSQPuLdQOA/vAXtI1N
126
+ /pGY/v4x7Meu1Mfk+J5+C05xYfaIvLFpf0avOHtisgYQ97Ybw/+rH9Y+jS6juF2tAAAAAElFTkSu
127
+ QmCC
128
+ --f46d04446969123c9704cfa88c23--
129
+ ";
test/data/signature.var ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ s:2635:"Delivered-To: postie-test@devzing.com
2
+ Received: by 10.220.23.143 with SMTP id r15csp1132018vcb;
3
+ Thu, 29 Nov 2012 13:05:22 -0800 (PST)
4
+ Received: by 10.50.171.4 with SMTP id aq4mr27187358igc.68.1354223122465;
5
+ Thu, 29 Nov 2012 13:05:22 -0800 (PST)
6
+ Return-Path: <wayne@allens-home.com>
7
+ Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177])
8
+ by mx.google.com with ESMTPS id g8si2814683icx.82.2012.11.29.13.05.22
9
+ (version=TLSv1/SSLv3 cipher=OTHER);
10
+ Thu, 29 Nov 2012 13:05:22 -0800 (PST)
11
+ Received-SPF: neutral (google.com: 209.85.223.177 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) client-ip=209.85.223.177;
12
+ Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.223.177 is neither permitted nor denied by best guess record for domain of wayne@allens-home.com) smtp.mail=wayne@allens-home.com
13
+ Received: by mail-ie0-f177.google.com with SMTP id k13so14440466iea.22
14
+ for <postie-test@devzing.com>; Thu, 29 Nov 2012 13:05:22 -0800 (PST)
15
+ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
16
+ d=google.com; s=20120113;
17
+ h=mime-version:date:message-id:subject:from:to:content-type
18
+ :x-gm-message-state;
19
+ bh=EHTapfyJ5uPmNlFZWJKqOCdhrBBZ9rswcVv+mkG5c9c=;
20
+ b=W+b7qFC4WeiZ8DLHJD4zPQVwoEwwLahCNVUgLDKAXGRL3XatRBrjAX0PK3QaT9aHf/
21
+ H79Ln1aTic+0QbyDNliUp02eE9Y7Sq3i5Q0LFxLEUOSiK70adq1kNI8TgKwLdEeVCl59
22
+ n0IV8fivMotjFIbNvXbppjGRf3KnJdeQeiW45V6ZikzYLHfQch4ym5ysf8Xdpu4AzHOC
23
+ awNxQIVemYnsflFeZpKg6dD5G6knoUmze4L41lt20tKcrbPOzNCxkjt5tUj6WSytNMQZ
24
+ drSiQvXFaMA64x1fRGr0no3CfM6NH/NoEs4eF8F3Vbe+OQB1FSoSS2A3qyUOC59ioW6s
25
+ 78Zw==
26
+ MIME-Version: 1.0
27
+ Received: by 10.50.77.230 with SMTP id v6mr26798822igw.11.1354223122096; Thu,
28
+ 29 Nov 2012 13:05:22 -0800 (PST)
29
+ Received: by 10.231.82.14 with HTTP; Thu, 29 Nov 2012 13:05:22 -0800 (PST)
30
+ Date: Thu, 29 Nov 2012 13:05:22 -0800
31
+ Message-ID: <CACOA_7ZstC4Hd4VeS+WgQNr8iR7YVVEnO2pQB+h8gPioOEwiWQ@mail.gmail.com>
32
+ Subject: signature
33
+ From: Wayne Allen <wayne@allens-home.com>
34
+ To: postie-test@devzing.com
35
+ Content-Type: multipart/alternative; boundary=e89a8f3ba87f23a3d204cfa8a4cf
36
+ X-Gm-Message-State: ALoCoQmSau5nVHcRvH33cOOK/N5nchyWkmIxr2tQfVwxZwsqgLnXyLgw2PYtc8Url634ZMQSSo/q
37
+
38
+ --e89a8f3ba87f23a3d204cfa8a4cf
39
+ Content-Type: text/plain; charset=ISO-8859-1
40
+
41
+ test content
42
+
43
+ --
44
+ signature
45
+
46
+ --e89a8f3ba87f23a3d204cfa8a4cf
47
+ Content-Type: text/html; charset=ISO-8859-1
48
+
49
+ test content<div><br></div><div>--</div><div>signature</div>
50
+
51
+ --e89a8f3ba87f23a3d204cfa8a4cf--
52
+ ";
test/inlineimageTest.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require '../mimedecode.php';
4
+
5
+ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
6
+
7
+ function standardConfig() {
8
+ return array(
9
+ 'prefer_text_type' => 'plain',
10
+ 'allow_html_in_body' => false,
11
+ 'banned_files_list' => array(),
12
+ 'imagetemplate' => '<a href="{FILELINK}">{FILENAME}</a>',
13
+ 'drop_signature' => true,
14
+ 'message_encoding' => 'UTF-8',
15
+ 'message_dequote' => true,
16
+ 'allow_html_in_subject' => true,
17
+ 'message_start' => ':start',
18
+ 'message_end' => ':end',
19
+ 'sig_pattern_list' => array('--', '- --'),
20
+ 'custom_image_field' => false,
21
+ 'start_image_count_at_zero' => false,
22
+ 'images_append' => false,
23
+ 'filternewlines' => true,
24
+ 'convertnewline' => false,
25
+ 'auto_gallery' => false,
26
+ 'image_placeholder' => '#img%#'
27
+ );
28
+ }
29
+
30
+ function testInlineImage() {
31
+
32
+ $this->markTestIncomplete(
33
+ 'This test has not been implemented yet.'
34
+ );
35
+
36
+ $message = file_get_contents("data/inline.var");
37
+ $email = unserialize($message);
38
+ $decoded = DecodeMIMEMail($email);
39
+
40
+ $partcnt = count($decoded->parts);
41
+ $this->assertEquals(2, $partcnt);
42
+
43
+ FilterTextParts($decoded, "plain");
44
+
45
+ $attachments = array(
46
+ "html" => array(), //holds the html for each image
47
+ "cids" => array(), //holds the cids for HTML email
48
+ "image_files" => array() //holds the files for each image
49
+ );
50
+
51
+ $config = $this->standardConfig();
52
+ $content = GetContent($decoded, $attachments, 1, "wayne", $config);
53
+ }
54
+
55
+ function testMultipleImagesWithSig() {
56
+
57
+ $this->markTestIncomplete(
58
+ 'This test has not been implemented yet.'
59
+ );
60
+
61
+
62
+ $message = file_get_contents("data/multiple images with signature.var");
63
+ $email = unserialize($message);
64
+ $decoded = DecodeMIMEMail($email);
65
+
66
+ $partcnt = count($decoded->parts);
67
+ $this->assertEquals(3, $partcnt);
68
+
69
+ FilterTextParts($decoded, "plain");
70
+
71
+ $attachments = array(
72
+ "html" => array(), //holds the html for each image
73
+ "cids" => array(), //holds the cids for HTML email
74
+ "image_files" => array() //holds the files for each image
75
+ );
76
+
77
+ $config = $this->standardConfig();
78
+ $content = GetContent($decoded, $attachments, 1, "wayne", $config);
79
+ }
80
+
81
+ function testSig() {
82
+
83
+ $message = file_get_contents("data/signature.var");
84
+ $email = unserialize($message);
85
+ $decoded = DecodeMIMEMail($email);
86
+
87
+ $partcnt = count($decoded->parts);
88
+ $this->assertEquals(2, $partcnt);
89
+
90
+ FilterTextParts($decoded, "plain");
91
+
92
+ $attachments = array(
93
+ "html" => array(), //holds the html for each image
94
+ "cids" => array(), //holds the cids for HTML email
95
+ "image_files" => array() //holds the files for each image
96
+ );
97
+
98
+ $config = $this->standardConfig();
99
+ $filternewlines = $config['filternewlines'];
100
+ $convertnewline = $config['convertnewline'];
101
+
102
+ $content = GetContent($decoded, $attachments, 1, "wayne", $config);
103
+
104
+ $subject = GetSubject($decoded, $content, $config);
105
+ $this->assertEquals('signature', $subject);
106
+
107
+ $customImages = SpecialMessageParsing($content, $attachments, $config);
108
+ $this->assertEquals(null, $customImages);
109
+ $this->assertEquals("test content\n\n", $content);
110
+
111
+ $post_excerpt = GetPostExcerpt($content, $filternewlines, $convertnewline);
112
+
113
+ $postAuthorDetails = getPostAuthorDetails($subject, $content, $decoded);
114
+ }
115
+
116
+ function testQuotedPrintable() {
117
+ $str = quoted_printable_decode("ABC=C3=C4=CEABC=");
118
+ $str = iconv('ISO-8859-7', 'UTF-8', $str);
119
+ $this->assertEquals("ABCΓΔΞABC", $str);
120
+
121
+ $str = quoted_printable_decode('<span style=3D"font-family:arial,sans-serif;font-size:13px">ABC=C3=C4=CEABC=</span><br>');
122
+ $str = iconv('ISO-8859-7', 'UTF-8', $str);
123
+ $this->assertEquals('<span style="font-family:arial,sans-serif;font-size:13px">ABCΓΔΞABC=</span><br>', $str);
124
+ }
125
+
126
+ function testBase64() {
127
+ $str = base64_decode("QUJDw8TOQUJDCg==");
128
+ $str = iconv('ISO-8859-7', 'UTF-8', $str);
129
+ $this->assertEquals("ABCΓΔΞABC\n", $str);
130
+ }
131
+
132
+ function testHandleMessageEncoding() {
133
+ $e=HandleMessageEncoding('quoted-printable','iso-8859-7','<span style=3D"font-family:arial,sans-serif;font-size:13px">ABC=C3=C4=CEABC=</span><br>');
134
+ $this->assertEquals('<span style="font-family:arial,sans-serif;font-size:13px">ABCΓΔΞABC=</span><br>',$e);
135
+ }
136
+
137
+ function testGreek() {
138
+ $config = $this->standardConfig();
139
+ $message = file_get_contents("data/greek.var");
140
+ $email = unserialize($message);
141
+
142
+ $decoded = DecodeMIMEMail($email);
143
+ print_r($decoded);
144
+
145
+ FilterTextParts($decoded, 'html');
146
+ $attachments = array(
147
+ "html" => array(), //holds the html for each image
148
+ "cids" => array(), //holds the cids for HTML email
149
+ "image_files" => array() //holds the files for each image
150
+ );
151
+ $content = GetContent($decoded, $attachments, 1, 'wayne@devzing.com', $config);
152
+ print_r($content);
153
+ }
154
+
155
+ public function testReplaceImagePlaceHolders() {
156
+ $c = "";
157
+ $config = $this->standardConfig();
158
+ $attachements = array("image.jpg" => 'template with {CAPTION}');
159
+
160
+ ReplaceImagePlaceHolders($c, array(), $config);
161
+ $this->assertEquals("", $c);
162
+
163
+ ReplaceImagePlaceHolders($c, $attachements, $config);
164
+ $this->assertEquals("template with ", $c);
165
+
166
+ $c = "#img1#";
167
+ ReplaceImagePlaceHolders($c, $attachements, $config);
168
+ $this->assertEquals("template with ", $c);
169
+
170
+ $c = "test #img1# test";
171
+ ReplaceImagePlaceHolders($c, $attachements, $config);
172
+ $this->assertEquals("test template with test", $c);
173
+
174
+ $c = "test #img1 caption='1'# test";
175
+ ReplaceImagePlaceHolders($c, $attachements, $config);
176
+ $this->assertEquals("test template with 1 test", $c);
177
+
178
+ $c = "test #img1 caption=\"I'd like some cheese.\"# test";
179
+ ReplaceImagePlaceHolders($c, $attachements, $config);
180
+ $this->assertEquals("test template with I'd like some cheese. test", $c);
181
+
182
+ $c = "test #img1 caption='[image-caption]'# test";
183
+ ReplaceImagePlaceHolders($c, $attachements, $config);
184
+ $this->assertEquals("test template with [image-caption] test", $c);
185
+
186
+ $c = "test #img1 caption='1'# test #img2 caption='2'#";
187
+ ReplaceImagePlaceHolders($c, $attachements, $config);
188
+ $this->assertEquals("test template with 1 test #img2 caption='2'#", $c);
189
+
190
+ $attachements = array("image1.jpg" => 'template with {CAPTION}', "image2.jpg" => 'template with {CAPTION}');
191
+ $c = "test #img1 caption='1'# test #img2 caption='2'#";
192
+ ReplaceImagePlaceHolders($c, $attachements, $config);
193
+ $this->assertEquals("test template with 1 test template with 2", $c);
194
+
195
+ $config['auto_gallery'] = true;
196
+ $c = "test";
197
+ ReplaceImagePlaceHolders($c, $attachements, $config);
198
+ $this->assertEquals("[gallery]\ntest", $c);
199
+
200
+ $config['images_append'] = true;
201
+ $c = "test";
202
+ ReplaceImagePlaceHolders($c, $attachements, $config);
203
+ $this->assertEquals("test[gallery]", $c);
204
+
205
+ $c = "test";
206
+ ReplaceImagePlaceHolders($c, array(), $config);
207
+ $this->assertEquals("test", $c);
208
+ }
209
+
210
+ }
211
+
212
+ ?>
test/postie-functionsTest.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require 'wpstub.php';
4
+ require'../postie-functions.php';
5
+ require'../simple_html_dom.php';
6
+
7
+ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
8
+
9
+ public function testAllowCommentsOnPost() {
10
+ $original_content = "test content, no comment control";
11
+ $modified_content = "test content, no comment control";
12
+ $allow = AllowCommentsOnPost($modified_content);
13
+ $this->assertEquals("open", $allow);
14
+ $this->assertEquals($original_content, $modified_content);
15
+
16
+ $original_content = "test content, comment control closed ";
17
+ $modified_content = "test content, comment control closed comments:0";
18
+ $allow = AllowCommentsOnPost($modified_content);
19
+ $this->assertEquals("closed", $allow);
20
+ $this->assertEquals($original_content, $modified_content);
21
+
22
+ $original_content = "test content, comment control open ";
23
+ $modified_content = "test content, comment control open comments:1";
24
+ $allow = AllowCommentsOnPost($modified_content);
25
+ $this->assertEquals("open", $allow);
26
+ $this->assertEquals($original_content, $modified_content);
27
+
28
+ $original_content = "test content, comment control registered only ";
29
+ $modified_content = "test content, comment control registered only comments:2";
30
+ $allow = AllowCommentsOnPost($modified_content);
31
+ $this->assertEquals("registered_only", $allow);
32
+ $this->assertEquals($original_content, $modified_content);
33
+ }
34
+
35
+ public function testBannedFileName() {
36
+ $this->assertFalse(BannedFileName("", null));
37
+ $this->assertFalse(BannedFileName("", ""));
38
+ $this->assertFalse(BannedFileName("", array()));
39
+ $this->assertFalse(BannedFileName("test", array()));
40
+ $this->assertTrue(BannedFileName("test", array("test")));
41
+ $this->assertFalse(BannedFileName("test", array("test1")));
42
+ $this->assertTrue(BannedFileName("test.exe", array("*.exe")));
43
+ $this->assertFalse(BannedFileName("test.pdf", array("*.exe")));
44
+ $this->assertFalse(BannedFileName("test.pdf", array("*.exe", "*.js", "*.cmd")));
45
+ $this->assertFalse(BannedFileName("test.cmd.pdf", array("*.exe", "*.js", "*.cmd")));
46
+ $this->assertTrue(BannedFileName("test test.exe", array("*.exe")));
47
+ }
48
+
49
+ public function testCheckEmailAddress() {
50
+ $this->assertFalse(CheckEmailAddress(null, null));
51
+ $this->assertFalse(CheckEmailAddress(null, array()));
52
+ $this->assertFalse(CheckEmailAddress("", array()));
53
+ $this->assertFalse(CheckEmailAddress("", array("")));
54
+ $this->assertFalse(CheckEmailAddress("bob", array("jane")));
55
+ $this->assertTrue(CheckEmailAddress("bob", array("bob")));
56
+ $this->assertTrue(CheckEmailAddress("bob", array("BoB")));
57
+ $this->assertTrue(CheckEmailAddress("bob", array("bob", "jane")));
58
+ $this->assertTrue(CheckEmailAddress("bob", array("jane", "bob")));
59
+ }
60
+
61
+ public function testConvertUTF8ToISO_8859_1() {
62
+ $this->assertEquals("test", ConvertUTF8ToISO_8859_1("random", "stuff", "test"));
63
+ $this->assertEquals("Phasa Thai", ConvertUTF8ToISO_8859_1('quoted-printable', 'iso-8859-1', "Phasa Thai"));
64
+ $this->assertEquals("ภาษาไทย Phasa Thai", ConvertUTF8ToISO_8859_1('quoted-printable', 'tis-620', "=C0=D2=C9=D2=E4=B7=C2 Phasa Thai"));
65
+ $this->assertEquals("??????? Phasa Thai", ConvertUTF8ToISO_8859_1('base64', 'utf-8', "ภาษาไทย Phasa Thai"));
66
+ $this->assertEquals("ภาษาไทย Phasa Thai", ConvertUTF8ToISO_8859_1('something', 'utf-8', "ภาษาไทย Phasa Thai"));
67
+ $this->assertEquals("ภาษาไทย Phasa Thai", ConvertUTF8ToISO_8859_1('base64', 'iso-8859-1', "ภาษาไทย Phasa Thai"));
68
+ }
69
+
70
+ public function testConvertToUTF_8() {
71
+ $this->assertEquals("に投稿できる", ConvertToUTF_8('iso-2022-jp', iconv("UTF-8", "ISO-2022-JP", "に投稿できる")));
72
+ $this->assertEquals("Код Обмена Информацией, 8 бит", ConvertToUTF_8('koi8-r', iconv("UTF-8", "koi8-r", "Код Обмена Информацией, 8 бит")));
73
+ }
74
+
75
+ public function testDeterminePostDate() {
76
+ $content = "test";
77
+ $r = DeterminePostDate($content);
78
+ $this->assertTrue(is_array($r));
79
+ $this->assertEquals(3, count($r));
80
+ $this->assertEquals(0, $r[2]);
81
+ $this->assertEquals("test", $content);
82
+
83
+ $content = "test delay:";
84
+ $r = DeterminePostDate($content);
85
+ $this->assertEquals(0, $r[2]);
86
+ $this->assertEquals("test delay:", $content);
87
+
88
+ $content = "test delay:1h";
89
+ $r = DeterminePostDate($content);
90
+ $this->assertEquals(3600, $r[2]);
91
+ $this->assertEquals("test ", $content);
92
+
93
+ $content = "test delay:1d";
94
+ $r = DeterminePostDate($content);
95
+ $this->assertEquals(86400, $r[2]);
96
+ $this->assertEquals("test ", $content);
97
+
98
+ $content = "test delay:1m";
99
+ $r = DeterminePostDate($content);
100
+ $this->assertEquals(60, $r[2]);
101
+ $this->assertEquals("test ", $content);
102
+
103
+ $content = "test delay:m";
104
+ $r = DeterminePostDate($content);
105
+ $this->assertEquals(0, $r[2]);
106
+ $this->assertEquals("test ", $content);
107
+
108
+ $content = "test delay:dhm";
109
+ $r = DeterminePostDate($content);
110
+ $this->assertEquals(0, $r[2]);
111
+ $this->assertEquals("test ", $content);
112
+
113
+ $content = "test delay:x";
114
+ $r = DeterminePostDate($content);
115
+ $this->assertEquals(0, $r[2]);
116
+ $this->assertEquals("test delay:x", $content);
117
+
118
+ $content = "test delay:-1m";
119
+ $r = DeterminePostDate($content);
120
+ $this->assertEquals(-60, $r[2]);
121
+ $this->assertEquals("test ", $content);
122
+
123
+ $content = "test delay:1d1h1m";
124
+ $r = DeterminePostDate($content);
125
+ $this->assertEquals(90060, $r[2]);
126
+ $this->assertEquals("test ", $content);
127
+
128
+ $content = "test delay:d1hm";
129
+ $r = DeterminePostDate($content);
130
+ $this->assertEquals(3600, $r[2]);
131
+ $this->assertEquals("test ", $content);
132
+
133
+ $content = "test";
134
+ $r = DeterminePostDate($content, '2012-11-20 08:00', 1);
135
+ $this->assertEquals('2012-11-20 17:00:00', $r[0]);
136
+ $this->assertEquals(0, $r[2]);
137
+ $this->assertEquals("test", $content);
138
+ }
139
+
140
+ public function testEndFilter() {
141
+ $c = "test";
142
+ $this->assertEquals("test", EndFilter($c, "xxx"));
143
+
144
+ $c = "test xxx";
145
+ $this->assertEquals("test ", EndFilter($c, "xxx"));
146
+
147
+ $c = "test xxx test";
148
+ $this->assertEquals("test ", EndFilter($c, "xxx"));
149
+ }
150
+
151
+ public function testFilterNewLines() {
152
+ $c = "test";
153
+ $this->assertEquals("test", FilterNewLines($c));
154
+ $this->assertEquals("test", FilterNewLines($c, true));
155
+
156
+ $c = "test\n";
157
+ $this->assertEquals("test ", FilterNewLines($c));
158
+ $this->assertEquals("test<br />\n", FilterNewLines($c, true));
159
+
160
+ $c = "test\r\n";
161
+ $this->assertEquals("test ", FilterNewLines($c));
162
+ $this->assertEquals("test<br />\n", FilterNewLines($c, true));
163
+
164
+ $c = "test\r";
165
+ $this->assertEquals("test ", FilterNewLines($c));
166
+ $this->assertEquals("test<br />\n", FilterNewLines($c, true));
167
+
168
+ $c = "test\n\n";
169
+ $this->assertEquals("test ", FilterNewLines($c));
170
+ $this->assertEquals("test<br />\n", FilterNewLines($c, true));
171
+
172
+ $c = "test\r\n\r\n";
173
+ $this->assertEquals("test ", FilterNewLines($c));
174
+ $this->assertEquals("test<br />\n", FilterNewLines($c, true));
175
+
176
+ $c = "test\r\n\r\ntest\n\ntest\rtest\r\ntest\ntest";
177
+ $this->assertEquals("test test test test test test", FilterNewLines($c));
178
+ $this->assertEquals("test<br />\ntest<br />\ntest<br />\ntest<br />\ntest<br />\ntest", FilterNewLines($c, true));
179
+ }
180
+
181
+ public function testGetNameFromEmail() {
182
+ $this->assertEquals("", GetNameFromEmail(""));
183
+ $this->assertEquals("Wayne", GetNameFromEmail('Wayne <wayne@devzing.com>'));
184
+ $this->assertEquals("wayne", GetNameFromEmail('wayne@devzing.com'));
185
+ }
186
+
187
+ public function testGetPostType() {
188
+ $subject = "test";
189
+ $this->assertEquals("post", GetPostType($subject));
190
+ $this->assertEquals("test", $subject);
191
+
192
+ $subject = "custom//test";
193
+ $this->assertEquals("custom", GetPostType($subject));
194
+ $this->assertEquals("test", $subject);
195
+
196
+ $subject = "//test";
197
+ $this->assertEquals("post", GetPostType($subject));
198
+ $this->assertEquals("test", $subject);
199
+
200
+ $subject = "//";
201
+ $this->assertEquals("post", GetPostType($subject));
202
+ $this->assertEquals("", $subject);
203
+ }
204
+
205
+ public function testGetPostExcerpt() {
206
+ $c = "test";
207
+ $this->assertEquals("", GetPostExcerpt($c, false, false));
208
+
209
+ $c = ":excerptstart test :excerptend test";
210
+ $this->assertEquals("test ", GetPostExcerpt($c, false, false));
211
+
212
+ $c = ":excerptstart test";
213
+ $this->assertEquals("", GetPostExcerpt($c, false, false));
214
+
215
+ $c = "test :excerptend test";
216
+ $this->assertEquals("", GetPostExcerpt($c, false, false));
217
+ }
218
+
219
+ public function testGetPostCategories() {
220
+ global $wpdb;
221
+
222
+ $s = "test";
223
+ $c = GetPostCategories($s, "default");
224
+ $this->assertEquals("default", $c[0]);
225
+ $this->assertEquals("test", $s);
226
+
227
+ $wpdb->t_get_var = "1";
228
+ $s = "1: test";
229
+ $c = GetPostCategories($s, "default");
230
+ $this->assertEquals("1", $c[0]);
231
+ $this->assertEquals("test", $s);
232
+
233
+ $wpdb->t_get_var = "general";
234
+ $s = "general: test";
235
+ $c = GetPostCategories($s, "default");
236
+ $this->assertEquals("general", $c[0]);
237
+ $this->assertEquals("test", $s);
238
+
239
+ $s = "[general] test";
240
+ $c = GetPostCategories($s, "default");
241
+ $this->assertEquals("general", $c[0]);
242
+ $this->assertEquals("test", $s);
243
+
244
+ $s = "-general- test";
245
+ $c = GetPostCategories($s, "default");
246
+ $this->assertEquals("general", $c[0]);
247
+ $this->assertEquals("test", $s);
248
+
249
+ $wpdb->t_get_var = "";
250
+ $s = "specific: test";
251
+ $c = GetPostCategories($s, "default");
252
+ $this->assertEquals("default", $c[0]);
253
+ $this->assertEquals("test", $s);
254
+
255
+ $wpdb->t_get_var = "1";
256
+ $s = "[1] [1] test";
257
+ $c = GetPostCategories($s, "default");
258
+ $this->assertEquals(2, count($c));
259
+ $this->assertEquals("1", $c[0]);
260
+ $this->assertEquals("1", $c[1]);
261
+ $this->assertEquals("test", $s);
262
+ }
263
+
264
+ public function testHTML2HTML() {
265
+ $this->assertEquals("", HTML2HTML(""));
266
+ $this->assertEquals("test", HTML2HTML("test"));
267
+ $this->assertEquals("<body>test</body>", HTML2HTML("<html lang='en'><body>test</body></html>"));
268
+ $this->assertEquals("<body>test</body>", HTML2HTML("<html lang='en'><head><title>title</title></head><body>test</body></html>"));
269
+ $this->assertEquals("<body>test</body>", HTML2HTML("<body>test</body>"));
270
+ $this->assertEquals("<strong>test</strong>", HTML2HTML("<strong>test</strong>"));
271
+ }
272
+
273
+ public function testSafeFileName() {
274
+ $this->assertEquals("testtest", SafeFileName('test\/:*?"<>|test'));
275
+ }
276
+
277
+ public function testremove_signature() {
278
+ $this->assertEquals("", remove_signature("", array()));
279
+ $this->assertEquals("test", remove_signature("test", array()));
280
+ $this->assertEquals("\n", remove_signature("", array("--", "- --")));
281
+ $this->assertEquals("test\n", remove_signature("test", array("--", "- --")));
282
+ $this->assertEquals("line 1\nline 2\n", remove_signature("line 1\nline 2\n--\nsig line 1\nsig line 2", array("--", "- --")));
283
+ $this->assertEquals("line 1\nline 2\n", remove_signature("line 1\nline 2\n- --\nsig line 1\nsig line 2", array("--", "- --")));
284
+ $this->assertEquals("line 1\nline 2\n", remove_signature("line 1\nline 2\n-- \nsig line 1\nsig line 2", array("--", "- --")));
285
+ $this->assertEquals("line 1\nline 2\n", remove_signature("line 1\nline 2\n --\nsig line 1\nsig line 2", array("--", "- --")));
286
+ $this->assertEquals("line 1\nline 2\n", remove_signature("line 1\nline 2\n--", array("--", "- --")));
287
+ }
288
+
289
+
290
+ }
291
+
292
+ ?>
test/wpstub.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ define('ABSPATH', dirname(__FILE__) . '/');
4
+
5
+ class wpdb {
6
+
7
+ public $t_get_var = "";
8
+ public $terms = 'wp_terms';
9
+
10
+ public function get_var($query, $column_offset = 0, $row_offset = 0) {
11
+ return $this->t_get_var;
12
+ }
13
+
14
+ }
15
+
16
+ class WP_Error {
17
+
18
+ }
19
+
20
+ $wpdb = new wpdb();
21
+
22
+ function get_option($option, $default = false) {
23
+ return 'open';
24
+ }
25
+
26
+ function get_post_types() {
27
+ return array("post", "page", "custom");
28
+ }
29
+
30
+ function current_time() {
31
+ return '2005-08-05 10:41:13';
32
+ }
33
+
34
+ function get_post() {
35
+ $r = new stdClass();
36
+ $r->post_date = '';
37
+ $r->post_parent = 0;
38
+ $r->guid = '7b0d965d-b8b0-4654-ac9e-eeef1d8cf571';
39
+ $r->post_title = '';
40
+ return $r;
41
+ }
42
+
43
+ function __($t) {
44
+ return $t;
45
+ }
46
+
47
+ function wp_check_filetype() {
48
+ return array('ext' => 'xxx', 'type' => 'xxx/xxx');
49
+ }
50
+
51
+ function wp_upload_dir() {
52
+ return array(
53
+ 'path' => '/tmp',
54
+ 'url' => 'http://example.com/upload/',
55
+ 'subdir' => '/tmp/',
56
+ 'basedir' => '/tmp;',
57
+ 'baseurl' => 'http://example.com/',
58
+ 'error' => false
59
+ );
60
+ }
61
+
62
+ function wp_unique_filename() {
63
+ return '/tmp/file.txt';
64
+ }
65
+
66
+ function wp_get_attachment_url() {
67
+ return 'http://example.net/wp-content/uploads/filename';
68
+ }
69
+
70
+ function image_downsize() {
71
+ return array('http://example.net/wp-content/uploads/filename.jpg', 10, 10, true);
72
+ }
73
+
74
+ function image_hwstring() {
75
+ return 'width="10" height="10" ';
76
+ }
77
+
78
+ function get_attachment_link() {
79
+ return 'http://example.net/wp-content/uploads/filename.jpg';
80
+ }
81
+
82
+ function get_user_by(){
83
+ return false;
84
+ }
85
+ ?>
updateVersion DELETED
@@ -1,24 +0,0 @@
1
- #!/bin/bash
2
- # this script updates the version number in all relevant files in the directory
3
- if [ $# -ne 1 ]
4
- then
5
- #echo 'usage: ./updateVersion versionNum'
6
- echo 'updating revision but not versionNUm'
7
- #exit 1
8
- else
9
- VER=$1
10
- for file in *.{php,js,txt,css}; do
11
- perl -pe "s/(version|stable tag): [0-9a-zA-Z\.]+( |$)/\$1: $VER/gi" < $file > ${file}TEMP
12
- done
13
- for file in *TEMP; do
14
- mv -f $file `echo $file|perl -pe 's/TEMP//'`
15
- done
16
- fi
17
-
18
-
19
- # update Revision file
20
- svn up
21
- svn info | grep -E '(Date|Revision)' > Revision
22
- # convert readme.txt to readme.html using wordpress's online converter
23
- wget --post-data='url=1&readme_url=robfelty.com/wptesting/wp-content/plugins/postie/readme.txt' http://wordpress.org/extend/plugins/about/validator/ -O - |./stripParts.pl > readme.html
24
- #svn commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
updateVersion.cmd DELETED
@@ -1,21 +0,0 @@
1
- rem this script updates the version number in all relevant files in the directory
2
- if [ $# -ne 1 ]
3
- echo updating revision but not versionNum
4
- GOTO REVISION
5
- else
6
- VER=$1
7
- for file in *.{php,js,txt,css}; do
8
- perl -pe "s/(version|stable tag): [0-9a-zA-Z\.]+( |$)/\$1: $VER/gi" < $file > ${file}TEMP
9
- done
10
- for file in *TEMP; do
11
- mv -f $file `echo $file|perl -pe 's/TEMP//'`
12
- done
13
- fi
14
-
15
- :REVISION
16
- # update Revision file
17
- svn up
18
- svn info | grep -E '(Date|Revision)' > Revision
19
- # convert readme.txt to readme.html using wordpress's online converter
20
- wget --post-data='url=1&readme_url=robfelty.com/wptesting/wp-content/plugins/postie/readme.txt' http://wordpress.org/extend/plugins/about/validator/ -O - |./stripParts.pl > readme.html
21
- #svn commit