Subscribe to Comments - Version 2.0.4

Version Description

Download this release

Release Info

Developer markjaquith
Plugin Icon wp plugin Subscribe to Comments
Version 2.0.4
Comparing to
See all releases

Code changes from version 2.0-beta-2 to 2.0.4

readme.txt ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Subscribe to Comments ===
2
+ Tags: comments, subscription
3
+ Contributors: markjaquith
4
+
5
+ Subscribe to Comments 2 is a WordPress plugin that allows commenters on an entry to subscribe to e-mail notifications for subsequent comments. It does NOT e-mail you new blog posts. For that functionality, use Skippy's Subscribe2 plugin.
6
+
7
+ == Installation ==
8
+
9
+ 1. Put subscribe-to-comments.php into [wordpress_dir]/wp-content/plugins/
10
+ 2. Put wp-subscription-manager.php into your blog's root WordPress directory (the directory where wp-config.php resides)
11
+ 3. Go into the WordPress admin interface and activate the plugin
12
+ 4. Optional: if your WordPress 1.5 theme doesn't have the comment_form hook, or if you would like to manually determine where in your comments form the subscribe checkbox appears, enter this where you would like it: <?php show_subscription_checkbox(); ?>
13
+ 5. Optional: If you would like to enable users to subscribe to comments without having to leave a comment, place this somewhere in your template, but make sure it is <strong>outside the comments form</strong>. A good place would be right after the ending </form> tag for the comments form: <?php show_manual_subscription_form(); ?>
14
+
15
+ == Frequently Asked Questions ==
16
+
17
+ = How can I tell if it's working? =
18
+
19
+ 1. Log out of WordPress
20
+ 2. Leave a comment on an entry and check the comment subscription box, using an e-mail that is NOT the WP admin e-mail address or the e-mail address of the author of the post.
21
+ 3. Leave a second comment (don't have to subscribed) using any old e-mail address
22
+ 4. This should trigger a notification to the first address you used.
23
+
24
+ = I'd like the subscription checkbox to be checked by default. Can I do that? =
25
+
26
+ By default, the "subscribe" checkbox is unchecked, but you can change that in the options (i.e. so that it is checked by default).
subscribe-to-comments.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /*
3
  Plugin Name: Subscribe To Comments
4
- Version: 2.0-beta-2
5
- Plugin URI: http://txfx.net/search/subscribe%20to%20comments%202
6
  Description: Allows readers to recieve notifications of new comments that are posted to an entry
7
  Author: Mark Jaquith and Jennifer (ScriptyGoddess)
8
  Author URI: http://scriptygoddess.com/
@@ -40,7 +40,7 @@ function show_subscription_checkbox ($id='0') {
40
 
41
  <?php /* ------------------------------------------------------------------- */ ?>
42
 
43
- <?php elseif ( $email == 'admin' ) : ?>
44
 
45
  <?php /* ------------------------------------------------------------- */ ?>
46
  <?php /* This is the text that is displayed for the author of the post */ ?>
@@ -51,7 +51,7 @@ function show_subscription_checkbox ($id='0') {
51
  </p>
52
 
53
  <?php else : ?>
54
-
55
  <?php /* --------------------------------------------------------------- */ ?>
56
  <?php /* This is the text that is displayed for users who ARE subscribed */ ?>
57
  <?php /* --------------------------------------------------------------- */ ?>
@@ -59,13 +59,13 @@ function show_subscription_checkbox ($id='0') {
59
  <p style="clear: both;" class="subscribe-to-comments">
60
  <?php echo str_replace('[manager_link]', $sg_subscribe->manage_link($email, true, false), $sg_subscribe->subscribed_text); ?>
61
  </p>
62
-
63
  <?php /* --------------------------------------------------------------- */ ?>
64
-
65
- <?php endif;
66
 
67
  $sg_subscribe->checkbox_shown = true;
68
- return $id;
69
  }
70
 
71
 
@@ -80,7 +80,7 @@ function show_manual_subscription_form () {
80
  sg_subscribe_start();
81
  $sg_subscribe->show_errors('solo_subscribe', '<div class="solo-subscribe-errors">', '</div>', __('<strong>Error: </strong>', 'subscribe-to-comments'), '<br />');
82
 
83
- if ( !$sg_subscribe->current_viewer_subscription_status() ) :
84
  get_currentuserinfo(); ?>
85
 
86
  <?php /* ------------------------------------------------------------------- */ ?>
@@ -91,11 +91,11 @@ if ( !$sg_subscribe->current_viewer_subscription_status() ) :
91
  <input type="hidden" name="solo-comment-subscribe" value="solo-comment-subscribe" />
92
  <input type="hidden" name="postid" value="<?php echo $id; ?>" />
93
  <input type="hidden" name="ref" value="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>" />
94
-
95
  <p class="solo-subscribe-to-comments">
96
  <?php _e('Subscribe without commenting', 'subscribe-to-comments'); ?>
97
  <br />
98
- <label for="solo-subscribe-email"><?php _e('E-Mail:', 'subscribe-to-comments'); ?>
99
  <input type="text" name="email" id="solo-subscribe-email" size="22" value="<?php echo $user_email; ?>" /></label>
100
  <input type="submit" name="submit" value="<?php _e('Subscribe', 'subscribe-to-comments'); ?>" />
101
  </p>
@@ -103,7 +103,7 @@ if ( !$sg_subscribe->current_viewer_subscription_status() ) :
103
 
104
  <?php /* ------------------------------------------------------------------- */ ?>
105
 
106
- <?php endif;
107
  }
108
 
109
 
@@ -118,7 +118,7 @@ if ($comment->comment_subscribe == 'Y') {
118
  return true;
119
  } else {
120
  return false;
121
- }
122
  }
123
 
124
 
@@ -138,7 +138,6 @@ class sg_subscribe_settings
138
  if($_SERVER['REQUEST_METHOD'] == 'POST')
139
  {
140
  update_option('sg_subscribe_settings', $_POST['sg_subscribe_settings']);
141
- update_option('sg_subscribe_settings', $_POST['sg_subscribe_settings']);
142
  }
143
  echo '<h2>Subscribe to Comments Options</h2>';
144
  echo '<ul>';
@@ -147,58 +146,58 @@ class sg_subscribe_settings
147
  echo '<li><label for="email">' . __('"From" e-mail addresss for notifications:', 'subscribe-to-comments') . ' <input type="text" size="40" id="email" name="sg_subscribe_settings[email]" value="' . sg_subscribe_settings::form_setting('email') . '" /></label></li>';
148
  echo '<li><label for="default_subscribed"><input type="checkbox" id="default_subscribed" name="sg_subscribe_settings[default_subscribed]" value="default_subscribed"' . sg_subscribe_settings::checkflag('default_subscribed') . ' /> ' . __('"Subscribe" box should be checked by default', 'subscribe-to-comments') . '</label></li>';
149
  echo '</ul>';
150
-
151
  echo '<fieldset><legend>' . __('Comment Form Text', 'subscribe-to-comments') . '</legend>';
152
-
153
  echo '<p>' . __('Customize the messages shown to different people. Use <code>[manager_link]</code> to insert the URI to the Subscription Manager.', 'subscribe-to-comments') . '</p>';
154
-
155
  echo '<ul>';
156
-
157
  echo '<li><label for="not_subscribed_text">' . __('Not subscribed', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="not_subscribed_text" name="sg_subscribe_settings[not_subscribed_text]">' . sg_subscribe_settings::textarea_setting('not_subscribed_text') . '</textarea></li>';
158
-
159
  echo '<li><label for="subscribed_text">' . __('Subscribed', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="subscribed_text" name="sg_subscribe_settings[subscribed_text]">' . sg_subscribe_settings::textarea_setting('subscribed_text') . '</textarea></li>';
160
-
161
  echo '<li><label for="author_text">' . __('Entry Author', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="author_text" name="sg_subscribe_settings[author_text]">' . sg_subscribe_settings::textarea_setting('author_text') . '</textarea></li>';
162
-
163
  echo '</ul></fieldset>';
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
- echo '<fieldset>';
173
  echo '<legend><input type="checkbox" id="use_custom_style" name="sg_subscribe_settings[use_custom_style]" value="use_custom_style"' . sg_subscribe_settings::checkflag('use_custom_style') . ' /> <label for="use_custom_style">' . __('Use custom style for Subscription Manager', 'subscribe-to-comments') . '</label></legend>';
174
 
175
  echo '<p>' . __('These settings only matter if you are using a custom style. <code>[theme_path]</code> will be replaced with the path to your current theme.', 'subscribe-to-comments') . '</p>';
176
-
177
  echo '<ul>';
178
  echo '<li><label for="sg_sub_header">' . __('Path to header:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_header" name="sg_subscribe_settings[header]" value="' . sg_subscribe_settings::form_setting('header') . '" /></label></li>';
179
  echo '<li><label for="sg_sub_sidebar">' . __('Path to sidebar:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_sidebar" name="sg_subscribe_settings[sidebar]" value="' . sg_subscribe_settings::form_setting('sidebar') . '" /></label></li>';
180
  echo '<li><label for="sg_sub_footer">' . __('Path to footer:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_footer" name="sg_subscribe_settings[footer]" value="' . sg_subscribe_settings::form_setting('footer') . '" /></label></li>';
181
-
182
 
183
  echo '<li><label for="before_manager">' . __('HTML for before the subscription manager:', 'subscribe-to-comments') . ' </label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="before_manager" name="sg_subscribe_settings[before_manager]">' . sg_subscribe_settings::textarea_setting('before_manager') . '</textarea></li>';
184
  echo '<li><label for="after_manager">' . __('HTML for after the subscription manager:', 'subscribe-to-comments') . ' </label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="after_manager" name="sg_subscribe_settings[after_manager]">' . sg_subscribe_settings::textarea_setting('after_manager') . '</textarea></li>';
185
  echo '</ul>';
186
  echo '</fieldset>';
187
  }
188
-
189
  function checkflag($optname)
190
  {
191
  $options = get_settings('sg_subscribe_settings');
192
  if($options[$optname] != $optname) return '';
193
  return ' checked="checked"';
194
  }
195
-
196
  function form_setting($optname)
197
  {
198
  $options = get_settings('sg_subscribe_settings');
199
  return htmlspecialchars(stripslashes($options[$optname]), ENT_QUOTES);
200
  }
201
-
202
  function textarea_setting($optname)
203
  {
204
  $options = get_settings('sg_subscribe_settings');
@@ -214,9 +213,9 @@ class sg_subscribe_settings
214
  }
215
 
216
  echo '<form method="post"><div class="wrap">';
217
-
218
  sg_subscribe_settings::options_page_contents();
219
-
220
  echo '<p class="submit"><input type="submit" name="sg_subscribe_settings_submit" value="';
221
  _e('Update Options &raquo;', 'subscribe-to-comments');
222
  echo '" /></p></div>';
@@ -255,51 +254,51 @@ class sg_subscribe
255
  var $key;
256
  var $key_type;
257
  var $action;
258
- var $default_subscribed;
259
  var $not_subscribed_text;
260
  var $subscribed_text;
261
  var $author_text;
262
-
 
 
263
 
264
  function sg_subscribe() {
265
  global $wpdb;
266
  $this->db_upgrade_check();
267
-
268
- $sg_subscribe_settings = get_settings('sg_subscribe_settings');
269
-
270
- $this->site_email = ( is_email($sg_subscribe_settings['email']) && $sg_subscribe_settings['email'] != 'email@example.com' ) ? $sg_subscribe_settings['email'] : get_bloginfo('admin_email');
271
- $this->site_name = ( $sg_subscribe_settings['name'] != 'YOUR NAME' && !empty($sg_subscribe_settings['name']) ) ? stripslashes($sg_subscribe_settings['name']) : get_bloginfo('name');
272
- $this->default_subscribed = ($sg_subscribe_settings['default_subscribed']) ? true : false;
273
-
274
- $this->not_subscribed_text = stripslashes($sg_subscribe_settings['not_subscribed_text']);
275
- $this->subscribed_text = stripslashes($sg_subscribe_settings['subscribed_text']);
276
- $this->author_text = stripslashes($sg_subscribe_settings['author_text']);
277
-
 
278
  $this->errors = '';
279
  $this->post_subscriptions = '';
280
  $this->email_subscriptions = '';
281
  }
282
 
283
-
284
  function manager_init() {
285
- $sg_subscribe_settings = get_settings('sg_subscribe_settings');
286
  $this->messages = '';
287
- $this->use_wp_style = ($sg_subscribe_settings['use_custom_style'] == 'use_custom_style') ? false : true;
288
  if( !$this->use_wp_style ) {
289
- $this->header = str_replace('[theme_path]', get_template_directory(), stripslashes($sg_subscribe_settings['header']));
290
- $this->sidebar = str_replace('[theme_path]', get_template_directory(), stripslashes($sg_subscribe_settings['sidebar']));
291
- $this->footer = str_replace('[theme_path]', get_template_directory(), stripslashes($sg_subscribe_settings['footer']));
292
- $this->before_manager = stripslashes($sg_subscribe_settings['before_manager']);
293
- $this->after_manager = stripslashes($sg_subscribe_settings['after_manager']);
294
- }
295
-
296
- // if ( !$this->standalone && $this->use_wp_style ) add_action('admin_head', create_function('$a', 'global $sg_subscribe; $sg_subscribe->sg_wp_head();'));
297
-
298
  foreach (array('email', 'key', 'ref', 'new_email') as $var) {
299
  if ( isset($_REQUEST[$var]) && !empty($_REQUEST[$var]) )
300
  $this->{$var} = trim($_REQUEST[$var]);
301
-
302
- }
303
  }
304
 
305
 
@@ -307,36 +306,36 @@ class sg_subscribe
307
  $this->errors[$type][] = $text;
308
  }
309
 
310
-
311
  function show_errors($type='manager', $before_all='<div class="updated updated-error">', $after_all='</div>', $before_each='<p>', $after_each='</p>'){
312
  if ( is_array($this->errors[$type]) ) {
313
  echo $before_all;
314
  foreach ($this->errors[$type] as $error) {
315
  echo $before_each . $error . $after_each;
316
- }
317
  echo $after_all;
318
  }
319
  unset($this->errors);
320
  }
321
-
322
-
323
  function add_message($text) {
324
- $this->messages[] = $text;
325
  }
326
-
327
-
328
  function show_messages($before_all='', $after_all='', $before_each='<div class="updated"><p>', $after_each='</p></div>'){
329
  if ( is_array($this->messages) ) {
330
  echo $before_all;
331
  foreach ($this->messages as $message) {
332
  echo $before_each . $message . $after_each;
333
- }
334
  echo $after_all;
335
  }
336
  unset($this->messages);
337
  }
338
 
339
-
340
  function subscriptions_from_post($postid) {
341
  if ( is_array($this->post_subscriptions) ) return $this->post_subscriptions;
342
  global $wpdb;
@@ -344,13 +343,13 @@ class sg_subscribe
344
  $this->post_subscriptions = $wpdb->get_results("SELECT comment_author_email FROM $wpdb->comments WHERE comment_post_ID = '$postid' AND comment_subscribe='Y' AND comment_author_email != '' AND comment_approved = '1' GROUP BY LCASE(comment_author_email)");
345
  $subscribed_without_comment = get_post_meta($postid, '_sg_subscribe-to-comments');
346
  if( is_array($subscribed_without_comment) ) {
347
- foreach ($subscribed_without_comment as $email)
348
- $this->post_subscriptions[]->comment_author_email = $email;
349
  }
350
  return $this->post_subscriptions;
351
  }
352
 
353
-
354
  function subscriptions_from_email($email='') {
355
  if ( is_array($this->email_subscriptions) ) return $this->email_subscriptions;
356
  if(!is_email($email)) $email = $this->email;
@@ -368,7 +367,7 @@ class sg_subscribe
368
  if ( is_array($subscriptions) ) {
369
  foreach ($subscriptions as $subscription) {
370
  $this->email_subscriptions[$i] = $subscription->post_id;
371
- $i++;
372
  }
373
  }
374
  if ($i > 0) {
@@ -378,7 +377,7 @@ class sg_subscribe
378
  // no subscriptions
379
  return false;
380
  }
381
-
382
 
383
  function solo_subscribe ($email, $postid) {
384
  global $wpdb, $cache_userdata, $user_email;
@@ -389,11 +388,11 @@ class sg_subscribe
389
  if ( is_email($user_email) )
390
  $email = strtolower($user_email);
391
  else
392
- $this->add_error(__('Please provide a valid e-mail address.', 'subscribe-to-comments'),'solo_subscribe');
393
  }
394
-
395
  if ( ( $email == $this->site_email && is_email($this->site_email) ) || ( $email == get_settings('admin_email') && is_email(get_settings('admin_email')) ) ) $this->add_error(__('This e-mail address may not be subscribed', 'subscribe-to-comments'),'solo_subscribe');
396
-
397
  if ( is_array($this->subscriptions_from_email($email)) )
398
  if (in_array($postid, $this->subscriptions_from_email($email))) {
399
  // already subscribed
@@ -402,35 +401,35 @@ class sg_subscribe
402
  }
403
  $email = $wpdb->escape($email);
404
  $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid' AND comment_status <> 'closed' AND ( post_status = 'static' OR post_status = 'publish') LIMIT 1");
405
-
406
  if(!$post) $this->add_error(__('Comments are not allowed on this entry.', 'subscribe-to-comments'),'solo_subscribe');
407
-
408
- if ( empty($cache_userdata[$post->post_author]) && $post->post_author != 0) {
409
- $cache_userdata[$post->post_author] = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = $post->post_author");
410
- $cache_userdata[$cache_userdata[$post->post_author]->user_login] =& $cache_userdata[$post->post_author];
411
- }
412
-
413
  $post_author = $cache_userdata[$post->post_author];
414
-
415
  if ( strtolower($post_author->user_email) == stripslashes($email) ) $this->add_error(__('You appear to be already subscribed to this entry.', 'subscribe-to-comments'),'solo_subscribe');
416
-
417
  if ( !is_array($this->errors['solo_subscribe']) ) {
418
  add_post_meta($postid, '_sg_subscribe-to-comments', stripslashes($email));
419
 
420
  setcookie('comment_author_email_' . COOKIEHASH, stripslashes($email), time() + 30000000, COOKIEPATH);
421
  $location = $this->manage_link(stripslashes($email), false, false) . '&subscribeid=' . $postid;
422
  header("Location: $location");
423
- exit();
424
  }
425
  }
426
-
427
-
428
  function add_subscriber($cid) {
429
  global $wpdb;
430
  $id = (int) $id;
431
  $email = $wpdb->escape(strtolower($wpdb->get_var("SELECT comment_author_email FROM $wpdb->comments WHERE comment_ID = '$cid'")));
432
  $postid = $wpdb->get_var("SELECT comment_post_ID from $wpdb->comments WHERE comment_ID = '$cid'");
433
-
434
  $previously_subscribed = ( $wpdb->get_var("SELECT comment_subscribe from $wpdb->comments WHERE comment_post_ID = '$postid' AND LCASE(comment_author_email) = '$email' AND comment_subscribe = 'Y' LIMIT 1") || in_array(stripslashes($email), get_post_meta($postid, '_sg_subscribe-to-comments')) ) ? true : false;
435
 
436
  // If user wants to be notified or has previously subscribed, set the flag on this current comment
@@ -441,7 +440,7 @@ class sg_subscribe
441
  return $cid;
442
  }
443
 
444
-
445
  function is_blocked($email='') {
446
  global $wpdb;
447
  if ( !is_email($email) ) $email = $this->email;
@@ -455,8 +454,8 @@ class sg_subscribe
455
  }
456
  return false;
457
  }
458
-
459
-
460
  function add_block($email='') {
461
  if ( !is_email($email) ) $email = $this->email;
462
  global $wpdb;
@@ -474,13 +473,13 @@ class sg_subscribe
474
  }
475
  return false;
476
  }
477
-
478
 
479
  function remove_block($email='') {
480
- if ( !is_email($email) ) $email = $this->email;
481
  global $wpdb;
482
  $email = strtolower($email);
483
-
484
  if ( $this->is_blocked($email) ) {
485
  // e-mail is in the list - so remove it
486
  $blocked = str_replace (' ' . $email, '', explode (' ', get_settings('do_not_mail')));
@@ -489,8 +488,35 @@ class sg_subscribe
489
  }
490
  return false;
491
  }
492
-
493
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
  function hidden_form_fields() { ?>
495
  <input type="hidden" name="ref" value="<?php echo $this->ref; ?>" />
496
  <input type="hidden" name="key" value="<?php echo $this->key; ?>" />
@@ -498,36 +524,41 @@ class sg_subscribe
498
  <?php
499
  }
500
 
501
-
 
 
 
 
 
 
 
 
502
  function validate_key() {
503
- global $user_level;
504
-
505
- if ( $this->key == md5($this->email . DB_PASSWORD) )
506
  $this->key_type = 'normal';
507
- elseif ( $this->key == md5($this->email . $this->new_email . DB_PASSWORD) )
508
  $this->key_type = 'change_email';
509
- elseif ( $this->key == md5($this->email . 'blockrequest' . DB_PASSWORD) )
510
  $this->key_type = 'block';
511
- elseif ( $user_level >= 8 )
512
  $this->key_type = 'admin';
513
  else
514
  return false;
515
-
516
  return true;
517
  }
518
-
519
-
520
  function determine_action() {
521
- global $user_level;
522
-
523
  // rather than check it a bunch of times
524
  $is_email = is_email($this->email);
525
-
526
  if ( is_email($this->new_email) && $is_email && $this->key_type == 'change_email' )
527
  $this->action = 'change_email';
528
  elseif ( isset($_POST['removesubscrips']) && $is_email )
529
  $this->action = 'remove_subscriptions';
530
- elseif ( isset($_POST['removeBlock']) && $is_email && $user_level >= 8 )
531
  $this->action = 'remove_block';
532
  elseif ( isset($_POST['changeemailrequest']) && $is_email && is_email($this->new_email) )
533
  $this->action = 'email_change_request';
@@ -535,19 +566,19 @@ class sg_subscribe
535
  $this->action = 'block_request';
536
  elseif ( isset($_GET['subscribeid']) )
537
  $this->action = 'solo_subscribe';
538
- elseif ( $is_email && isset($_GET['blockemailconfirm']) && $this->key == md5($this->email . 'blockrequest' . DB_PASSWORD) )
539
  $this->action = 'block';
540
  else
541
  $this->action = 'none';
542
-
543
  }
544
 
545
-
546
  function remove_subscriber($email, $postid) {
547
  global $wpdb;
548
  $postid = (int) $postid;
549
- $email = $wpdb->escape(strtolower($email));
550
-
551
  if ( delete_post_meta($postid, '_sg_subscribe-to-comments', stripslashes($email)) || $wpdb->query("UPDATE $wpdb->comments SET comment_subscribe = 'N' WHERE comment_post_ID = '$postid' AND LCASE(comment_author_email) ='$email'") )
552
  return true;
553
  else
@@ -557,7 +588,7 @@ class sg_subscribe
557
 
558
  function remove_subscriptions ($postids) {
559
  global $wpdb;
560
- $removed = 0;
561
  for ($i = 0; $i < count($postids); $i++) {
562
  if( $this->remove_subscriber($this->email, $postids[$i]) ) $removed++;
563
  }
@@ -570,10 +601,10 @@ class sg_subscribe
570
  $cid = (int) $cid;
571
  $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$cid' LIMIT 1");
572
  $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
573
-
574
  if ($comment->comment_approved == '1' && $comment->comment_type == '') {
575
  // Comment has been approved and isn't a trackback or a pingback, so we should send out notifications
576
-
577
  $message = sprintf(__("There is a new comment on the post \"%s\"", 'subscribe-to-comments') . ". \n%s\n\n", stripslashes($post->post_title), get_permalink($comment->comment_post_ID));
578
  $message .= sprintf(__("Author: %s\n", 'subscribe-to-comments'), $comment->comment_author);
579
  $message .= __("Comment:\n", 'subscribe-to-comments') . stripslashes($comment->comment_content) . "\n\n";
@@ -582,42 +613,42 @@ class sg_subscribe
582
  //add link to manage comment notifications
583
  $message .= __("To manage your subscriptions or to block all notifications from this site, click the link below:\n", 'subscribe-to-comments');
584
  $message .= get_settings('siteurl')."/wp-subscription-manager.php?email=[email]&key=[key]";
585
-
586
  $subject = sprintf(__('New Comment On: %s', 'subscribe-to-comments'), stripslashes($post->post_title));
587
-
588
  $subscriptions = $this->subscriptions_from_post($comment->comment_post_ID);
589
  if ( is_array($subscriptions) ) {
590
  foreach($subscriptions as $email) {
591
  if (!$this->is_blocked($email->comment_author_email) && $email->comment_author_email != $comment->comment_author_email && is_email($email->comment_author_email)) {
592
  $message_final = str_replace('[email]', $email->comment_author_email, $message);
593
- $message_final = str_replace('[key]', md5($email->comment_author_email . DB_PASSWORD), $message_final);
594
  $this->send_mail($email->comment_author_email, $subject, $message_final);
595
- }
596
  } // foreach subscription
597
  } // if subscriptions
598
  } // end if comment approved
599
  return $cid;
600
  }
601
-
602
 
603
  function change_email_request() {
604
  if ( $this->is_blocked() ) return false;
605
-
606
  $subject = __('E-mail change confirmation', 'subscribe-to-comments');
607
  $message = sprintf(__("You are receiving this message to confirm a change of e-mail address for your subscriptions at \"%s\"\n\n", 'subscribe-to-comments'), get_bloginfo('blogname'));
608
  $message .= sprintf(__("To change your e-mail address to %s, click this link:\n\n", 'subscribe-to-comments'), $this->new_email);
609
- $message .= get_bloginfo('wpurl') . "/wp-subscription-manager.php?email=" . $this->email . "&new_email=" . $this->new_email . "&key=" . md5($this->email . $this->new_email . DB_PASSWORD) . ".\n\n";
610
  $message .= __('If you did not request this action, please disregard this message.', 'subscribe-to-comments');
611
  return $this->send_mail($this->email, $subject, $message);
612
  }
613
 
614
-
615
  function block_email_request($email) {
616
  if($this->is_blocked($email)) return false;
617
  $subject = __('E-mail block confirmation', 'subscribe-to-comments');
618
  $message = sprintf(__("You are receiving this message to confirm that you no longer wish to receive e-mail comment notifications from \"%s\"\n\n", 'subscribe-to-comments'), get_bloginfo('name'));
619
  $message .= __("To cancel all future notifications for this address, click this link:\n\n", 'subscribe-to-comments');
620
- $message .= get_bloginfo('wpurl') . "/wp-subscription-manager.php?email=" . $email . "&key=" . md5($email . 'blockrequest' . DB_PASSWORD) . "&blockemailconfirm=true" . ".\n\n";
621
  $message .= __("If you did not request this action, please disregard this message.", 'subscribe-to-comments');
622
  return $this->send_mail($email, $subject, $message);
623
  }
@@ -627,10 +658,10 @@ class sg_subscribe
627
  $subject = '[' . get_bloginfo('name') . '] ' . $subject;
628
  $headers = "From: ".$this->site_name." <".$this->site_email.">\n";
629
  $headers .= "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
630
- return mail ($to, $subject, $message, $headers);
631
  }
632
 
633
-
634
  function change_email() {
635
  global $wpdb;
636
  $new_email = $wpdb->escape(strtolower($this->new_email));
@@ -639,11 +670,11 @@ class sg_subscribe
639
  $return = true;
640
  if ( $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$new_email' WHERE meta_value = '$email' AND meta_key = '_sg_subscribe-to-comments'") )
641
  $return = true;
642
-
643
  return $return;
644
  }
645
-
646
-
647
  function entry_link($postid, $uri='') {
648
  if ( empty($uri) ) $uri = get_permalink($postid);
649
  $postid = (int) $postid;
@@ -651,7 +682,7 @@ class sg_subscribe
651
  if ( empty($title) ) $title = __('click here', 'subscribe-to-comments');
652
  $output = '<a href="'.$uri.'">'.$title.'</a>';
653
  return $output;
654
- }
655
 
656
 
657
  function sg_wp_head() { ?>
@@ -668,25 +699,31 @@ class sg_subscribe
668
 
669
  function db_upgrade_check () {
670
  global $wpdb;
671
-
672
  // add the options
673
  add_option('sg_subscribe_settings', array('use_custom_style' => '', 'email' => get_bloginfo('admin_email'), 'name' => get_bloginfo('name'), 'header' => '[theme_path]/header.php', 'sidebar' => '', 'footer' => '[theme_path]/footer.php', 'before_manager' => '<div id="content" class="widecolumn subscription-manager">', 'after_manager' => '</div>', 'default_subscribed' => '', 'not_subscribed_text' => __('Notify me of followup comments via e-mail', 'subscribe-to-comments'), 'subscribed_text' => __('You are subscribed to this entry. <a href="[manager_link]">Manage your subscriptions</a>.', 'subscribe-to-comments'), 'author_text' => __('You are the author of this entry. <a href="[manager_link]">Manage subscriptions</a>.', 'subscribe-to-comments')));
674
-
 
 
 
 
 
 
675
  $column_name = 'comment_subscribe';
676
  foreach ($wpdb->get_col("DESC $wpdb->comments", 0) as $column )
677
  if ($column == $column_name) return true;
678
-
679
  // didn't find it... create it
680
  $wpdb->query("ALTER TABLE $wpdb->comments ADD COLUMN comment_subscribe enum('Y','N') NOT NULL default 'N'");
681
  }
682
-
683
-
684
  function current_viewer_subscription_status(){
685
  global $wpdb, $post, $user_email;
686
-
687
  $comment_author_email = (isset($_COOKIE['comment_author_email_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_email_'. COOKIEHASH]) : '';
688
  get_currentuserinfo();
689
-
690
  if(is_email($user_email)) {
691
  $email = strtolower($user_email);
692
  $loggedin = true;
@@ -697,37 +734,40 @@ class sg_subscribe
697
  }
698
 
699
  $post_author = get_userdata($post->post_author);
700
- if (strtolower($post_author->user_email) == $email && $loggedin) return 'admin';
701
-
 
702
  if ( is_array($this->subscriptions_from_email($email)) )
703
  if ( in_array($post->ID, $this->email_subscriptions) ) return $email;
704
  return false;
705
  }
706
-
707
-
708
  function manage_link($email='', $html=true, $echo=true) {
709
- $link = get_bloginfo('wpurl') . '/wp-subscription-manager.php?';
710
- if ($html) $amp = 'amp;';
711
- if($email != 'admin')
712
- $link .= 'email=' . $email . '&' . $amp . 'key=' . md5($email . DB_PASSWORD);
713
- $link .= '&' . $amp . 'ref=http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
714
-
715
- if ($echo)
716
- echo $link;
717
- else
718
- return $link;
 
 
719
  }
720
-
721
-
722
  function add_admin_menu() {
723
  add_management_page(__('Comment Subscription Manager', 'subscribe-to-comments'), __('Subscriptions', 'subscribe-to-comments'), 8, __FILE__, 'sg_subscribe_admin');
724
-
725
  if(class_exists('SmallOptions'))
726
  add_action('small_options_page', array('sg_subscribe_settings', 'options_page_contents'));
727
  else
728
  add_options_page(__('Subscribe to Comments', 'subscribe-to-comments'), __('Subscribe to Comments', 'subscribe-to-comments'), 5, basename(__FILE__), array('sg_subscribe_settings', 'options_page'));
729
- }
730
-
731
 
732
  } // class sg_subscribe
733
 
@@ -738,7 +778,7 @@ class sg_subscribe
738
 
739
  function sg_subscribe_start() {
740
  global $sg_subscribe;
741
-
742
  if (!$sg_subscribe) {
743
  load_plugin_textdomain('subscribe-to-comments');
744
  $sg_subscribe = new sg_subscribe();
@@ -755,7 +795,7 @@ function sg_subscribe_admin() {
755
  add_action('comment_form', 'show_subscription_checkbox');
756
 
757
  // priority is very low (50) because we want to let anti-spam plugins have their way first.
758
- add_action('comment_post', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->send_notifications($a);'), 50);
759
  add_action('comment_post', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->add_subscriber($a);'));
760
 
761
  add_action('wp_set_comment_status', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->send_notifications($a);'));
1
  <?php
2
  /*
3
  Plugin Name: Subscribe To Comments
4
+ Version: 2.0.4
5
+ Plugin URI: http://txfx.net/code/wordpress/subscribe-to-comments/
6
  Description: Allows readers to recieve notifications of new comments that are posted to an entry
7
  Author: Mark Jaquith and Jennifer (ScriptyGoddess)
8
  Author URI: http://scriptygoddess.com/
40
 
41
  <?php /* ------------------------------------------------------------------- */ ?>
42
 
43
+ <?php elseif ( $email == 'admin' && current_user_can('manage_options') ) : ?>
44
 
45
  <?php /* ------------------------------------------------------------- */ ?>
46
  <?php /* This is the text that is displayed for the author of the post */ ?>
51
  </p>
52
 
53
  <?php else : ?>
54
+
55
  <?php /* --------------------------------------------------------------- */ ?>
56
  <?php /* This is the text that is displayed for users who ARE subscribed */ ?>
57
  <?php /* --------------------------------------------------------------- */ ?>
59
  <p style="clear: both;" class="subscribe-to-comments">
60
  <?php echo str_replace('[manager_link]', $sg_subscribe->manage_link($email, true, false), $sg_subscribe->subscribed_text); ?>
61
  </p>
62
+
63
  <?php /* --------------------------------------------------------------- */ ?>
64
+
65
+ <?php endif;
66
 
67
  $sg_subscribe->checkbox_shown = true;
68
+ return $id;
69
  }
70
 
71
 
80
  sg_subscribe_start();
81
  $sg_subscribe->show_errors('solo_subscribe', '<div class="solo-subscribe-errors">', '</div>', __('<strong>Error: </strong>', 'subscribe-to-comments'), '<br />');
82
 
83
+ if ( !$sg_subscribe->current_viewer_subscription_status() ) :
84
  get_currentuserinfo(); ?>
85
 
86
  <?php /* ------------------------------------------------------------------- */ ?>
91
  <input type="hidden" name="solo-comment-subscribe" value="solo-comment-subscribe" />
92
  <input type="hidden" name="postid" value="<?php echo $id; ?>" />
93
  <input type="hidden" name="ref" value="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>" />
94
+
95
  <p class="solo-subscribe-to-comments">
96
  <?php _e('Subscribe without commenting', 'subscribe-to-comments'); ?>
97
  <br />
98
+ <label for="solo-subscribe-email"><?php _e('E-Mail:', 'subscribe-to-comments'); ?>
99
  <input type="text" name="email" id="solo-subscribe-email" size="22" value="<?php echo $user_email; ?>" /></label>
100
  <input type="submit" name="submit" value="<?php _e('Subscribe', 'subscribe-to-comments'); ?>" />
101
  </p>
103
 
104
  <?php /* ------------------------------------------------------------------- */ ?>
105
 
106
+ <?php endif;
107
  }
108
 
109
 
118
  return true;
119
  } else {
120
  return false;
121
+ }
122
  }
123
 
124
 
138
  if($_SERVER['REQUEST_METHOD'] == 'POST')
139
  {
140
  update_option('sg_subscribe_settings', $_POST['sg_subscribe_settings']);
 
141
  }
142
  echo '<h2>Subscribe to Comments Options</h2>';
143
  echo '<ul>';
146
  echo '<li><label for="email">' . __('"From" e-mail addresss for notifications:', 'subscribe-to-comments') . ' <input type="text" size="40" id="email" name="sg_subscribe_settings[email]" value="' . sg_subscribe_settings::form_setting('email') . '" /></label></li>';
147
  echo '<li><label for="default_subscribed"><input type="checkbox" id="default_subscribed" name="sg_subscribe_settings[default_subscribed]" value="default_subscribed"' . sg_subscribe_settings::checkflag('default_subscribed') . ' /> ' . __('"Subscribe" box should be checked by default', 'subscribe-to-comments') . '</label></li>';
148
  echo '</ul>';
149
+
150
  echo '<fieldset><legend>' . __('Comment Form Text', 'subscribe-to-comments') . '</legend>';
151
+
152
  echo '<p>' . __('Customize the messages shown to different people. Use <code>[manager_link]</code> to insert the URI to the Subscription Manager.', 'subscribe-to-comments') . '</p>';
153
+
154
  echo '<ul>';
155
+
156
  echo '<li><label for="not_subscribed_text">' . __('Not subscribed', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="not_subscribed_text" name="sg_subscribe_settings[not_subscribed_text]">' . sg_subscribe_settings::textarea_setting('not_subscribed_text') . '</textarea></li>';
157
+
158
  echo '<li><label for="subscribed_text">' . __('Subscribed', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="subscribed_text" name="sg_subscribe_settings[subscribed_text]">' . sg_subscribe_settings::textarea_setting('subscribed_text') . '</textarea></li>';
159
+
160
  echo '<li><label for="author_text">' . __('Entry Author', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="author_text" name="sg_subscribe_settings[author_text]">' . sg_subscribe_settings::textarea_setting('author_text') . '</textarea></li>';
161
+
162
  echo '</ul></fieldset>';
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ echo '<fieldset>';
172
  echo '<legend><input type="checkbox" id="use_custom_style" name="sg_subscribe_settings[use_custom_style]" value="use_custom_style"' . sg_subscribe_settings::checkflag('use_custom_style') . ' /> <label for="use_custom_style">' . __('Use custom style for Subscription Manager', 'subscribe-to-comments') . '</label></legend>';
173
 
174
  echo '<p>' . __('These settings only matter if you are using a custom style. <code>[theme_path]</code> will be replaced with the path to your current theme.', 'subscribe-to-comments') . '</p>';
175
+
176
  echo '<ul>';
177
  echo '<li><label for="sg_sub_header">' . __('Path to header:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_header" name="sg_subscribe_settings[header]" value="' . sg_subscribe_settings::form_setting('header') . '" /></label></li>';
178
  echo '<li><label for="sg_sub_sidebar">' . __('Path to sidebar:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_sidebar" name="sg_subscribe_settings[sidebar]" value="' . sg_subscribe_settings::form_setting('sidebar') . '" /></label></li>';
179
  echo '<li><label for="sg_sub_footer">' . __('Path to footer:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_footer" name="sg_subscribe_settings[footer]" value="' . sg_subscribe_settings::form_setting('footer') . '" /></label></li>';
180
+
181
 
182
  echo '<li><label for="before_manager">' . __('HTML for before the subscription manager:', 'subscribe-to-comments') . ' </label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="before_manager" name="sg_subscribe_settings[before_manager]">' . sg_subscribe_settings::textarea_setting('before_manager') . '</textarea></li>';
183
  echo '<li><label for="after_manager">' . __('HTML for after the subscription manager:', 'subscribe-to-comments') . ' </label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="after_manager" name="sg_subscribe_settings[after_manager]">' . sg_subscribe_settings::textarea_setting('after_manager') . '</textarea></li>';
184
  echo '</ul>';
185
  echo '</fieldset>';
186
  }
187
+
188
  function checkflag($optname)
189
  {
190
  $options = get_settings('sg_subscribe_settings');
191
  if($options[$optname] != $optname) return '';
192
  return ' checked="checked"';
193
  }
194
+
195
  function form_setting($optname)
196
  {
197
  $options = get_settings('sg_subscribe_settings');
198
  return htmlspecialchars(stripslashes($options[$optname]), ENT_QUOTES);
199
  }
200
+
201
  function textarea_setting($optname)
202
  {
203
  $options = get_settings('sg_subscribe_settings');
213
  }
214
 
215
  echo '<form method="post"><div class="wrap">';
216
+
217
  sg_subscribe_settings::options_page_contents();
218
+
219
  echo '<p class="submit"><input type="submit" name="sg_subscribe_settings_submit" value="';
220
  _e('Update Options &raquo;', 'subscribe-to-comments');
221
  echo '" /></p></div>';
254
  var $key;
255
  var $key_type;
256
  var $action;
257
+ var $default_subscribed;
258
  var $not_subscribed_text;
259
  var $subscribed_text;
260
  var $author_text;
261
+ var $salt;
262
+ var $settings;
263
+
264
 
265
  function sg_subscribe() {
266
  global $wpdb;
267
  $this->db_upgrade_check();
268
+
269
+ $this->settings = get_settings('sg_subscribe_settings');
270
+
271
+ $this->salt = $this->settings['salt'];
272
+ $this->site_email = ( is_email($this->settings['email']) && $this->settings['email'] != 'email@example.com' ) ? $this->settings['email'] : get_bloginfo('admin_email');
273
+ $this->site_name = ( $this->settings['name'] != 'YOUR NAME' && !empty($this->settings['name']) ) ? stripslashes($this->settings['name']) : get_bloginfo('name');
274
+ $this->default_subscribed = ($this->settings['default_subscribed']) ? true : false;
275
+
276
+ $this->not_subscribed_text = stripslashes($this->settings['not_subscribed_text']);
277
+ $this->subscribed_text = stripslashes($this->settings['subscribed_text']);
278
+ $this->author_text = stripslashes($this->settings['author_text']);
279
+
280
  $this->errors = '';
281
  $this->post_subscriptions = '';
282
  $this->email_subscriptions = '';
283
  }
284
 
285
+
286
  function manager_init() {
 
287
  $this->messages = '';
288
+ $this->use_wp_style = ($this->settings['use_custom_style'] == 'use_custom_style') ? false : true;
289
  if( !$this->use_wp_style ) {
290
+ $this->header = str_replace('[theme_path]', get_template_directory(), stripslashes($this->settings['header']));
291
+ $this->sidebar = str_replace('[theme_path]', get_template_directory(), stripslashes($this->settings['sidebar']));
292
+ $this->footer = str_replace('[theme_path]', get_template_directory(), stripslashes($this->settings['footer']));
293
+ $this->before_manager = stripslashes($this->settings['before_manager']);
294
+ $this->after_manager = stripslashes($this->settings['after_manager']);
295
+ }
296
+
 
 
297
  foreach (array('email', 'key', 'ref', 'new_email') as $var) {
298
  if ( isset($_REQUEST[$var]) && !empty($_REQUEST[$var]) )
299
  $this->{$var} = trim($_REQUEST[$var]);
300
+
301
+ }
302
  }
303
 
304
 
306
  $this->errors[$type][] = $text;
307
  }
308
 
309
+
310
  function show_errors($type='manager', $before_all='<div class="updated updated-error">', $after_all='</div>', $before_each='<p>', $after_each='</p>'){
311
  if ( is_array($this->errors[$type]) ) {
312
  echo $before_all;
313
  foreach ($this->errors[$type] as $error) {
314
  echo $before_each . $error . $after_each;
315
+ }
316
  echo $after_all;
317
  }
318
  unset($this->errors);
319
  }
320
+
321
+
322
  function add_message($text) {
323
+ $this->messages[] = $text;
324
  }
325
+
326
+
327
  function show_messages($before_all='', $after_all='', $before_each='<div class="updated"><p>', $after_each='</p></div>'){
328
  if ( is_array($this->messages) ) {
329
  echo $before_all;
330
  foreach ($this->messages as $message) {
331
  echo $before_each . $message . $after_each;
332
+ }
333
  echo $after_all;
334
  }
335
  unset($this->messages);
336
  }
337
 
338
+
339
  function subscriptions_from_post($postid) {
340
  if ( is_array($this->post_subscriptions) ) return $this->post_subscriptions;
341
  global $wpdb;
343
  $this->post_subscriptions = $wpdb->get_results("SELECT comment_author_email FROM $wpdb->comments WHERE comment_post_ID = '$postid' AND comment_subscribe='Y' AND comment_author_email != '' AND comment_approved = '1' GROUP BY LCASE(comment_author_email)");
344
  $subscribed_without_comment = get_post_meta($postid, '_sg_subscribe-to-comments');
345
  if( is_array($subscribed_without_comment) ) {
346
+ foreach ($subscribed_without_comment as $email)
347
+ $this->post_subscriptions[]->comment_author_email = $email;
348
  }
349
  return $this->post_subscriptions;
350
  }
351
 
352
+
353
  function subscriptions_from_email($email='') {
354
  if ( is_array($this->email_subscriptions) ) return $this->email_subscriptions;
355
  if(!is_email($email)) $email = $this->email;
367
  if ( is_array($subscriptions) ) {
368
  foreach ($subscriptions as $subscription) {
369
  $this->email_subscriptions[$i] = $subscription->post_id;
370
+ $i++;
371
  }
372
  }
373
  if ($i > 0) {
377
  // no subscriptions
378
  return false;
379
  }
380
+
381
 
382
  function solo_subscribe ($email, $postid) {
383
  global $wpdb, $cache_userdata, $user_email;
388
  if ( is_email($user_email) )
389
  $email = strtolower($user_email);
390
  else
391
+ $this->add_error(__('Please provide a valid e-mail address.', 'subscribe-to-comments'),'solo_subscribe');
392
  }
393
+
394
  if ( ( $email == $this->site_email && is_email($this->site_email) ) || ( $email == get_settings('admin_email') && is_email(get_settings('admin_email')) ) ) $this->add_error(__('This e-mail address may not be subscribed', 'subscribe-to-comments'),'solo_subscribe');
395
+
396
  if ( is_array($this->subscriptions_from_email($email)) )
397
  if (in_array($postid, $this->subscriptions_from_email($email))) {
398
  // already subscribed
401
  }
402
  $email = $wpdb->escape($email);
403
  $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid' AND comment_status <> 'closed' AND ( post_status = 'static' OR post_status = 'publish') LIMIT 1");
404
+
405
  if(!$post) $this->add_error(__('Comments are not allowed on this entry.', 'subscribe-to-comments'),'solo_subscribe');
406
+
407
+ if ( empty($cache_userdata[$post->post_author]) && $post->post_author != 0) {
408
+ $cache_userdata[$post->post_author] = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = $post->post_author");
409
+ $cache_userdata[$cache_userdata[$post->post_author]->user_login] =& $cache_userdata[$post->post_author];
410
+ }
411
+
412
  $post_author = $cache_userdata[$post->post_author];
413
+
414
  if ( strtolower($post_author->user_email) == stripslashes($email) ) $this->add_error(__('You appear to be already subscribed to this entry.', 'subscribe-to-comments'),'solo_subscribe');
415
+
416
  if ( !is_array($this->errors['solo_subscribe']) ) {
417
  add_post_meta($postid, '_sg_subscribe-to-comments', stripslashes($email));
418
 
419
  setcookie('comment_author_email_' . COOKIEHASH, stripslashes($email), time() + 30000000, COOKIEPATH);
420
  $location = $this->manage_link(stripslashes($email), false, false) . '&subscribeid=' . $postid;
421
  header("Location: $location");
422
+ exit();
423
  }
424
  }
425
+
426
+
427
  function add_subscriber($cid) {
428
  global $wpdb;
429
  $id = (int) $id;
430
  $email = $wpdb->escape(strtolower($wpdb->get_var("SELECT comment_author_email FROM $wpdb->comments WHERE comment_ID = '$cid'")));
431
  $postid = $wpdb->get_var("SELECT comment_post_ID from $wpdb->comments WHERE comment_ID = '$cid'");
432
+
433
  $previously_subscribed = ( $wpdb->get_var("SELECT comment_subscribe from $wpdb->comments WHERE comment_post_ID = '$postid' AND LCASE(comment_author_email) = '$email' AND comment_subscribe = 'Y' LIMIT 1") || in_array(stripslashes($email), get_post_meta($postid, '_sg_subscribe-to-comments')) ) ? true : false;
434
 
435
  // If user wants to be notified or has previously subscribed, set the flag on this current comment
440
  return $cid;
441
  }
442
 
443
+
444
  function is_blocked($email='') {
445
  global $wpdb;
446
  if ( !is_email($email) ) $email = $this->email;
454
  }
455
  return false;
456
  }
457
+
458
+
459
  function add_block($email='') {
460
  if ( !is_email($email) ) $email = $this->email;
461
  global $wpdb;
473
  }
474
  return false;
475
  }
476
+
477
 
478
  function remove_block($email='') {
479
+ if ( !is_email($email) ) $email = $this->email;
480
  global $wpdb;
481
  $email = strtolower($email);
482
+
483
  if ( $this->is_blocked($email) ) {
484
  // e-mail is in the list - so remove it
485
  $blocked = str_replace (' ' . $email, '', explode (' ', get_settings('do_not_mail')));
488
  }
489
  return false;
490
  }
491
+
492
+
493
+ function has_subscribers() {
494
+ if ( count($this->get_unique_subscribers()) > 0 )
495
+ return true;
496
+ return false;
497
+ }
498
+
499
+
500
+ function get_unique_subscribers() {
501
+ global $comments, $comment, $sg_subscribers;
502
+ if ( isset($sg_subscribers) )
503
+ return $sg_subscribers;
504
+
505
+ $sg_subscribers = array();
506
+ $subscriber_emails = array();
507
+
508
+ // We run the comment loop, and put each unique subscriber into a new array
509
+ foreach ( $comments as $comment ) {
510
+ if ( comment_subscription_status() && !in_array($comment->comment_author_email, $subscriber_emails) ) {
511
+ $sg_subscribers[] = $comment;
512
+ $subscriber_emails[] = $comment->comment_author_email;
513
+ }
514
+ }
515
+
516
+ return $sg_subscribers;
517
+ }
518
+
519
+
520
  function hidden_form_fields() { ?>
521
  <input type="hidden" name="ref" value="<?php echo $this->ref; ?>" />
522
  <input type="hidden" name="key" value="<?php echo $this->key; ?>" />
524
  <?php
525
  }
526
 
527
+
528
+ function generate_key($data='') {
529
+ if ( '' == $data )
530
+ return false;
531
+ if ( !$this->settings['salt'] )
532
+ die('fatal error: corrupted salt');
533
+ return md5(md5($this->settings['salt'] . $data));
534
+ }
535
+
536
  function validate_key() {
537
+ if ( $this->key == $this->generate_key($this->email) )
 
 
538
  $this->key_type = 'normal';
539
+ elseif ( $this->key == $this->generate_key($this->email . $this->new_email) )
540
  $this->key_type = 'change_email';
541
+ elseif ( $this->key == $this->generate_key($this->email . 'blockrequest') )
542
  $this->key_type = 'block';
543
+ elseif ( current_user_can('manage_options') )
544
  $this->key_type = 'admin';
545
  else
546
  return false;
547
+
548
  return true;
549
  }
550
+
551
+
552
  function determine_action() {
553
+
 
554
  // rather than check it a bunch of times
555
  $is_email = is_email($this->email);
556
+
557
  if ( is_email($this->new_email) && $is_email && $this->key_type == 'change_email' )
558
  $this->action = 'change_email';
559
  elseif ( isset($_POST['removesubscrips']) && $is_email )
560
  $this->action = 'remove_subscriptions';
561
+ elseif ( isset($_POST['removeBlock']) && $is_email && current_user_can('manage_options') )
562
  $this->action = 'remove_block';
563
  elseif ( isset($_POST['changeemailrequest']) && $is_email && is_email($this->new_email) )
564
  $this->action = 'email_change_request';
566
  $this->action = 'block_request';
567
  elseif ( isset($_GET['subscribeid']) )
568
  $this->action = 'solo_subscribe';
569
+ elseif ( $is_email && isset($_GET['blockemailconfirm']) && $this->key == $this->generate_key($this->email . 'blockrequest') )
570
  $this->action = 'block';
571
  else
572
  $this->action = 'none';
573
+
574
  }
575
 
576
+
577
  function remove_subscriber($email, $postid) {
578
  global $wpdb;
579
  $postid = (int) $postid;
580
+ $email = $wpdb->escape(strtolower($email));
581
+
582
  if ( delete_post_meta($postid, '_sg_subscribe-to-comments', stripslashes($email)) || $wpdb->query("UPDATE $wpdb->comments SET comment_subscribe = 'N' WHERE comment_post_ID = '$postid' AND LCASE(comment_author_email) ='$email'") )
583
  return true;
584
  else
588
 
589
  function remove_subscriptions ($postids) {
590
  global $wpdb;
591
+ $removed = 0;
592
  for ($i = 0; $i < count($postids); $i++) {
593
  if( $this->remove_subscriber($this->email, $postids[$i]) ) $removed++;
594
  }
601
  $cid = (int) $cid;
602
  $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$cid' LIMIT 1");
603
  $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
604
+
605
  if ($comment->comment_approved == '1' && $comment->comment_type == '') {
606
  // Comment has been approved and isn't a trackback or a pingback, so we should send out notifications
607
+
608
  $message = sprintf(__("There is a new comment on the post \"%s\"", 'subscribe-to-comments') . ". \n%s\n\n", stripslashes($post->post_title), get_permalink($comment->comment_post_ID));
609
  $message .= sprintf(__("Author: %s\n", 'subscribe-to-comments'), $comment->comment_author);
610
  $message .= __("Comment:\n", 'subscribe-to-comments') . stripslashes($comment->comment_content) . "\n\n";
613
  //add link to manage comment notifications
614
  $message .= __("To manage your subscriptions or to block all notifications from this site, click the link below:\n", 'subscribe-to-comments');
615
  $message .= get_settings('siteurl')."/wp-subscription-manager.php?email=[email]&key=[key]";
616
+
617
  $subject = sprintf(__('New Comment On: %s', 'subscribe-to-comments'), stripslashes($post->post_title));
618
+
619
  $subscriptions = $this->subscriptions_from_post($comment->comment_post_ID);
620
  if ( is_array($subscriptions) ) {
621
  foreach($subscriptions as $email) {
622
  if (!$this->is_blocked($email->comment_author_email) && $email->comment_author_email != $comment->comment_author_email && is_email($email->comment_author_email)) {
623
  $message_final = str_replace('[email]', $email->comment_author_email, $message);
624
+ $message_final = str_replace('[key]', $this->generate_key($email->comment_author_email), $message_final);
625
  $this->send_mail($email->comment_author_email, $subject, $message_final);
626
+ }
627
  } // foreach subscription
628
  } // if subscriptions
629
  } // end if comment approved
630
  return $cid;
631
  }
632
+
633
 
634
  function change_email_request() {
635
  if ( $this->is_blocked() ) return false;
636
+
637
  $subject = __('E-mail change confirmation', 'subscribe-to-comments');
638
  $message = sprintf(__("You are receiving this message to confirm a change of e-mail address for your subscriptions at \"%s\"\n\n", 'subscribe-to-comments'), get_bloginfo('blogname'));
639
  $message .= sprintf(__("To change your e-mail address to %s, click this link:\n\n", 'subscribe-to-comments'), $this->new_email);
640
+ $message .= get_bloginfo('wpurl') . "/wp-subscription-manager.php?email=" . $this->email . "&new_email=" . $this->new_email . "&key=" . $this->generate_key($this->email . $this->new_email) . ".\n\n";
641
  $message .= __('If you did not request this action, please disregard this message.', 'subscribe-to-comments');
642
  return $this->send_mail($this->email, $subject, $message);
643
  }
644
 
645
+
646
  function block_email_request($email) {
647
  if($this->is_blocked($email)) return false;
648
  $subject = __('E-mail block confirmation', 'subscribe-to-comments');
649
  $message = sprintf(__("You are receiving this message to confirm that you no longer wish to receive e-mail comment notifications from \"%s\"\n\n", 'subscribe-to-comments'), get_bloginfo('name'));
650
  $message .= __("To cancel all future notifications for this address, click this link:\n\n", 'subscribe-to-comments');
651
+ $message .= get_bloginfo('wpurl') . "/wp-subscription-manager.php?email=" . $email . "&key=" . $this->generate_key($email . 'blockrequest') . "&blockemailconfirm=true" . ".\n\n";
652
  $message .= __("If you did not request this action, please disregard this message.", 'subscribe-to-comments');
653
  return $this->send_mail($email, $subject, $message);
654
  }
658
  $subject = '[' . get_bloginfo('name') . '] ' . $subject;
659
  $headers = "From: ".$this->site_name." <".$this->site_email.">\n";
660
  $headers .= "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
661
+ return wp_mail($to, $subject, $message, $headers);
662
  }
663
 
664
+
665
  function change_email() {
666
  global $wpdb;
667
  $new_email = $wpdb->escape(strtolower($this->new_email));
670
  $return = true;
671
  if ( $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$new_email' WHERE meta_value = '$email' AND meta_key = '_sg_subscribe-to-comments'") )
672
  $return = true;
673
+
674
  return $return;
675
  }
676
+
677
+
678
  function entry_link($postid, $uri='') {
679
  if ( empty($uri) ) $uri = get_permalink($postid);
680
  $postid = (int) $postid;
682
  if ( empty($title) ) $title = __('click here', 'subscribe-to-comments');
683
  $output = '<a href="'.$uri.'">'.$title.'</a>';
684
  return $output;
685
+ }
686
 
687
 
688
  function sg_wp_head() { ?>
699
 
700
  function db_upgrade_check () {
701
  global $wpdb;
702
+
703
  // add the options
704
  add_option('sg_subscribe_settings', array('use_custom_style' => '', 'email' => get_bloginfo('admin_email'), 'name' => get_bloginfo('name'), 'header' => '[theme_path]/header.php', 'sidebar' => '', 'footer' => '[theme_path]/footer.php', 'before_manager' => '<div id="content" class="widecolumn subscription-manager">', 'after_manager' => '</div>', 'default_subscribed' => '', 'not_subscribed_text' => __('Notify me of followup comments via e-mail', 'subscribe-to-comments'), 'subscribed_text' => __('You are subscribed to this entry. <a href="[manager_link]">Manage your subscriptions</a>.', 'subscribe-to-comments'), 'author_text' => __('You are the author of this entry. <a href="[manager_link]">Manage subscriptions</a>.', 'subscribe-to-comments')));
705
+
706
+ $settings = get_option('sg_subscribe_settings');
707
+ if ( !$settings['salt'] ) {
708
+ $settings['salt'] = md5(md5(uniqid(rand() . rand() . rand() . rand() . rand(), true))); // random MD5 hash
709
+ update_option('sg_subscribe_settings', $settings);
710
+ }
711
+
712
  $column_name = 'comment_subscribe';
713
  foreach ($wpdb->get_col("DESC $wpdb->comments", 0) as $column )
714
  if ($column == $column_name) return true;
715
+
716
  // didn't find it... create it
717
  $wpdb->query("ALTER TABLE $wpdb->comments ADD COLUMN comment_subscribe enum('Y','N') NOT NULL default 'N'");
718
  }
719
+
720
+
721
  function current_viewer_subscription_status(){
722
  global $wpdb, $post, $user_email;
723
+
724
  $comment_author_email = (isset($_COOKIE['comment_author_email_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_email_'. COOKIEHASH]) : '';
725
  get_currentuserinfo();
726
+
727
  if(is_email($user_email)) {
728
  $email = strtolower($user_email);
729
  $loggedin = true;
734
  }
735
 
736
  $post_author = get_userdata($post->post_author);
737
+ if (strtolower($post_author->user_email) == $email && $loggedin ) return 'admin';
738
+
739
+
740
  if ( is_array($this->subscriptions_from_email($email)) )
741
  if ( in_array($post->ID, $this->email_subscriptions) ) return $email;
742
  return false;
743
  }
744
+
745
+
746
  function manage_link($email='', $html=true, $echo=true) {
747
+ $link = get_bloginfo('wpurl') . '/wp-subscription-manager.php';
748
+ // if ($html) $amp = 'amp;';
749
+ if($email != 'admin') {
750
+ $link = add_query_arg('email', $email, $link);
751
+ $link = add_query_arg('key', $this->generate_key($email), $link);
752
+ }
753
+ $link = add_query_arg('ref', urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), $link);
754
+ if ( $html )
755
+ $link = htmlentities($link);
756
+ if ( !$echo )
757
+ return $link;
758
+ echo $link;
759
  }
760
+
761
+
762
  function add_admin_menu() {
763
  add_management_page(__('Comment Subscription Manager', 'subscribe-to-comments'), __('Subscriptions', 'subscribe-to-comments'), 8, __FILE__, 'sg_subscribe_admin');
764
+
765
  if(class_exists('SmallOptions'))
766
  add_action('small_options_page', array('sg_subscribe_settings', 'options_page_contents'));
767
  else
768
  add_options_page(__('Subscribe to Comments', 'subscribe-to-comments'), __('Subscribe to Comments', 'subscribe-to-comments'), 5, basename(__FILE__), array('sg_subscribe_settings', 'options_page'));
769
+ }
770
+
771
 
772
  } // class sg_subscribe
773
 
778
 
779
  function sg_subscribe_start() {
780
  global $sg_subscribe;
781
+
782
  if (!$sg_subscribe) {
783
  load_plugin_textdomain('subscribe-to-comments');
784
  $sg_subscribe = new sg_subscribe();
795
  add_action('comment_form', 'show_subscription_checkbox');
796
 
797
  // priority is very low (50) because we want to let anti-spam plugins have their way first.
798
+ add_action('comment_post', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->send_notifications($a);'), 50);
799
  add_action('comment_post', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->add_subscriber($a);'));
800
 
801
  add_action('wp_set_comment_status', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->send_notifications($a);'));
subscribe-to-comments.pot ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Subscribe to Comments 2.0\n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: 2005-07-11 18:42-0500\n"
6
+ "Last-Translator: Mark Jaquith <mark.i18n@txfx.net>\n"
7
+ "Language-Team: Mark Jaquith <mark.wordpress@txfx.net>\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Poedit-Keywords: __,_e\n"
12
+ "X-Poedit-Basepath: .\n"
13
+ "X-Poedit-SearchPath-0: c:\\stc\n"
14
+
15
+ # c:\stc/subscribe-to-comments.php:81
16
+ msgid "<strong>Error: </strong>"
17
+ msgstr ""
18
+
19
+ # c:\stc/subscribe-to-comments.php:96
20
+ msgid "Subscribe without commenting"
21
+ msgstr ""
22
+
23
+ # c:\stc/subscribe-to-comments.php:98
24
+ msgid "E-Mail:"
25
+ msgstr ""
26
+
27
+ # c:\stc/subscribe-to-comments.php:100
28
+ msgid "Subscribe"
29
+ msgstr ""
30
+
31
+ # c:\stc/subscribe-to-comments.php:146
32
+ msgid "\"From\" name for notifications:"
33
+ msgstr ""
34
+
35
+ # c:\stc/subscribe-to-comments.php:147
36
+ msgid "\"From\" e-mail addresss for notifications:"
37
+ msgstr ""
38
+
39
+ # c:\stc/subscribe-to-comments.php:148
40
+ msgid "\"Subscribe\" box should be checked by default"
41
+ msgstr ""
42
+
43
+ # c:\stc/subscribe-to-comments.php:151
44
+ msgid "Comment Form Text"
45
+ msgstr ""
46
+
47
+ # c:\stc/subscribe-to-comments.php:153
48
+ msgid "Customize the messages shown to different people. Use <code>[manager_link]</code> to insert the URI to the Subscription Manager."
49
+ msgstr ""
50
+
51
+ # c:\stc/subscribe-to-comments.php:157
52
+ msgid "Not subscribed"
53
+ msgstr ""
54
+
55
+ # c:\stc/subscribe-to-comments.php:159
56
+ msgid "Subscribed"
57
+ msgstr ""
58
+
59
+ # c:\stc/subscribe-to-comments.php:161
60
+ msgid "Entry Author"
61
+ msgstr ""
62
+
63
+ # c:\stc/subscribe-to-comments.php:173
64
+ msgid "Use custom style for Subscription Manager"
65
+ msgstr ""
66
+
67
+ # c:\stc/subscribe-to-comments.php:175
68
+ msgid "These settings only matter if you are using a custom style. <code>[theme_path]</code> will be replaced with the path to your current theme."
69
+ msgstr ""
70
+
71
+ # c:\stc/subscribe-to-comments.php:178
72
+ msgid "Path to header:"
73
+ msgstr ""
74
+
75
+ # c:\stc/subscribe-to-comments.php:179
76
+ msgid "Path to sidebar:"
77
+ msgstr ""
78
+
79
+ # c:\stc/subscribe-to-comments.php:180
80
+ msgid "Path to footer:"
81
+ msgstr ""
82
+
83
+ # c:\stc/subscribe-to-comments.php:183
84
+ msgid "HTML for before the subscription manager:"
85
+ msgstr ""
86
+
87
+ # c:\stc/subscribe-to-comments.php:184
88
+ msgid "HTML for after the subscription manager:"
89
+ msgstr ""
90
+
91
+ # c:\stc/subscribe-to-comments.php:213
92
+ msgid "Options saved."
93
+ msgstr ""
94
+
95
+ # c:\stc/subscribe-to-comments.php:221
96
+ msgid "Update Options &raquo;"
97
+ msgstr ""
98
+
99
+ # c:\stc/subscribe-to-comments.php:392
100
+ msgid "Please provide a valid e-mail address."
101
+ msgstr ""
102
+
103
+ # c:\stc/subscribe-to-comments.php:395
104
+ msgid "This e-mail address may not be subscribed"
105
+ msgstr ""
106
+
107
+ # c:\stc/subscribe-to-comments.php:401
108
+ # c:\stc/subscribe-to-comments.php:415
109
+ msgid "You appear to be already subscribed to this entry."
110
+ msgstr ""
111
+
112
+ # c:\stc/subscribe-to-comments.php:406
113
+ msgid "Comments are not allowed on this entry."
114
+ msgstr ""
115
+
116
+ # c:\stc/subscribe-to-comments.php:577
117
+ #, php-format
118
+ msgid "There is a new comment on the post \"%s\""
119
+ msgstr ""
120
+
121
+ # c:\stc/subscribe-to-comments.php:578
122
+ #, php-format
123
+ msgid "Author: %s\n"
124
+ msgstr ""
125
+
126
+ # c:\stc/subscribe-to-comments.php:579
127
+ msgid "Comment:\n"
128
+ msgstr ""
129
+
130
+ # c:\stc/subscribe-to-comments.php:580
131
+ msgid "See all comments on this post here:\n"
132
+ msgstr ""
133
+
134
+ # c:\stc/subscribe-to-comments.php:583
135
+ msgid "To manage your subscriptions or to block all notifications from this site, click the link below:\n"
136
+ msgstr ""
137
+
138
+ # c:\stc/subscribe-to-comments.php:586
139
+ #, php-format
140
+ msgid "New Comment On: %s"
141
+ msgstr ""
142
+
143
+ # c:\stc/subscribe-to-comments.php:606
144
+ msgid "E-mail change confirmation"
145
+ msgstr ""
146
+
147
+ # c:\stc/subscribe-to-comments.php:607
148
+ #, php-format
149
+ msgid ""
150
+ "You are receiving this message to confirm a change of e-mail address for your subscriptions at \"%s\"\n"
151
+ "\n"
152
+ msgstr ""
153
+
154
+ # c:\stc/subscribe-to-comments.php:608
155
+ #, php-format
156
+ msgid ""
157
+ "To change your e-mail address to %s, click this link:\n"
158
+ "\n"
159
+ msgstr ""
160
+
161
+ # c:\stc/subscribe-to-comments.php:610
162
+ # c:\stc/subscribe-to-comments.php:621
163
+ msgid "If you did not request this action, please disregard this message."
164
+ msgstr ""
165
+
166
+ # c:\stc/subscribe-to-comments.php:617
167
+ msgid "E-mail block confirmation"
168
+ msgstr ""
169
+
170
+ # c:\stc/subscribe-to-comments.php:618
171
+ #, php-format
172
+ msgid ""
173
+ "You are receiving this message to confirm that you no longer wish to receive e-mail comment notifications from \"%s\"\n"
174
+ "\n"
175
+ msgstr ""
176
+
177
+ # c:\stc/subscribe-to-comments.php:619
178
+ msgid ""
179
+ "To cancel all future notifications for this address, click this link:\n"
180
+ "\n"
181
+ msgstr ""
182
+
183
+ # c:\stc/subscribe-to-comments.php:651
184
+ msgid "click here"
185
+ msgstr ""
186
+
187
+ # c:\stc/subscribe-to-comments.php:673
188
+ msgid "Notify me of followup comments via e-mail"
189
+ msgstr ""
190
+
191
+ # c:\stc/subscribe-to-comments.php:673
192
+ msgid "You are subscribed to this entry. <a href=\"[manager_link]\">Manage your subscriptions</a>."
193
+ msgstr ""
194
+
195
+ # c:\stc/subscribe-to-comments.php:673
196
+ msgid "You are the author of this entry. <a href=\"[manager_link]\">Manage subscriptions</a>."
197
+ msgstr ""
198
+
199
+ # c:\stc/subscribe-to-comments.php:813
200
+ # c:\stc/wp-subscription-manager.php:119
201
+ msgid "Comment Subscription Manager"
202
+ msgstr ""
203
+
204
+ # c:\stc/subscribe-to-comments.php:813
205
+ # c:\stc/wp-subscription-manager.php:220
206
+ msgid "Subscriptions"
207
+ msgstr ""
208
+
209
+ # c:\stc/subscribe-to-comments.php:818
210
+ msgid "Subscribe to Comments"
211
+ msgstr ""
212
+
213
+ # c:\stc/wp-subscription-manager.php:9
214
+ msgid "You must activate the \"Subscribe to Comments\" plugin in the WordPress admin panel"
215
+ msgstr ""
216
+
217
+ # c:\stc/wp-subscription-manager.php:26
218
+ msgid "You may not access this page without a valid key."
219
+ msgstr ""
220
+
221
+ # c:\stc/wp-subscription-manager.php:34
222
+ #, php-format
223
+ msgid "All notifications that were formerly sent to <strong>%s</strong> will now be sent to <strong>%s</strong>!"
224
+ msgstr ""
225
+
226
+ # c:\stc/wp-subscription-manager.php:46
227
+ #, php-format
228
+ msgid "<strong>%s</strong> %s removed successfully."
229
+ msgstr ""
230
+
231
+ # c:\stc/wp-subscription-manager.php:46
232
+ msgid "subscriptions"
233
+ msgstr ""
234
+
235
+ # c:\stc/wp-subscription-manager.php:46
236
+ msgid "subscription"
237
+ msgstr ""
238
+
239
+ # c:\stc/wp-subscription-manager.php:51
240
+ #, php-format
241
+ msgid "The block on <strong>%s</strong> has been successfully removed."
242
+ msgstr ""
243
+
244
+ # c:\stc/wp-subscription-manager.php:53
245
+ #, php-format
246
+ msgid "<strong>%s</strong> isn't blocked!"
247
+ msgstr ""
248
+
249
+ # c:\stc/wp-subscription-manager.php:58
250
+ #, php-format
251
+ msgid "<strong>%s</strong> has been blocked from receiving notifications. You will have to have the administrator remove the block before you will be able to change your notification address."
252
+ msgstr ""
253
+
254
+ # c:\stc/wp-subscription-manager.php:61
255
+ #, php-format
256
+ msgid "Your change of e-mail request was successfully received. Please check your old account (<strong>%s</strong>) in order to confirm the change."
257
+ msgstr ""
258
+
259
+ # c:\stc/wp-subscription-manager.php:66
260
+ #, php-format
261
+ msgid "Your request to block <strong>%s</strong> from receiving any further notifications has been received. In order for you to complete the block, please check your e-mail and click on the link in the message that has been sent to you."
262
+ msgstr ""
263
+
264
+ # c:\stc/wp-subscription-manager.php:70
265
+ #, php-format
266
+ msgid "<strong>%s</strong> has been successfully subscribed to %s"
267
+ msgstr ""
268
+
269
+ # c:\stc/wp-subscription-manager.php:75
270
+ #, php-format
271
+ msgid "<strong>%s</strong> has been added to the \"do not mail\" list. You will no longer receive any notifications from this site. If this was done in error, please contact the <a href=\"mailto:%s\">site administrator</a> to remove this block."
272
+ msgstr ""
273
+
274
+ # c:\stc/wp-subscription-manager.php:77
275
+ #, php-format
276
+ msgid "<strong>%s</strong> has already been blocked!"
277
+ msgstr ""
278
+
279
+ # c:\stc/wp-subscription-manager.php:94
280
+ #, php-format
281
+ msgid "%s Comment Subscription Manager"
282
+ msgstr ""
283
+
284
+ # c:\stc/wp-subscription-manager.php:122
285
+ #, php-format
286
+ msgid "Return to the page you were viewing: %s"
287
+ msgstr ""
288
+
289
+ # c:\stc/wp-subscription-manager.php:133
290
+ msgid "Remove Block"
291
+ msgstr ""
292
+
293
+ # c:\stc/wp-subscription-manager.php:136
294
+ #, php-format
295
+ msgid "Click the button below to remove the block on <strong>%s</strong>. This should only be done if the user has specifically requested it."
296
+ msgstr ""
297
+
298
+ # c:\stc/wp-subscription-manager.php:144
299
+ msgid "Remove Block &raquo;"
300
+ msgstr ""
301
+
302
+ # c:\stc/wp-subscription-manager.php:152
303
+ msgid "Blocked"
304
+ msgstr ""
305
+
306
+ # c:\stc/wp-subscription-manager.php:155
307
+ #, php-format
308
+ msgid "You have indicated that you do not wish to receive any notifications at <strong>%s</strong> from this site. If this is incorrect, or if you wish to have the block removed, please contact the <a href=\"mailto:%s\">site administrator</a>."
309
+ msgstr ""
310
+
311
+ # c:\stc/wp-subscription-manager.php:169
312
+ #, php-format
313
+ msgid "<strong>%s</strong> is not subscribed to any posts on this site."
314
+ msgstr ""
315
+
316
+ # c:\stc/wp-subscription-manager.php:171
317
+ #, php-format
318
+ msgid "<strong>%s</strong> is not a valid e-mail address."
319
+ msgstr ""
320
+
321
+ # c:\stc/wp-subscription-manager.php:183
322
+ msgid "Find Subscriptions"
323
+ msgstr ""
324
+
325
+ # c:\stc/wp-subscription-manager.php:186
326
+ msgid "Enter an e-mail address to view its subscriptions or undo a block."
327
+ msgstr ""
328
+
329
+ # c:\stc/wp-subscription-manager.php:194
330
+ msgid "Search &raquo;"
331
+ msgstr ""
332
+
333
+ # c:\stc/wp-subscription-manager.php:223
334
+ #, php-format
335
+ msgid "<strong>%s</strong> is subscribed to the posts listed below. To unsubscribe to one or more posts, click the checkbox next to the title, then click \"Remove Selected Subscription(s)\" at the bottom of the list."
336
+ msgstr ""
337
+
338
+ # c:\stc/wp-subscription-manager.php:237
339
+ msgid "Invert Checkbox Selection"
340
+ msgstr ""
341
+
342
+ # c:\stc/wp-subscription-manager.php:241
343
+ msgid "Remove Selected Subscription(s) &raquo;"
344
+ msgstr ""
345
+
346
+ # c:\stc/wp-subscription-manager.php:248
347
+ msgid "Advanced Options"
348
+ msgstr ""
349
+
350
+ # c:\stc/wp-subscription-manager.php:251
351
+ msgid "Block All Notifications"
352
+ msgstr ""
353
+
354
+ # c:\stc/wp-subscription-manager.php:258
355
+ #, php-format
356
+ msgid "If you would like <strong>%s</strong> to be blocked from receiving any notifications from this site, click the button below. This should be reserved for cases where someone is signing you up for notifications without your consent."
357
+ msgstr ""
358
+
359
+ # c:\stc/wp-subscription-manager.php:262
360
+ msgid "Block Notifications &raquo;"
361
+ msgstr ""
362
+
363
+ # c:\stc/wp-subscription-manager.php:268
364
+ msgid "Change E-mail Address"
365
+ msgstr ""
366
+
367
+ # c:\stc/wp-subscription-manager.php:275
368
+ #, php-format
369
+ msgid "If you would like to change the e-mail address for your subscriptions, enter the new address below. You will be required to verify this request by clicking a special link sent to your current address (<strong>%s</strong>)."
370
+ msgstr ""
371
+
372
+ # c:\stc/wp-subscription-manager.php:279
373
+ msgid "New E-mail Address:"
374
+ msgstr ""
375
+
376
+ # c:\stc/wp-subscription-manager.php:284
377
+ msgid "Change E-mail Address &raquo;"
378
+ msgstr ""
379
+
wp-subscription-manager.php CHANGED
@@ -35,7 +35,7 @@ switch ($sg_subscribe->action) :
35
  // change info to the new email
36
  $sg_subscribe->email = $sg_subscribe->new_email;
37
  unset($sg_subscribe->new_email);
38
- $sg_subscribe->key = md5($sg_subscribe->email . DB_PASSWORD);
39
  $sg_subscribe->validate_key();
40
  }
41
  break;
@@ -75,7 +75,7 @@ switch ($sg_subscribe->action) :
75
  $sg_subscribe->add_message(sprintf(__('<strong>%s</strong> has been added to the "do not mail" list. You will no longer receive any notifications from this site. If this was done in error, please contact the <a href="mailto:%s">site administrator</a> to remove this block.', 'subscribe-to-comments'), $sg_subscribe->email, $sg_subscribe->site_email));
76
  else
77
  $sg_subscribe->add_error(sprintf(__('<strong>%s</strong> has already been blocked!', 'subscribe-to-comments'), $sg_subscribe->email), 'manager');
78
- $sg_subscribe->key = md5($sg_subscribe->email . DB_PASSWORD);
79
  $sg_subscribe->validate_key();
80
  break;
81
 
@@ -127,7 +127,7 @@ charset=<?php bloginfo('charset'); ?>" />
127
 
128
  <?php if ($sg_subscribe->is_blocked()) { ?>
129
 
130
- <?php if ($user_level >= 8) : ?>
131
 
132
  <fieldset class="options">
133
  <legend><?php _e('Remove Block', 'subscribe-to-comments'); ?></legend>
@@ -177,7 +177,7 @@ charset=<?php bloginfo('charset'); ?>" />
177
 
178
 
179
 
180
- <?php if ( $user_level >= 8 ) { ?>
181
 
182
  <fieldset class="options">
183
  <legend><?php _e('Find Subscriptions', 'subscribe-to-comments'); ?></legend>
@@ -217,7 +217,7 @@ for( i = 0, n = form.elements.length; i < n; i++ ) {
217
  </script>
218
 
219
  <fieldset class="options">
220
- <legend><?php _e('Subscriptions'); ?></legend>
221
 
222
  <p>
223
  <?php printf(__('<strong>%s</strong> is subscribed to the posts listed below. To unsubscribe to one or more posts, click the checkbox next to the title, then click "Remove Selected Subscription(s)" at the bottom of the list.', 'subscribe-to-comments'), $sg_subscribe->email); ?>
35
  // change info to the new email
36
  $sg_subscribe->email = $sg_subscribe->new_email;
37
  unset($sg_subscribe->new_email);
38
+ $sg_subscribe->key = $sg_subscribe->generate_key($sg_subscribe->email);
39
  $sg_subscribe->validate_key();
40
  }
41
  break;
75
  $sg_subscribe->add_message(sprintf(__('<strong>%s</strong> has been added to the "do not mail" list. You will no longer receive any notifications from this site. If this was done in error, please contact the <a href="mailto:%s">site administrator</a> to remove this block.', 'subscribe-to-comments'), $sg_subscribe->email, $sg_subscribe->site_email));
76
  else
77
  $sg_subscribe->add_error(sprintf(__('<strong>%s</strong> has already been blocked!', 'subscribe-to-comments'), $sg_subscribe->email), 'manager');
78
+ $sg_subscribe->key = $sg_subscribe->generate_key($sg_subscribe->email);
79
  $sg_subscribe->validate_key();
80
  break;
81
 
127
 
128
  <?php if ($sg_subscribe->is_blocked()) { ?>
129
 
130
+ <?php if ( current_user_can('manage_options') ) : ?>
131
 
132
  <fieldset class="options">
133
  <legend><?php _e('Remove Block', 'subscribe-to-comments'); ?></legend>
177
 
178
 
179
 
180
+ <?php if ( current_user_can('manage_options') ) { ?>
181
 
182
  <fieldset class="options">
183
  <legend><?php _e('Find Subscriptions', 'subscribe-to-comments'); ?></legend>
217
  </script>
218
 
219
  <fieldset class="options">
220
+ <legend><?php _e('Subscriptions', 'subscribe-to-comments'); ?></legend>
221
 
222
  <p>
223
  <?php printf(__('<strong>%s</strong> is subscribed to the posts listed below. To unsubscribe to one or more posts, click the checkbox next to the title, then click "Remove Selected Subscription(s)" at the bottom of the list.', 'subscribe-to-comments'), $sg_subscribe->email); ?>