Version Description
(2013.02.22) = * Consolidated logic for load configuration settings. Fixes bug where new settings were not having their defaults set properly. * Fixed bug where attachment file name was not being correctly detected.
Download this release
Release Info
Developer | WayneAllen |
Plugin | Postie |
Version | 1.4.35 |
Comparing to | |
See all releases |
Code changes from version 1.4.34 to 1.4.35
- Revision +2 -0
- config_form.php +2 -2
- docs/Changes.txt +4 -0
- docs/Postie.txt +1 -1
- get_mail.php +1 -1
- postie-functions.php +35 -40
- postie.php +7 -5
- postie_test.php +1 -1
- readme.html +2 -1
- readme.txt +5 -1
- test/postie-functionsTest.php +5 -4
- test/wpstub.php +2 -1
Revision
CHANGED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
Revision: 671918
|
2 |
+
Last Changed Date: 2013-02-13 13:10:59 -0800 (Wed, 13 Feb 2013)
|
config_form.php
CHANGED
@@ -47,7 +47,7 @@
|
|
47 |
|
48 |
$title = __('Postie Options', 'postie');
|
49 |
$parent_file = 'options-general.php';
|
50 |
-
$config =
|
51 |
if (empty($config))
|
52 |
$config = config_ResetToDefault();
|
53 |
|
@@ -318,7 +318,7 @@
|
|
318 |
wp_dropdown_categories($args);
|
319 |
?>
|
320 |
</tr>
|
321 |
-
<?php echo BuildBooleanSelect("Match short category", "postie-settings[category_match]", $category_match,"Try to match categories using 'starts with logic' otherwise only do exact matches"); ?>
|
322 |
|
323 |
<tr valign="top">
|
324 |
<th scope="row">
|
47 |
|
48 |
$title = __('Postie Options', 'postie');
|
49 |
$parent_file = 'options-general.php';
|
50 |
+
$config = config_Read();
|
51 |
if (empty($config))
|
52 |
$config = config_ResetToDefault();
|
53 |
|
318 |
wp_dropdown_categories($args);
|
319 |
?>
|
320 |
</tr>
|
321 |
+
<?php echo BuildBooleanSelect("Match short category", "postie-settings[category_match]", $category_match, "Try to match categories using 'starts with logic' otherwise only do exact matches"); ?>
|
322 |
|
323 |
<tr valign="top">
|
324 |
<th scope="row">
|
docs/Changes.txt
CHANGED
@@ -10,6 +10,10 @@ All script, style and body tags are stripped from html emails.
|
|
10 |
Attachments are now processed in the order they were attached.
|
11 |
|
12 |
== CHANGELOG ==
|
|
|
|
|
|
|
|
|
13 |
= 1.4.34 (2013.02.07) =
|
14 |
* Fixed bug in new category logic
|
15 |
|
10 |
Attachments are now processed in the order they were attached.
|
11 |
|
12 |
== CHANGELOG ==
|
13 |
+
= 1.4.35 (2013.02.22) =
|
14 |
+
* Consolidated logic for load configuration settings. Fixes bug where new settings were not having their defaults set properly.
|
15 |
+
* Fixed bug where attachment file name was not being correctly detected.
|
16 |
+
|
17 |
= 1.4.34 (2013.02.07) =
|
18 |
* Fixed bug in new category logic
|
19 |
|
docs/Postie.txt
CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
|
|
6 |
Tags: e-mail, email
|
7 |
Requires at least: 3.0
|
8 |
Tested up to: 3.5.1
|
9 |
-
Stable tag: 1.4.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
6 |
Tags: e-mail, email
|
7 |
Requires at least: 3.0
|
8 |
Tested up to: 3.5.1
|
9 |
+
Stable tag: 1.4.35
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
get_mail.php
CHANGED
@@ -24,7 +24,7 @@ if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
|
|
24 |
}
|
25 |
|
26 |
$test_email = null;
|
27 |
-
$config =
|
28 |
extract($config);
|
29 |
if (!isset($maxemails))
|
30 |
$maxemails = 0;
|
24 |
}
|
25 |
|
26 |
$test_email = null;
|
27 |
+
$config = config_Read();
|
28 |
extract($config);
|
29 |
if (!isset($maxemails))
|
30 |
$maxemails = 0;
|
postie-functions.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
$Id: postie-functions.php
|
5 |
*/
|
6 |
|
7 |
//to turn on debug output add the following line to wp-config.php
|
@@ -1514,16 +1514,19 @@ function postie_media_handle_upload($part, $post_id, $poster, $post_data = array
|
|
1514 |
}
|
1515 |
|
1516 |
$name = 'postie-media.' . $part->ctype_secondary;
|
1517 |
-
if (property_exists($part, 'ctype_parameters')) {
|
1518 |
-
if (
|
1519 |
-
if ($part->d_parameters['filename'] != '') {
|
1520 |
-
$name = $part->d_parameters['filename'];
|
1521 |
-
}
|
1522 |
-
} else {
|
1523 |
$name = $part->ctype_parameters['name'];
|
1524 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1525 |
}
|
1526 |
DebugEcho("name: $name, size: " . filesize($tmpFile));
|
|
|
1527 |
|
1528 |
$the_file = array('name' => $name,
|
1529 |
'tmp_name' => $tmpFile,
|
@@ -2395,7 +2398,7 @@ function config_ResetToDefault() {
|
|
2395 |
*/
|
2396 |
function config_Update($data) {
|
2397 |
UpdatePostiePermissions($data["role_access"]);
|
2398 |
-
// We also update the cron settings
|
2399 |
if ($data['interval'] != '') {
|
2400 |
postie_decron();
|
2401 |
if ($data['interval'] != 'manual') {
|
@@ -2489,6 +2492,11 @@ function config_GetListOfArrayConfig() {
|
|
2489 |
'VIDEO2TYPES', 'AUDIOTYPES', 'SMTP'));
|
2490 |
}
|
2491 |
|
|
|
|
|
|
|
|
|
|
|
2492 |
/**
|
2493 |
* This function retrieves the old-format config (pre 1.4) from the database
|
2494 |
* @return array
|
@@ -2682,21 +2690,6 @@ function config_GetOld() {
|
|
2682 |
* =======================================================
|
2683 |
*/
|
2684 |
|
2685 |
-
/**
|
2686 |
-
* This function returns the current config
|
2687 |
-
* @return array
|
2688 |
-
*/
|
2689 |
-
function get_postie_config() {
|
2690 |
-
$config = get_option('postie-settings');
|
2691 |
-
if (file_exists(POSTIE_ROOT . '/postie_test_variables.php')) {
|
2692 |
-
include(POSTIE_ROOT . '/postie_test_variables.php');
|
2693 |
-
}
|
2694 |
-
// These are computed
|
2695 |
-
$config["time_offset"] = get_option('gmt_offset');
|
2696 |
-
$config["postie_root"] = POSTIE_ROOT;
|
2697 |
-
return $config;
|
2698 |
-
}
|
2699 |
-
|
2700 |
/**
|
2701 |
* Returns a list of config keys that should be arrays
|
2702 |
* @return array
|
@@ -2774,7 +2767,7 @@ function isMarkdownInstalled() {
|
|
2774 |
* and ensures that arrayed items are stored as such
|
2775 |
*/
|
2776 |
function config_ValidateSettings($in) {
|
2777 |
-
//DebugDump($in);
|
2778 |
$out = array();
|
2779 |
|
2780 |
// use the default as a template:
|
@@ -2822,22 +2815,24 @@ function postie_admin_settings() {
|
|
2822 |
*/
|
2823 |
function UpdatePostiePermissions($role_access) {
|
2824 |
global $wp_roles;
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
$role_access
|
2831 |
-
|
2832 |
-
|
2833 |
-
|
2834 |
-
|
2835 |
-
if (
|
2836 |
-
$
|
2837 |
-
|
2838 |
-
|
2839 |
-
|
2840 |
-
|
|
|
|
|
2841 |
}
|
2842 |
}
|
2843 |
}
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
$Id: postie-functions.php 671973 2013-02-22 23:06:45Z WayneAllen $
|
5 |
*/
|
6 |
|
7 |
//to turn on debug output add the following line to wp-config.php
|
1514 |
}
|
1515 |
|
1516 |
$name = 'postie-media.' . $part->ctype_secondary;
|
1517 |
+
if (property_exists($part, 'ctype_parameters') && is_array($part->ctype_parameters)) {
|
1518 |
+
if (array_key_exists('name', $part->ctype_parameters) && $part->ctype_parameters['name'] != '') {
|
|
|
|
|
|
|
|
|
1519 |
$name = $part->ctype_parameters['name'];
|
1520 |
}
|
1521 |
+
if (array_key_exists('filename', $part->ctype_parameters) && $part->ctype_parameters['filename'] != '') {
|
1522 |
+
$name = $part->ctype_parameters['filename'];
|
1523 |
+
}
|
1524 |
+
}
|
1525 |
+
if (property_exists($part, 'd_parameters') && is_array($part->d_parameters) && array_key_exists('filename', $part->d_parameters) && $part->d_parameters['filename'] != '') {
|
1526 |
+
$name = $part->d_parameters['filename'];
|
1527 |
}
|
1528 |
DebugEcho("name: $name, size: " . filesize($tmpFile));
|
1529 |
+
//DebugDump($part);
|
1530 |
|
1531 |
$the_file = array('name' => $name,
|
1532 |
'tmp_name' => $tmpFile,
|
2398 |
*/
|
2399 |
function config_Update($data) {
|
2400 |
UpdatePostiePermissions($data["role_access"]);
|
2401 |
+
// We also update the cron settings
|
2402 |
if ($data['interval'] != '') {
|
2403 |
postie_decron();
|
2404 |
if ($data['interval'] != 'manual') {
|
2492 |
'VIDEO2TYPES', 'AUDIOTYPES', 'SMTP'));
|
2493 |
}
|
2494 |
|
2495 |
+
function config_Read() {
|
2496 |
+
$config = get_option('postie-settings');
|
2497 |
+
return config_ValidateSettings($config);
|
2498 |
+
}
|
2499 |
+
|
2500 |
/**
|
2501 |
* This function retrieves the old-format config (pre 1.4) from the database
|
2502 |
* @return array
|
2690 |
* =======================================================
|
2691 |
*/
|
2692 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2693 |
/**
|
2694 |
* Returns a list of config keys that should be arrays
|
2695 |
* @return array
|
2767 |
* and ensures that arrayed items are stored as such
|
2768 |
*/
|
2769 |
function config_ValidateSettings($in) {
|
2770 |
+
//DebugDump($in);
|
2771 |
$out = array();
|
2772 |
|
2773 |
// use the default as a template:
|
2815 |
*/
|
2816 |
function UpdatePostiePermissions($role_access) {
|
2817 |
global $wp_roles;
|
2818 |
+
if (is_object($wp_roles)) {
|
2819 |
+
$admin = $wp_roles->get_role("administrator");
|
2820 |
+
$admin->add_cap("config_postie");
|
2821 |
+
$admin->add_cap("post_via_postie");
|
2822 |
+
|
2823 |
+
if (!is_array($role_access)) {
|
2824 |
+
$role_access = array();
|
2825 |
+
}
|
2826 |
+
foreach ($wp_roles->role_names as $roleId => $name) {
|
2827 |
+
$role = $wp_roles->get_role($roleId);
|
2828 |
+
if ($roleId != "administrator") {
|
2829 |
+
if (array_key_exists($roleId, $role_access)) {
|
2830 |
+
$role->add_cap("post_via_postie");
|
2831 |
+
//DebugEcho("added $roleId");
|
2832 |
+
} else {
|
2833 |
+
$role->remove_cap("post_via_postie");
|
2834 |
+
//DebugEcho("removed $roleId");
|
2835 |
+
}
|
2836 |
}
|
2837 |
}
|
2838 |
}
|
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.
|
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
|
31 |
*/
|
32 |
|
33 |
define("POSTIE_ROOT", dirname(__FILE__));
|
@@ -82,7 +82,7 @@ if (is_admin()) {
|
|
82 |
|
83 |
function activate_postie() {
|
84 |
static $init = false;
|
85 |
-
$options =
|
86 |
|
87 |
if ($init) {
|
88 |
return;
|
@@ -117,7 +117,7 @@ register_activation_hook(__FILE__, 'activate_postie');
|
|
117 |
*/
|
118 |
function postie_warnings() {
|
119 |
|
120 |
-
$config =
|
121 |
|
122 |
if ((empty($config['mail_server']) ||
|
123 |
empty($config['mail_server_port']) ||
|
@@ -200,7 +200,7 @@ function check_postie() {
|
|
200 |
|
201 |
function postie_cron($interval = false) {
|
202 |
if (!$interval) {
|
203 |
-
$config =
|
204 |
$interval = $config['interval'];
|
205 |
}
|
206 |
if (!$interval || $interval == '')
|
@@ -211,6 +211,8 @@ function postie_cron($interval = false) {
|
|
211 |
DebugEcho("Setting $interval cron schedule");
|
212 |
if (false === wp_schedule_event(time(), $interval, 'check_postie_hook')) {
|
213 |
EchoInfo("Failed to set up cron task.");
|
|
|
|
|
214 |
}
|
215 |
}
|
216 |
}
|
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.35
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://allens-home.com/
|
10 |
License: GPL2
|
27 |
*/
|
28 |
|
29 |
/*
|
30 |
+
$Id: postie.php 671973 2013-02-22 23:06:45Z WayneAllen $
|
31 |
*/
|
32 |
|
33 |
define("POSTIE_ROOT", dirname(__FILE__));
|
82 |
|
83 |
function activate_postie() {
|
84 |
static $init = false;
|
85 |
+
$options = config_Read();
|
86 |
|
87 |
if ($init) {
|
88 |
return;
|
117 |
*/
|
118 |
function postie_warnings() {
|
119 |
|
120 |
+
$config = config_Read();
|
121 |
|
122 |
if ((empty($config['mail_server']) ||
|
123 |
empty($config['mail_server_port']) ||
|
200 |
|
201 |
function postie_cron($interval = false) {
|
202 |
if (!$interval) {
|
203 |
+
$config = config_Read();
|
204 |
$interval = $config['interval'];
|
205 |
}
|
206 |
if (!$interval || $interval == '')
|
211 |
DebugEcho("Setting $interval cron schedule");
|
212 |
if (false === wp_schedule_event(time(), $interval, 'check_postie_hook')) {
|
213 |
EchoInfo("Failed to set up cron task.");
|
214 |
+
} else {
|
215 |
+
EchoInfo("Succeeded in setting up cron task.");
|
216 |
}
|
217 |
}
|
218 |
}
|
postie_test.php
CHANGED
@@ -4,7 +4,7 @@ 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 =
|
8 |
extract($config);
|
9 |
$title = __("Postie Diagnosis");
|
10 |
$parent_file = 'options-general.php?page=postie/postie.php';
|
4 |
include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php");
|
5 |
require_once("postie-functions.php");
|
6 |
|
7 |
+
$config = config_Read();
|
8 |
extract($config);
|
9 |
$title = __("Postie Diagnosis");
|
10 |
$parent_file = 'options-general.php?page=postie/postie.php';
|
readme.html
CHANGED
@@ -158,7 +158,8 @@ the first category that the system finds that matches - so if you put</p>
|
|
158 |
|
159 |
<p>Gen: New News</p>
|
160 |
|
161 |
-
<p>The system will post that in General
|
|
|
162 |
<li><p>All of the above also applies if you put the category in brackets []</p></li>
|
163 |
<li><p>Using [] or you can post to multiple categories at once</p>
|
164 |
|
158 |
|
159 |
<p>Gen: New News</p>
|
160 |
|
161 |
+
<p>The system will post that in General. Note you must turn on the "Match short category"
|
162 |
+
setting for this to work.</p></li>
|
163 |
<li><p>All of the above also applies if you put the category in brackets []</p></li>
|
164 |
<li><p>Using [] or you can post to multiple categories at once</p>
|
165 |
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
|
|
6 |
Tags: e-mail, email
|
7 |
Requires at least: 3.0
|
8 |
Tested up to: 3.5.1
|
9 |
-
Stable tag: 1.4.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -427,6 +427,10 @@ All script, style and body tags are stripped from html emails.
|
|
427 |
Attachments are now processed in the order they were attached.
|
428 |
|
429 |
== CHANGELOG ==
|
|
|
|
|
|
|
|
|
430 |
= 1.4.34 (2013.02.07) =
|
431 |
* Fixed bug in new category logic
|
432 |
|
6 |
Tags: e-mail, email
|
7 |
Requires at least: 3.0
|
8 |
Tested up to: 3.5.1
|
9 |
+
Stable tag: 1.4.35
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
427 |
Attachments are now processed in the order they were attached.
|
428 |
|
429 |
== CHANGELOG ==
|
430 |
+
= 1.4.35 (2013.02.22) =
|
431 |
+
* Consolidated logic for load configuration settings. Fixes bug where new settings were not having their defaults set properly.
|
432 |
+
* Fixed bug where attachment file name was not being correctly detected.
|
433 |
+
|
434 |
= 1.4.34 (2013.02.07) =
|
435 |
* Fixed bug in new category logic
|
436 |
|
test/postie-functionsTest.php
CHANGED
@@ -291,7 +291,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
|
|
291 |
$this->assertEquals("default", $c[0]);
|
292 |
$this->assertEquals(":test", $s);
|
293 |
|
294 |
-
$g_get_term_by =
|
295 |
$s = "1: test";
|
296 |
$c = tag_categories($s, "default", false);
|
297 |
$this->assertEquals("1", $c[0]);
|
@@ -313,7 +313,8 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
|
|
313 |
$this->assertEquals("default", $c[0]);
|
314 |
$this->assertEquals("-not a category- test", $s);
|
315 |
|
316 |
-
$g_get_term_by =
|
|
|
317 |
$s = "general: test";
|
318 |
$c = tag_categories($s, "default", false);
|
319 |
$this->assertEquals(1, $c[0]);
|
@@ -335,14 +336,14 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
|
|
335 |
$this->assertEquals("default", $c[0]);
|
336 |
$this->assertEquals("specific: test", $s);
|
337 |
|
338 |
-
$g_get_term_by =
|
|
|
339 |
$s = "[1] [1] test";
|
340 |
$c = tag_categories($s, "default", false);
|
341 |
$this->assertEquals(2, count($c));
|
342 |
$this->assertEquals("1", $c[0]);
|
343 |
$this->assertEquals("1", $c[1]);
|
344 |
$this->assertEquals("test", $s);
|
345 |
-
|
346 |
}
|
347 |
|
348 |
public function testHTML2HTML() {
|
291 |
$this->assertEquals("default", $c[0]);
|
292 |
$this->assertEquals(":test", $s);
|
293 |
|
294 |
+
$g_get_term_by->term_id = 1;
|
295 |
$s = "1: test";
|
296 |
$c = tag_categories($s, "default", false);
|
297 |
$this->assertEquals("1", $c[0]);
|
313 |
$this->assertEquals("default", $c[0]);
|
314 |
$this->assertEquals("-not a category- test", $s);
|
315 |
|
316 |
+
$g_get_term_by = new stdClass();
|
317 |
+
$g_get_term_by->term_id = 1;
|
318 |
$s = "general: test";
|
319 |
$c = tag_categories($s, "default", false);
|
320 |
$this->assertEquals(1, $c[0]);
|
336 |
$this->assertEquals("default", $c[0]);
|
337 |
$this->assertEquals("specific: test", $s);
|
338 |
|
339 |
+
$g_get_term_by = new stdClass();
|
340 |
+
$g_get_term_by->term_id = 1;
|
341 |
$s = "[1] [1] test";
|
342 |
$c = tag_categories($s, "default", false);
|
343 |
$this->assertEquals(2, count($c));
|
344 |
$this->assertEquals("1", $c[0]);
|
345 |
$this->assertEquals("1", $c[1]);
|
346 |
$this->assertEquals("test", $s);
|
|
|
347 |
}
|
348 |
|
349 |
public function testHTML2HTML() {
|
test/wpstub.php
CHANGED
@@ -149,7 +149,8 @@ function sanitize_term($s) {
|
|
149 |
return trim($s);
|
150 |
}
|
151 |
|
152 |
-
$g_get_term_by =
|
|
|
153 |
|
154 |
function get_term_by() {
|
155 |
global $g_get_term_by;
|
149 |
return trim($s);
|
150 |
}
|
151 |
|
152 |
+
$g_get_term_by = new stdClass();
|
153 |
+
$g_get_term_by->term_id = 1;
|
154 |
|
155 |
function get_term_by() {
|
156 |
global $g_get_term_by;
|