Newsletter - Version 3.3.9

Version Description

  • Fixed activation in debug mode
  • Fixed some notices
  • Added defaults for subscriber titles (Mr, Mrs, ...)
Download this release

Release Info

Developer satollo
Plugin Icon 128x128 Newsletter
Version 3.3.9
Comparing to
See all releases

Code changes from version 3.3.7 to 3.3.9

header.php CHANGED
@@ -29,7 +29,7 @@ if (isset($_REQUEST['dismiss']) && check_admin_referer()) {
29
  </div>
30
  <?php } ?>
31
 
32
- <?php if ($dismissed['rate'] != 1) { ?>
33
  <div class="newsletter-notice">
34
  I never asked before and I'm curious: <a href="http://wordpress.org/extend/plugins/newsletter/" target="_blank">would you rate this plugin</a>?
35
  (few seconds required). (account on WordPress.org required, every blog owner should have one...). <strong>Really appreciated, Stefano</strong>.
@@ -38,7 +38,7 @@ if (isset($_REQUEST['dismiss']) && check_admin_referer()) {
38
  </div>
39
  <?php } ?>
40
 
41
- <?php if ($dismissed['newsletter-page'] != 1 && empty(NewsletterSubscription::instance()->options['url'])) { ?>
42
  <div class="newsletter-notice">
43
  Create a page with your blog style to show the subscription form and the subscription messages. Go to the
44
  <a href="?page=newsletter_subscription_options">subscription panel</a> to
29
  </div>
30
  <?php } ?>
31
 
32
+ <?php if (isset($dismissed['rate']) && $dismissed['rate'] != 1) { ?>
33
  <div class="newsletter-notice">
34
  I never asked before and I'm curious: <a href="http://wordpress.org/extend/plugins/newsletter/" target="_blank">would you rate this plugin</a>?
35
  (few seconds required). (account on WordPress.org required, every blog owner should have one...). <strong>Really appreciated, Stefano</strong>.
38
  </div>
39
  <?php } ?>
40
 
41
+ <?php if (isset($dismissed['newsletter-page']) && $dismissed['newsletter-page'] != 1 && empty(NewsletterSubscription::instance()->options['url'])) { ?>
42
  <div class="newsletter-notice">
43
  Create a page with your blog style to show the subscription form and the subscription messages. Go to the
44
  <a href="?page=newsletter_subscription_options">subscription panel</a> to
includes/controls.php CHANGED
@@ -7,29 +7,36 @@ class NewsletterControls {
7
  var $button_data = '';
8
 
9
  function __construct($options = null) {
10
- if ($options == null)
11
- $this->data = stripslashes_deep($_POST['options']);
12
- else
 
 
13
  $this->data = $options;
 
14
 
15
- $this->action = $_REQUEST['act'];
 
 
16
 
17
- if (isset($_REQUEST['btn']))
18
  $this->button_data = $_REQUEST['btn'];
19
-
20
  // Fields analysis
21
- $fields = $_REQUEST['fields'];
22
- if (is_array($fields)) {
23
- foreach ($fields as $name => $type) {
24
- if ($type == 'datetime') {
25
- // Ex. The user insert 01/07/2012 14:30 and it set the time zone to +2. We cannot use the
26
- // mktime, since it uses the time zone of the machine. We create the time as if we are on
27
- // GMT 0 and then we subtract the GMT offset (the example date and time on GMT+2 happens
28
- // "before").
29
-
30
- $time = gmmktime($_REQUEST[$name . '_hour'], 0, 0, $_REQUEST[$name . '_month'], $_REQUEST[$name . '_day'], $_REQUEST[$name . '_year']);
31
- $time -= get_option('gmt_offset') * 3600;
32
- $this->data[$name] = $time;
 
 
33
  }
34
  }
35
  }
@@ -62,10 +69,20 @@ class NewsletterControls {
62
  return false;
63
  if ($this->action != $action)
64
  return false;
65
- if (check_admin_referer())
66
  return true;
67
  die('Invalid call');
68
  }
 
 
 
 
 
 
 
 
 
 
69
 
70
  /**
71
  * Show the errors and messages.
@@ -135,11 +152,13 @@ class NewsletterControls {
135
  * @param array $values_labels
136
  */
137
  function checkboxes_group($name, $values_labels) {
 
 
138
  echo "<div class='newsletter-checkboxes-group'>";
139
  foreach ($values_labels as $value => $label) {
140
  echo "<div class='newsletter-checkboxes-item'>";
141
  echo "<input type='checkbox' id='$name' name='options[$name][]' value='$value'";
142
- if (is_array($this->data[$name]) && array_search($value, $this->data[$name]) !== false)
143
  echo " checked";
144
  echo '/>';
145
  if ($label != '')
@@ -162,11 +181,13 @@ class NewsletterControls {
162
  }
163
 
164
  function select_group($name, $options) {
 
 
165
  echo '<select name="options[' . $name . '][]">';
166
 
167
  foreach ($options as $key => $label) {
168
  echo '<option value="' . $key . '"';
169
- if (is_array($this->data[$name]) && array_search($value, $this->data[$name]) !== false)
170
  echo ' selected';
171
  echo '>' . htmlspecialchars($label) . '</option>';
172
  }
@@ -175,7 +196,7 @@ class NewsletterControls {
175
  }
176
 
177
  function select($name, $options, $first = null) {
178
- $value = $this->data[$name];
179
 
180
  echo '<select id="options-' . $name . '" name="options[' . $name . ']">';
181
  if (!empty($first)) {
@@ -191,7 +212,7 @@ class NewsletterControls {
191
  }
192
 
193
  function select_grouped($name, $groups) {
194
- $value = $this->data[$name];
195
 
196
  echo '<select name="options[' . $name . ']">';
197
 
@@ -236,7 +257,8 @@ class NewsletterControls {
236
  }
237
 
238
  function value_date($name, $show_remaining) {
239
- $time = $this->data[$name];
 
240
  echo gmdate(get_option('date_format') . ' ' . get_option('time_format'), $time + get_option('gmt_offset') * 3600);
241
  $delta = $time - time();
242
  if ($show_remaining && $delta > 0) {
@@ -256,30 +278,30 @@ class NewsletterControls {
256
  }
257
 
258
  function text($name, $size = 20, $placeholder = '') {
259
- if (!isset($this->data[$name])) $this->data[$name] = '';
260
  echo '<input placeholder="' . htmlspecialchars($placeholder) . '" name="options[' . $name . ']" type="text" size="' . $size . '" value="';
261
- echo htmlspecialchars($this->data[$name]);
262
  echo '"/>';
263
  }
264
 
265
  function text_email($name, $size = 40) {
266
- if (!isset($this->data[$name])) $this->data[$name] = '';
267
  echo '<input name="options[' . $name . ']" type="email" placeholder="Valid email address" size="' . $size . '" value="';
268
- echo htmlspecialchars($this->data[$name]);
269
  echo '"/>';
270
  }
271
-
272
  function text_url($name, $size = 40) {
273
- if (!isset($this->data[$name])) $this->data[$name] = '';
274
  echo '<input name="options[' . $name . ']" type="url" placeholder="http://..." size="' . $size . '" value="';
275
- echo htmlspecialchars($this->data[$name]);
276
  echo '"/>';
277
- }
278
 
279
  function hidden($name) {
280
- if (!isset($this->data[$name])) $this->data[$name] = '';
281
  echo '<input name="options[' . $name . ']" type="hidden" value="';
282
- echo htmlspecialchars($this->data[$name]);
283
  echo '"/>';
284
  }
285
 
@@ -310,7 +332,7 @@ class NewsletterControls {
310
 
311
  function editor($name, $rows = 5, $cols = 75) {
312
  echo '<textarea class="visual" name="options[' . $name . ']" style="width: 100%" wrap="off" rows="' . $rows . '">';
313
- echo htmlspecialchars($this->data[$name]);
314
  echo '</textarea>';
315
  }
316
 
@@ -589,7 +611,7 @@ class NewsletterControls {
589
  ';
590
  echo '<input name="act" type="hidden" value=""/>';
591
  echo '<input name="btn" type="hidden" value=""/>';
592
- wp_nonce_field();
593
  }
594
 
595
  function log_level($name = 'log_level') {
7
  var $button_data = '';
8
 
9
  function __construct($options = null) {
10
+ if ($options == null) {
11
+ if (isset($_POST['options'])) {
12
+ $this->data = stripslashes_deep($_POST['options']);
13
+ }
14
+ } else {
15
  $this->data = $options;
16
+ }
17
 
18
+ if (isset($_REQUEST['act'])) {
19
+ $this->action = $_REQUEST['act'];
20
+ }
21
 
22
+ if (isset($_REQUEST['btn'])) {
23
  $this->button_data = $_REQUEST['btn'];
24
+ }
25
  // Fields analysis
26
+ if (isset($_REQUEST['fields'])) {
27
+ $fields = $_REQUEST['fields'];
28
+ if (is_array($fields)) {
29
+ foreach ($fields as $name => $type) {
30
+ if ($type == 'datetime') {
31
+ // Ex. The user insert 01/07/2012 14:30 and it set the time zone to +2. We cannot use the
32
+ // mktime, since it uses the time zone of the machine. We create the time as if we are on
33
+ // GMT 0 and then we subtract the GMT offset (the example date and time on GMT+2 happens
34
+ // "before").
35
+
36
+ $time = gmmktime($_REQUEST[$name . '_hour'], 0, 0, $_REQUEST[$name . '_month'], $_REQUEST[$name . '_day'], $_REQUEST[$name . '_year']);
37
+ $time -= get_option('gmt_offset') * 3600;
38
+ $this->data[$name] = $time;
39
+ }
40
  }
41
  }
42
  }
69
  return false;
70
  if ($this->action != $action)
71
  return false;
72
+ if (check_admin_referer('save'))
73
  return true;
74
  die('Invalid call');
75
  }
76
+
77
+ function get_value($name) {
78
+ if (!isset($this->data[$name])) return null;
79
+ return $this->data[$name];
80
+ }
81
+
82
+ function get_value_array($name) {
83
+ if (!isset($this->data[$name]) || !is_array($this->data[$name])) return array();
84
+ return $this->data[$name];
85
+ }
86
 
87
  /**
88
  * Show the errors and messages.
152
  * @param array $values_labels
153
  */
154
  function checkboxes_group($name, $values_labels) {
155
+ $value_array = $this->get_value_array($name);
156
+
157
  echo "<div class='newsletter-checkboxes-group'>";
158
  foreach ($values_labels as $value => $label) {
159
  echo "<div class='newsletter-checkboxes-item'>";
160
  echo "<input type='checkbox' id='$name' name='options[$name][]' value='$value'";
161
+ if (array_search($value, $value_array) !== false)
162
  echo " checked";
163
  echo '/>';
164
  if ($label != '')
181
  }
182
 
183
  function select_group($name, $options) {
184
+ $value_array = $this->get_value_array($name);
185
+
186
  echo '<select name="options[' . $name . '][]">';
187
 
188
  foreach ($options as $key => $label) {
189
  echo '<option value="' . $key . '"';
190
+ if (array_search($value, $value_array) !== false)
191
  echo ' selected';
192
  echo '>' . htmlspecialchars($label) . '</option>';
193
  }
196
  }
197
 
198
  function select($name, $options, $first = null) {
199
+ $value = $this->get_value($name);
200
 
201
  echo '<select id="options-' . $name . '" name="options[' . $name . ']">';
202
  if (!empty($first)) {
212
  }
213
 
214
  function select_grouped($name, $groups) {
215
+ $value = $this->get_value($name);
216
 
217
  echo '<select name="options[' . $name . ']">';
218
 
257
  }
258
 
259
  function value_date($name, $show_remaining) {
260
+ $time = $this->get_value($name);
261
+
262
  echo gmdate(get_option('date_format') . ' ' . get_option('time_format'), $time + get_option('gmt_offset') * 3600);
263
  $delta = $time - time();
264
  if ($show_remaining && $delta > 0) {
278
  }
279
 
280
  function text($name, $size = 20, $placeholder = '') {
281
+ $value = $this->get_value($name);
282
  echo '<input placeholder="' . htmlspecialchars($placeholder) . '" name="options[' . $name . ']" type="text" size="' . $size . '" value="';
283
+ echo htmlspecialchars($value);
284
  echo '"/>';
285
  }
286
 
287
  function text_email($name, $size = 40) {
288
+ $value = $this->get_value($name);
289
  echo '<input name="options[' . $name . ']" type="email" placeholder="Valid email address" size="' . $size . '" value="';
290
+ echo htmlspecialchars($value);
291
  echo '"/>';
292
  }
293
+
294
  function text_url($name, $size = 40) {
295
+ $value = $this->get_value($name);
296
  echo '<input name="options[' . $name . ']" type="url" placeholder="http://..." size="' . $size . '" value="';
297
+ echo htmlspecialchars($value);
298
  echo '"/>';
299
+ }
300
 
301
  function hidden($name) {
302
+ $value = $this->get_value($name);
303
  echo '<input name="options[' . $name . ']" type="hidden" value="';
304
+ echo htmlspecialchars($value);
305
  echo '"/>';
306
  }
307
 
332
 
333
  function editor($name, $rows = 5, $cols = 75) {
334
  echo '<textarea class="visual" name="options[' . $name . ']" style="width: 100%" wrap="off" rows="' . $rows . '">';
335
+ echo htmlspecialchars($this->get_value($name));
336
  echo '</textarea>';
337
  }
338
 
611
  ';
612
  echo '<input name="act" type="hidden" value=""/>';
613
  echo '<input name="btn" type="hidden" value=""/>';
614
+ wp_nonce_field('save');
615
  }
616
 
617
  function log_level($name = 'log_level') {
includes/module.php CHANGED
@@ -80,11 +80,11 @@ class NewsletterModule {
80
  function upgrade() {
81
  $this->logger->info('upgrade> Start');
82
 
 
83
  if (empty($this->options) || !is_array($this->options)) {
84
- $this->options = $this->get_default_options();
85
- $this->save_options($this->options);
86
  } else {
87
- // TODO: Try with an array_merge()?
88
  }
89
  // if (!empty($this->module_id)) {
90
  // wp_clear_scheduled_hook($this->prefix . '_version_check');
@@ -96,10 +96,12 @@ class NewsletterModule {
96
  global $wpdb, $charset_collate;
97
 
98
  $this->logger->info('upgrade_query> Executing ' . $query);
 
99
  $wpdb->query($query);
100
  if ($wpdb->last_error) {
101
  $this->logger->debug($wpdb->last_error);
102
  }
 
103
  }
104
 
105
  // function hook_version_check() {
80
  function upgrade() {
81
  $this->logger->info('upgrade> Start');
82
 
83
+ $default_options = $this->get_default_options();
84
  if (empty($this->options) || !is_array($this->options)) {
85
+ $this->save_options($default_options);
 
86
  } else {
87
+ $this->save_options(array_merge($default_options, $this->options));
88
  }
89
  // if (!empty($this->module_id)) {
90
  // wp_clear_scheduled_hook($this->prefix . '_version_check');
96
  global $wpdb, $charset_collate;
97
 
98
  $this->logger->info('upgrade_query> Executing ' . $query);
99
+ $suppress_errors = $wpdb->suppress_errors(true);
100
  $wpdb->query($query);
101
  if ($wpdb->last_error) {
102
  $this->logger->debug($wpdb->last_error);
103
  }
104
+ $wpdb->suppress_errors($suppress_errors);
105
  }
106
 
107
  // function hook_version_check() {
main/diagnostic.php CHANGED
@@ -107,7 +107,7 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
107
  <div class="preamble">
108
  <p>
109
  If something is not working, here are some test procedures and diagnostics. But before you try these,
110
- write down any modifications or configuration changes that you may have made.
111
  For example: Did you use sender email or name? What was the return path? What was the reply to?
112
  </p>
113
  </div>
@@ -376,6 +376,12 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
376
  <?php echo WP_MEMORY_LIMIT; ?>
377
  </td>
378
  </tr>
 
 
 
 
 
 
379
  <tr>
380
  <td>Absolute path</td>
381
  <td>
107
  <div class="preamble">
108
  <p>
109
  If something is not working, here are some test procedures and diagnostics. But before you try these,
110
+ write down any configuration changes that you may have made.
111
  For example: Did you use sender email or name? What was the return path? What was the reply to?
112
  </p>
113
  </div>
376
  <?php echo WP_MEMORY_LIMIT; ?>
377
  </td>
378
  </tr>
379
+ <tr>
380
+ <td>WP_DEBUG</td>
381
+ <td>
382
+ <?php echo WP_DEBUG?'true':'false'; ?>
383
+ </td>
384
+ </tr>
385
  <tr>
386
  <td>Absolute path</td>
387
  <td>
main/index.php CHANGED
@@ -106,9 +106,10 @@ if ($controls->is_action('check_versions')) {
106
  <h3>Modules</h3>
107
  <p>
108
  Below is the list of available modules that can be used with Newsletter plugin. Some modules are the "core" part
109
- of Newsletter and are automatically updated with Newsletter official updates. Other modules are extensions and
110
  can be downloaded from <a href="http://www.satollo.net/downloads" target="_blank">www.satollo.net/downloads</a>.
111
- Some of them are commercial and others are still under development (here for testers).
 
112
  </p>
113
 
114
  <table class="widefat" style="width: auto">
106
  <h3>Modules</h3>
107
  <p>
108
  Below is the list of available modules that can be used with Newsletter plugin. Some modules are the "core" part
109
+ of Newsletter and are automatically updated with Newsletter official updates. Other modules are <strong>extensions</strong> and
110
  can be downloaded from <a href="http://www.satollo.net/downloads" target="_blank">www.satollo.net/downloads</a>.
111
+ <br>
112
+ Extensions must be installed in the folder wp-content/extensions/newsletter.
113
  </p>
114
 
115
  <table class="widefat" style="width: auto">
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.satollo.net/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="http://www.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
7
- Version: 3.3.7
8
  Author: Stefano Lissa
9
  Author URI: http://www.satollo.net
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -13,7 +13,7 @@
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
- define('NEWSLETTER_VERSION', '3.3.7');
17
 
18
  global $wpdb, $newsletter;
19
 
@@ -49,11 +49,12 @@ define('NEWSLETTER_UNLOCK_URL', NEWSLETTER_URL . '/do/unlock.php');
49
  define('NEWSLETTER_UNSUBSCRIBE_URL', NEWSLETTER_URL . '/do/unsubscribe.php');
50
  define('NEWSLETTER_UNSUBSCRIPTION_URL', NEWSLETTER_URL . '/do/unsubscription.php');
51
 
52
-
53
  if (!defined('NEWSLETTER_LIST_MAX'))
54
  define('NEWSLETTER_LIST_MAX', 20);
 
55
  if (!defined('NEWSLETTER_PROFILE_MAX'))
56
  define('NEWSLETTER_PROFILE_MAX', 20);
 
57
  if (!defined('NEWSLETTER_FORMS_MAX'))
58
  define('NEWSLETTER_FORMS_MAX', 10);
59
 
@@ -202,11 +203,6 @@ class Newsletter extends NewsletterModule {
202
  $this->upgrade_query("drop table if exists " . $wpdb->prefix . "newsletter_work");
203
  $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " convert to character set utf8");
204
 
205
- // TODO: To be moved on users module.
206
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set utf8");
207
-
208
- $this->upgrade_query("update " . NEWSLETTER_USERS_TABLE . " set sex='n' where sex='' or sex=' '");
209
-
210
  // Some setting check to avoid the common support request for mis-configurations
211
  $options = $this->get_options();
212
 
@@ -250,7 +246,7 @@ class Newsletter extends NewsletterModule {
250
 
251
  function admin_menu() {
252
  // This adds the main menu page
253
- add_menu_page('Newsletter', 'Newsletter', ($newsletter->options['editor'] == 1) ? 'manage_categories' : 'manage_options', 'newsletter_main_index');
254
 
255
  $this->add_menu_page('index', 'Welcome');
256
  $this->add_menu_page('main', 'Configuration');
@@ -342,10 +338,10 @@ class Newsletter extends NewsletterModule {
342
 
343
  // TODO: move on subscription module
344
  $profile_options = get_option('newsletter_profile');
345
- if ($profile_options['style'] != '') {
346
  echo '<link href="' . NewsletterSubscription::instance()->get_style_url($profile_options['style']) . '" type="text/css" rel="stylesheet">';
347
  }
348
- if ($profile_options['widget_style'] != '') {
349
  echo '<link href="' . NewsletterSubscription::instance()->get_style_url($profile_options['widget_style']) . '" type="text/css" rel="stylesheet">';
350
  }
351
  }
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.satollo.net/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="http://www.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
7
+ Version: 3.3.9
8
  Author: Stefano Lissa
9
  Author URI: http://www.satollo.net
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
+ define('NEWSLETTER_VERSION', '3.3.9');
17
 
18
  global $wpdb, $newsletter;
19
 
49
  define('NEWSLETTER_UNSUBSCRIBE_URL', NEWSLETTER_URL . '/do/unsubscribe.php');
50
  define('NEWSLETTER_UNSUBSCRIPTION_URL', NEWSLETTER_URL . '/do/unsubscription.php');
51
 
 
52
  if (!defined('NEWSLETTER_LIST_MAX'))
53
  define('NEWSLETTER_LIST_MAX', 20);
54
+
55
  if (!defined('NEWSLETTER_PROFILE_MAX'))
56
  define('NEWSLETTER_PROFILE_MAX', 20);
57
+
58
  if (!defined('NEWSLETTER_FORMS_MAX'))
59
  define('NEWSLETTER_FORMS_MAX', 10);
60
 
203
  $this->upgrade_query("drop table if exists " . $wpdb->prefix . "newsletter_work");
204
  $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " convert to character set utf8");
205
 
 
 
 
 
 
206
  // Some setting check to avoid the common support request for mis-configurations
207
  $options = $this->get_options();
208
 
246
 
247
  function admin_menu() {
248
  // This adds the main menu page
249
+ add_menu_page('Newsletter', 'Newsletter', ($this->options['editor'] == 1) ? 'manage_categories' : 'manage_options', 'newsletter_main_index');
250
 
251
  $this->add_menu_page('index', 'Welcome');
252
  $this->add_menu_page('main', 'Configuration');
338
 
339
  // TODO: move on subscription module
340
  $profile_options = get_option('newsletter_profile');
341
+ if (!empty($profile_options['style'])) {
342
  echo '<link href="' . NewsletterSubscription::instance()->get_style_url($profile_options['style']) . '" type="text/css" rel="stylesheet">';
343
  }
344
+ if (!empty($profile_options['widget_style'])) {
345
  echo '<link href="' . NewsletterSubscription::instance()->get_style_url($profile_options['widget_style']) . '" type="text/css" rel="stylesheet">';
346
  }
347
  }
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.3.0
4
- Tested up to: 3.5.2
5
- Stable tag: 3.3.7
6
  Donate link: http://www.satollo.net/donations
7
 
8
  Add a real newsletter to your blog. In seconds. For free. With unlimited emails and subscribers.
@@ -55,6 +55,17 @@ No screen shots are available at this time.
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
 
 
 
 
 
58
  = 3.3.7 =
59
 
60
  * Fixed the feed by mail field on widget
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.3.0
4
+ Tested up to: 3.6.1
5
+ Stable tag: trunk
6
  Donate link: http://www.satollo.net/donations
7
 
8
  Add a real newsletter to your blog. In seconds. For free. With unlimited emails and subscribers.
55
 
56
  == Changelog ==
57
 
58
+ = 3.3.9 =
59
+
60
+ * Fixed activation in debug mode
61
+ * Fixed some notices
62
+ * Added defaults for subscriber titles (Mr, Mrs, ...)
63
+
64
+ = 3.3.8 =
65
+
66
+ * Internal code fixes
67
+ * Fixed the "editor" access control
68
+
69
  = 3.3.7 =
70
 
71
  * Fixed the feed by mail field on widget
statistics/index.php CHANGED
@@ -16,7 +16,7 @@ if ($controls->is_action('save')) {
16
  <?php include NEWSLETTER_DIR . '/header.php'; ?>
17
 
18
  <h5>Statistics Module</h5>
19
-
20
  <h2>Configuration and Email List</h2>
21
 
22
  <p>
@@ -29,7 +29,7 @@ if ($controls->is_action('save')) {
29
  convenience, below there is a list of each email sent by Newsletter till now.
30
  </p>
31
  <p>
32
- A more advanced report for each email can be generated installing the Advanced Statistics Module
33
  from <a href="http://www.satollo.net/downloads" target="_blank">this page</a>.
34
  </p>
35
 
@@ -38,10 +38,11 @@ if ($controls->is_action('save')) {
38
  <tr>
39
  <th>Id</th>
40
  <th>Subject</th>
41
- <th>Date</th>
42
  <th>Type</th>
43
  <th>Status</th>
44
  <th>&nbsp;</th>
 
 
45
  </tr>
46
  </thead>
47
 
@@ -50,12 +51,22 @@ if ($controls->is_action('save')) {
50
  <tr>
51
  <td><?php echo $email->id; ?></td>
52
  <td><?php echo htmlspecialchars($email->subject); ?></td>
53
- <td><?php echo $email->date; ?></td>
54
  <td><?php echo $email->type; ?></td>
55
  <td>
56
- <?php echo $email->status; ?>
57
- (<?php echo $email->sent; ?>/<?php echo $email->total; ?>)
 
 
 
 
 
 
 
 
 
58
  </td>
 
 
59
  <td>
60
  <a class="button" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>">statistics</a>
61
  </td>
16
  <?php include NEWSLETTER_DIR . '/header.php'; ?>
17
 
18
  <h5>Statistics Module</h5>
19
+
20
  <h2>Configuration and Email List</h2>
21
 
22
  <p>
29
  convenience, below there is a list of each email sent by Newsletter till now.
30
  </p>
31
  <p>
32
+ A more advanced report for each email can be generated installing the Reports Extension
33
  from <a href="http://www.satollo.net/downloads" target="_blank">this page</a>.
34
  </p>
35
 
38
  <tr>
39
  <th>Id</th>
40
  <th>Subject</th>
 
41
  <th>Type</th>
42
  <th>Status</th>
43
  <th>&nbsp;</th>
44
+ <th>&nbsp;</th>
45
+ <th>&nbsp;</th>
46
  </tr>
47
  </thead>
48
 
51
  <tr>
52
  <td><?php echo $email->id; ?></td>
53
  <td><?php echo htmlspecialchars($email->subject); ?></td>
 
54
  <td><?php echo $email->type; ?></td>
55
  <td>
56
+ <?php
57
+ if ($email->status == 'sending') {
58
+ if ($email->send_on > time()) {
59
+ echo 'planned';
60
+ } else {
61
+ echo 'sending';
62
+ }
63
+ } else {
64
+ echo $email->status;
65
+ }
66
+ ?>
67
  </td>
68
+ <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $email->sent . ' of ' . $email->total; ?></td>
69
+ <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $module->format_date($email->send_on); ?></td>
70
  <td>
71
  <a class="button" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>">statistics</a>
72
  </td>
statistics/statistics.php CHANGED
@@ -51,6 +51,10 @@ class NewsletterStatistics extends NewsletterModule {
51
  // $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column email_id int not null default 0");
52
  // $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column token varchar(10) not null default ''");
53
  // $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column text varchar(255) not null default ''");
 
 
 
 
54
  }
55
 
56
  function admin_menu() {
51
  // $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column email_id int not null default 0");
52
  // $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column token varchar(10) not null default ''");
53
  // $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column text varchar(255) not null default ''");
54
+
55
+
56
+ //$this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_stats (id int auto_increment, primary key (id)) $charset_collate");
57
+
58
  }
59
 
60
  function admin_menu() {
subscription/languages/profile-en_US.php CHANGED
@@ -13,3 +13,10 @@ $options['privacy_error'] = 'You must accept the privacy statement';
13
  $options['subscribe'] = 'Subscribe';
14
  $options['save'] = 'Save';
15
 
 
 
 
 
 
 
 
13
  $options['subscribe'] = 'Subscribe';
14
  $options['save'] = 'Save';
15
 
16
+ $options['title_female'] = 'Mrs.';
17
+ $options['title_male'] = 'Mr.';
18
+ $options['title_none'] = 'Dear';
19
+
20
+ $options['sex_male'] = 'Man';
21
+ $options['sex_female'] = 'Woman';
22
+ $options['sex_none'] = 'None';
subscription/options.php CHANGED
@@ -92,7 +92,7 @@ if ($controls->is_action('create')) {
92
  }
93
  ?>
94
 
95
- <?php if ($controls->data['novisual'] != 1) { ?>
96
  <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/tiny_mce/tiny_mce.js"></script>
97
 
98
  <script type="text/javascript">
92
  }
93
  ?>
94
 
95
+ <?php if (isset($controls->data['novisual']) && $controls->data['novisual'] != 1) { ?>
96
  <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/tiny_mce/tiny_mce.js"></script>
97
 
98
  <script type="text/javascript">
subscription/subscription.php CHANGED
@@ -19,7 +19,7 @@ class NewsletterSubscription extends NewsletterModule {
19
  }
20
 
21
  function __construct() {
22
- parent::__construct('subscription', '1.0.4');
23
 
24
  add_action('wp_login', array($this, 'hook_wp_login'));
25
 
@@ -72,9 +72,12 @@ class NewsletterSubscription extends NewsletterModule {
72
 
73
  // Migrate the profile_text from profile to subscription options
74
  $options_profile = $this->get_options('profile');
75
-
 
76
  if (empty($options_profile)) {
77
  update_option('newsletter_profile', $this->get_default_options('profile'));
 
 
78
  }
79
 
80
  $default_options = $this->get_default_options();
@@ -110,7 +113,7 @@ class NewsletterSubscription extends NewsletterModule {
110
  }
111
 
112
  // Because users do not understand how to create an "extensions" folder...
113
- wp_mkdir_p(WP_CONTENT_DIR . '/extensions/newsletter/subscription');
114
  return true;
115
  }
116
 
19
  }
20
 
21
  function __construct() {
22
+ parent::__construct('subscription', '1.0.9');
23
 
24
  add_action('wp_login', array($this, 'hook_wp_login'));
25
 
72
 
73
  // Migrate the profile_text from profile to subscription options
74
  $options_profile = $this->get_options('profile');
75
+ $default_options_profile = $this->get_default_options('profile');
76
+
77
  if (empty($options_profile)) {
78
  update_option('newsletter_profile', $this->get_default_options('profile'));
79
+ } else {
80
+ update_option('newsletter_profile', array_merge($default_options_profile, $options_profile));
81
  }
82
 
83
  $default_options = $this->get_default_options();
113
  }
114
 
115
  // Because users do not understand how to create an "extensions" folder...
116
+ @wp_mkdir_p(WP_CONTENT_DIR . '/extensions/newsletter/subscription');
117
  return true;
118
  }
119
 
users/export.php CHANGED
@@ -7,6 +7,7 @@ $module = NewsletterUsers::instance();
7
 
8
  $lists = array('0' => 'All');
9
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
 
10
  $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
11
  }
12
  ?>
7
 
8
  $lists = array('0' => 'All');
9
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
10
+ if (!isset($options_profile['list_' . $i])) $options_profile['list_' . $i] = '';
11
  $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
12
  }
13
  ?>
users/index.php CHANGED
@@ -5,7 +5,7 @@ require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterUsers::instance();
7
 
8
- $options = stripslashes_deep($_POST['options']);
9
  $options_lists = get_option('newsletter_profile');
10
  $options_profile = get_option('newsletter_profile');
11
  $options_main = get_option('newsletter_main');
@@ -38,9 +38,13 @@ if ($controls->is_action('remove')) {
38
 
39
  // We build the query condition
40
  $where = "where 1=1";
41
- $text = $wpdb->escape(trim($controls->data['search_text']));
 
42
  if ($text != '') {
43
- $where .= " and (email like '%$text%' or name like '%$text%' or surname like '%$text%')";
 
 
 
44
  }
45
 
46
  //if (isset($controls->data['search_test'])) {
@@ -51,7 +55,8 @@ if (!empty($controls->data['search_status'])) {
51
  if ($controls->data['search_status'] == 'T') {
52
  $where .= " and test=1";
53
  } else {
54
- $where .= " and status='" . $wpdb->escape($controls->data['search_status']) . "'";
 
55
  }
56
  }
57
 
@@ -91,8 +96,9 @@ if ($controls->is_action('search')) {
91
  if ($controls->data['search_page'] < 0) $controls->data['search_page'] = 0;
92
  if ($controls->data['search_page'] > $last_page) $controls->data['search_page'] = $last_page;
93
 
 
94
 
95
- $query .= "select * from " . $wpdb->prefix . "newsletter " . $where . " order by id desc";
96
  $query .= " limit " . ($controls->data['search_page']*$items_per_page) . "," . $items_per_page;
97
  $list = $wpdb->get_results($query);
98
 
@@ -136,15 +142,15 @@ $controls->data['search_page']++;
136
  <tr>
137
  <th>Id</th>
138
  <th>Email/Name</th>
139
- <?php if ($options['show_profile'] == 1) { ?>
140
  <th>Profile</th>
141
  <?php } ?>
142
  <th>Status</th>
143
- <?php if ($options['show_preferences'] == 1) { ?>
144
  <th>Preferences</th>
145
  <?php } ?>
146
  <th>Actions</th>
147
- <?php if ($options['search_clicks'] == 1) { ?>
148
  <th>Clicks</th>
149
  <?php } ?>
150
  </tr>
@@ -161,7 +167,7 @@ $controls->data['search_page']++;
161
  </td>
162
 
163
 
164
- <?php if ($options['show_profile'] == 1) { ?>
165
  <td>
166
  <small>
167
  <?php
@@ -191,7 +197,7 @@ $controls->data['search_page']++;
191
  </small>
192
  </td>
193
 
194
- <?php if ($options['show_preferences'] == 1) { ?>
195
  <td>
196
  <small>
197
  <?php
5
  $controls = new NewsletterControls();
6
  $module = NewsletterUsers::instance();
7
 
8
+ $options = $controls->data;
9
  $options_lists = get_option('newsletter_profile');
10
  $options_profile = get_option('newsletter_profile');
11
  $options_main = get_option('newsletter_main');
38
 
39
  // We build the query condition
40
  $where = "where 1=1";
41
+ $query_args = array();
42
+ $text = trim($controls->data['search_text']);
43
  if ($text != '') {
44
+ $query_args[] = '%' . $text . '%';
45
+ $query_args[] = '%' . $text . '%';
46
+ $query_args[] = '%' . $text . '%';
47
+ $where .= " and (email like %s or name like %s or surname like %s)";
48
  }
49
 
50
  //if (isset($controls->data['search_test'])) {
55
  if ($controls->data['search_status'] == 'T') {
56
  $where .= " and test=1";
57
  } else {
58
+ $query_args[] = $controls->data['search_status'];
59
+ $where .= " and status=%s";
60
  }
61
  }
62
 
96
  if ($controls->data['search_page'] < 0) $controls->data['search_page'] = 0;
97
  if ($controls->data['search_page'] > $last_page) $controls->data['search_page'] = $last_page;
98
 
99
+ $where = $wpdb->prepare($where, $query_args);
100
 
101
+ $query = "select * from " . $wpdb->prefix . "newsletter " . $where . " order by id desc";
102
  $query .= " limit " . ($controls->data['search_page']*$items_per_page) . "," . $items_per_page;
103
  $list = $wpdb->get_results($query);
104
 
142
  <tr>
143
  <th>Id</th>
144
  <th>Email/Name</th>
145
+ <?php if (isset($options['show_profile']) && $options['show_profile'] == 1) { ?>
146
  <th>Profile</th>
147
  <?php } ?>
148
  <th>Status</th>
149
+ <?php if (isset($options['show_preferences']) && $options['show_preferences'] == 1) { ?>
150
  <th>Preferences</th>
151
  <?php } ?>
152
  <th>Actions</th>
153
+ <?php if (isset($options['search_clicks']) && $options['search_clicks'] == 1) { ?>
154
  <th>Clicks</th>
155
  <?php } ?>
156
  </tr>
167
  </td>
168
 
169
 
170
+ <?php if (isset($options['show_profile']) && $options['show_profile'] == 1) { ?>
171
  <td>
172
  <small>
173
  <?php
197
  </small>
198
  </td>
199
 
200
+ <?php if (isset($options['show_preferences']) && $options['show_preferences'] == 1) { ?>
201
  <td>
202
  <small>
203
  <?php
users/massive.php CHANGED
@@ -8,6 +8,7 @@ $options_profile = get_option('newsletter_profile');
8
 
9
  $lists = array();
10
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
 
11
  $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
12
  }
13
 
8
 
9
  $lists = array();
10
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
11
+ if (!isset($options_profile['list_' . $i])) $options_profile['list_' . $i] = '';
12
  $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
13
  }
14
 
users/users.php CHANGED
@@ -61,6 +61,11 @@ class NewsletterUsers extends NewsletterModule {
61
 
62
  // TODO: Flow module should add that it self (?)
63
  $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column flow tinyint(4) not null default 0");
 
 
 
 
 
64
  }
65
 
66
  function admin_menu() {
61
 
62
  // TODO: Flow module should add that it self (?)
63
  $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column flow tinyint(4) not null default 0");
64
+
65
+ // Old problems...
66
+ $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set utf8");
67
+
68
+ $this->upgrade_query("update " . NEWSLETTER_USERS_TABLE . " set sex='n' where sex='' or sex=' '");
69
  }
70
 
71
  function admin_menu() {