Subscribe To Comments Reloaded - Version 150207

Version Description

  • Fix The output link for the manage subscriptions.
  • Fix Display of URL to use escape characters.
  • New Feature a Unique Key to the plugin. This Key will help to prevent spam bots to hijack your links.
  • Add Plugin GitHub link for bug reporting. Check the "You can Help" panel.
  • See the commit history on (GitHub)[https://github.com/stcr/subscribe-to-comments-reloaded]
Download this release

Release Info

Developer reedyseth
Plugin Icon 128x128 Subscribe To Comments Reloaded
Version 150207
Comparing to
See all releases

Code changes from version 141103 to 150207

options/panel5.php CHANGED
@@ -5,47 +5,55 @@ if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
5
  exit;
6
  }
7
 
8
- // Update options
9
- if ( isset( $_POST['options'] ) ) {
10
- $faulty_fields = '';
11
- if ( isset( $_POST['options']['purge_days'] ) && ! subscribe_reloaded_update_option( 'purge_days', $_POST['options']['purge_days'], 'integer' ) ) {
12
- $faulty_fields = __( 'Autopurge requests', 'subscribe-reloaded' ) . ', ';
13
- }
14
- if ( isset( $_POST['options']['enable_double_check'] ) && ! subscribe_reloaded_update_option( 'enable_double_check', $_POST['options']['enable_double_check'], 'yesno' ) ) {
15
- $faulty_fields = __( 'Enable double check', 'subscribe-reloaded' ) . ', ';
16
- }
17
- if ( isset( $_POST['options']['notify_authors'] ) && ! subscribe_reloaded_update_option( 'notify_authors', $_POST['options']['notify_authors'], 'yesno' ) ) {
18
- $faulty_fields = __( 'Subscribe authors', 'subscribe-reloaded' ) . ', ';
19
- }
20
- if ( isset( $_POST['options']['enable_html_emails'] ) && ! subscribe_reloaded_update_option( 'enable_html_emails', $_POST['options']['enable_html_emails'], 'yesno' ) ) {
21
- $faulty_fields = __( 'Enable HTML emails', 'subscribe-reloaded' ) . ', ';
22
- }
23
- if ( isset( $_POST['options']['htmlify_message_links'] ) && ! subscribe_reloaded_update_option( 'htmlify_message_links', $_POST['options']['htmlify_message_links'], 'yesno' ) ) {
24
- $faulty_fields = __( 'HTMLify Links in HTML emails', 'subscribe-reloaded' ) . ', ';
25
- }
26
- if ( isset( $_POST['options']['process_trackbacks'] ) && ! subscribe_reloaded_update_option( 'process_trackbacks', $_POST['options']['process_trackbacks'], 'yesno' ) ) {
27
- $faulty_fields = __( 'Send trackbacks', 'subscribe-reloaded' ) . ', ';
28
- }
29
- if ( isset( $_POST['options']['enable_admin_messages'] ) && ! subscribe_reloaded_update_option( 'enable_admin_messages', $_POST['options']['enable_admin_messages'], 'yesno' ) ) {
30
- $faulty_fields = __( 'Notify admin', 'subscribe-reloaded' ) . ', ';
31
- }
32
- if ( isset( $_POST['options']['admin_subscribe'] ) && ! subscribe_reloaded_update_option( 'admin_subscribe', $_POST['options']['admin_subscribe'], 'yesno' ) ) {
33
- $faulty_fields = __( 'Let admin subscribe', 'subscribe-reloaded' ) . ', ';
34
- }
35
- if ( isset( $_POST['options']['admin_bcc'] ) && ! subscribe_reloaded_update_option( 'admin_bcc', $_POST['options']['admin_bcc'], 'yesno' ) ) {
36
- $faulty_fields = __( 'BCC admin on Notifications', 'subscribe-reloaded' ) . ', ';
37
- }
38
 
39
- // Display an alert in the admin interface if something went wrong
40
- echo '<div class="updated fade"><p>';
41
- if ( empty( $faulty_fields ) ) {
42
- _e( 'Your settings have been successfully updated.', 'subscribe-reloaded' );
43
- } else {
44
- _e( 'There was an error updating the following fields:', 'subscribe-reloaded' );
45
- echo ' <strong>' . substr( $faulty_fields, 0, - 2 ) . '</strong>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
- echo "</p></div>\n";
48
  }
 
 
 
 
 
 
 
 
 
 
 
49
  wp_print_scripts( 'quicktags' );
50
  ?>
51
  <form action="admin.php?page=subscribe-to-comments-reloaded/options/index.php&subscribepanel=<?php echo $current_panel ?>" method="post">
@@ -132,6 +140,35 @@ wp_print_scripts( 'quicktags' );
132
  <div class="description"><?php _e( 'Send a copy of all Notifications to the administrator.', 'subscribe-reloaded' ); ?></div>
133
  </td>
134
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  </tbody>
136
  </table>
137
  <p class="submit"><input type="submit" value="<?php _e( 'Save Changes' ) ?>" class="button-primary" name="Submit">
5
  exit;
6
  }
7
 
8
+ $faulty_fields = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ if ( array_key_exists( "generate_key", $_POST ) ) {
11
+ global $wp_subscribe_reloaded;
12
+ $unique_key = $wp_subscribe_reloaded->generate_key();
13
+ subscribe_reloaded_update_option( 'unique_key', $unique_key, 'text' );
14
+ } else {
15
+ // Update options
16
+ if ( isset( $_POST['options'] ) ) {
17
+ if ( isset( $_POST['options']['purge_days'] ) && ! subscribe_reloaded_update_option( 'purge_days', $_POST['options']['purge_days'], 'integer' ) ) {
18
+ $faulty_fields = __( 'Autopurge requests', 'subscribe-reloaded' ) . ', ';
19
+ }
20
+ if ( isset( $_POST['options']['enable_double_check'] ) && ! subscribe_reloaded_update_option( 'enable_double_check', $_POST['options']['enable_double_check'], 'yesno' ) ) {
21
+ $faulty_fields = __( 'Enable double check', 'subscribe-reloaded' ) . ', ';
22
+ }
23
+ if ( isset( $_POST['options']['notify_authors'] ) && ! subscribe_reloaded_update_option( 'notify_authors', $_POST['options']['notify_authors'], 'yesno' ) ) {
24
+ $faulty_fields = __( 'Subscribe authors', 'subscribe-reloaded' ) . ', ';
25
+ }
26
+ if ( isset( $_POST['options']['enable_html_emails'] ) && ! subscribe_reloaded_update_option( 'enable_html_emails', $_POST['options']['enable_html_emails'], 'yesno' ) ) {
27
+ $faulty_fields = __( 'Enable HTML emails', 'subscribe-reloaded' ) . ', ';
28
+ }
29
+ if ( isset( $_POST['options']['htmlify_message_links'] ) && ! subscribe_reloaded_update_option( 'htmlify_message_links', $_POST['options']['htmlify_message_links'], 'yesno' ) ) {
30
+ $faulty_fields = __( 'HTMLify Links in HTML emails', 'subscribe-reloaded' ) . ', ';
31
+ }
32
+ if ( isset( $_POST['options']['process_trackbacks'] ) && ! subscribe_reloaded_update_option( 'process_trackbacks', $_POST['options']['process_trackbacks'], 'yesno' ) ) {
33
+ $faulty_fields = __( 'Send trackbacks', 'subscribe-reloaded' ) . ', ';
34
+ }
35
+ if ( isset( $_POST['options']['enable_admin_messages'] ) && ! subscribe_reloaded_update_option( 'enable_admin_messages', $_POST['options']['enable_admin_messages'], 'yesno' ) ) {
36
+ $faulty_fields = __( 'Notify admin', 'subscribe-reloaded' ) . ', ';
37
+ }
38
+ if ( isset( $_POST['options']['admin_subscribe'] ) && ! subscribe_reloaded_update_option( 'admin_subscribe', $_POST['options']['admin_subscribe'], 'yesno' ) ) {
39
+ $faulty_fields = __( 'Let admin subscribe', 'subscribe-reloaded' ) . ', ';
40
+ }
41
+ if ( isset( $_POST['options']['admin_bcc'] ) && ! subscribe_reloaded_update_option( 'admin_bcc', $_POST['options']['admin_bcc'], 'yesno' ) ) {
42
+ $faulty_fields = __( 'BCC admin on Notifications', 'subscribe-reloaded' ) . ', ';
43
+ }
44
  }
 
45
  }
46
+
47
+ // Display an alert in the admin interface if something went wrong
48
+ echo '<div class="updated fade"><p>';
49
+ if ( empty( $faulty_fields ) ) {
50
+ _e( 'Your settings have been successfully updated.', 'subscribe-reloaded' );
51
+ } else {
52
+ _e( 'There was an error updating the following fields:', 'subscribe-reloaded' );
53
+ echo ' <strong>' . substr( $faulty_fields, 0, - 2 ) . '</strong>';
54
+ }
55
+ echo "</p></div>\n";
56
+
57
  wp_print_scripts( 'quicktags' );
58
  ?>
59
  <form action="admin.php?page=subscribe-to-comments-reloaded/options/index.php&subscribepanel=<?php echo $current_panel ?>" method="post">
140
  <div class="description"><?php _e( 'Send a copy of all Notifications to the administrator.', 'subscribe-reloaded' ); ?></div>
141
  </td>
142
  </tr>
143
+ <tr>
144
+ <th scope="row">
145
+ <label for="admin_bcc"><?php _e( 'StCR Unique Key', 'subscribe-reloaded' ) ?></label></th>
146
+ <td>
147
+ <?php
148
+ if ( subscribe_reloaded_get_option( 'unique_key' ) == "" ) :
149
+ _e(
150
+ "This Unique Key is not set, please click the following button to ",
151
+ 'subscribe-reloaded'
152
+ );
153
+ ?>
154
+ <input type="submit" value="<?php _e( 'Generate' ) ?>" class="button-primary" size="6" name="generate_key">
155
+ <?php
156
+ else :
157
+ ?>
158
+ <input type="text" name="options[uk_key]" id="uk_key"
159
+ value="<?php echo subscribe_reloaded_get_option( 'unique_key' ); ?>" size="35" disabled>
160
+ <div class="description">
161
+ <?php _e(
162
+ "This Unique Key will be use to send the notification to your subscribers with more
163
+ security.",
164
+ 'subscribe-reloaded'
165
+ ); ?></div>
166
+ <input type="submit" value="<?php _e( 'Generate' ) ?>" class="button-primary" size="6" name="generate_key" style="background-color: #D54E21;border-color: #B34B28;">
167
+ <?php
168
+ endif;
169
+ ?>
170
+ </td>
171
+ </tr>
172
  </tbody>
173
  </table>
174
  <p class="submit"><input type="submit" value="<?php _e( 'Save Changes' ) ?>" class="button-primary" name="Submit">
options/panel6.php CHANGED
@@ -15,10 +15,13 @@ if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
15
  </form>
16
  <hr>
17
 
18
- <p><?php _e( 'How valuable is the feature offered by this plugin to your visitors? Subscribe to Comments Reloaded is and will always be free, but consider supporting the author if this plugin made your web site better, especially if you are making money out of it. Any donation received will be reinvested in the development of Subscribe to Comments Reloaded, and to buy some food for my hungry family.', 'subscribe-reloaded' ) ?></p>
19
 
20
  <h3><?php _e( "Don't want to donate? You can still help", 'subscribe-reloaded' ) ?></h3>
21
- <p><?php _e( "If you don't want to donate money, please consider blogging about my plugin with a link to the plugin's page. Please let your readers know what makes your blog better. You can also contribute donating your time: do not hesitate to send me bug reports, your localization files, ideas on how to improve Subscribe to Comments Reloaded and so on. Whatever you do, thanks for using my plugin!", 'subscribe-reloaded' ) ?></p>
 
 
 
22
 
23
  <h3><?php _e( "Vote and show your appreciation", 'subscribe-reloaded' ) ?></h3>
24
- <p><?php _e( 'Tell other people if Subscribe to Comments Reloaded works for you and how good it is. <a href="http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/">Rate it</a> on its Plugin Directory page.', 'subscribe-reloaded' ) ?></p>
15
  </form>
16
  <hr>
17
 
18
+ <p><?php _e( 'How valuable is the feature offered by this plugin to your visitors? <strong>Subscribe to Comments Reloaded</strong> is and will always be free, but consider supporting the author if this plugin made your web site better, especially if you are making money out of it. Any donation received will be reinvested in the development of <strong>Subscribe to Comments Reloaded</strong>, and to buy some food for my hungry family.', 'subscribe-reloaded' ) ?></p>
19
 
20
  <h3><?php _e( "Don't want to donate? You can still help", 'subscribe-reloaded' ) ?></h3>
21
+ <p><?php _e( "If you don't want to donate money, please consider blogging about my plugin with a link to the plugin's page. Please let your readers know what makes your blog better. You can also contribute donating your time: do not hesitate to send me bug reports, your localization files, ideas on how to improve <strong>Subscribe to Comments Reloaded</strong> and so on. Whatever you do, thanks for using my plugin!", 'subscribe-reloaded' ) ?></p>
22
+
23
+ <h3><?php _e( "Did you find a Bug on the plugin?", 'subscribe-reloaded' ) ?></h3>
24
+ <p><?php _e( 'Please report any bug on the <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">GitHub</a> Page rather than on the WordPress Support page.', 'subscribe-reloaded' ) ?></p>
25
 
26
  <h3><?php _e( "Vote and show your appreciation", 'subscribe-reloaded' ) ?></h3>
27
+ <p><?php _e( 'Tell other people if <strong>Subscribe to Comments Reloaded</strong> works for you and how good it is. <a href="http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/">Rate it</a> on its Plugin Directory page.', 'subscribe-reloaded' ) ?></p>
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Subscribe To Comments Reloaded ===
2
- Author: camu, Reedyseth, andreasbo, raamdev
3
- Contributors: coolmann, Reedyseth, raamdev
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=XF86X93FDCGYA&lc=US&item_name=Datasoft%20Engineering&item_number=DI%2dSTCR&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
5
  Tags: subscribe, comments, notification, subscription, manage, double check-in, follow, commenting
6
  Requires at least: 2.9.2
7
- Tested up to: 4.0
8
- Stable tag: 141103
9
 
10
  Subscribe to Comments Reloaded allows commenters to sign up for e-mail notifications of subsequent replies.
11
 
@@ -61,6 +61,9 @@ Yes! Just disable the corresponding option under Settings > Comment Form and the
61
  The information of your configuration needs to be updated. Go to the Subscribe to Comments Reloaded settings and click the `Save Changes` button on the tab
62
  where you have you messages with HTML.
63
 
 
 
 
64
  == Screenshots ==
65
 
66
  1. Manage your subscriptions
@@ -71,6 +74,10 @@ where you have you messages with HTML.
71
 
72
  == Upgrade Notice ==
73
 
 
 
 
 
74
  == v141103 ==
75
 
76
  **Broken links and settings issue** Please upgrade to fix the URL creation on the Request Management link and to save the settings values correctly.
@@ -85,7 +92,16 @@ v1410124 Fixed several issues reported on the support forum like broken links, r
85
 
86
  == Changelog ==
87
 
88
- == v141103=
 
 
 
 
 
 
 
 
 
89
  * **Fix** URL generation for the Request Management link.
90
  * **Fix** Saving of settings values. Settings with a single quote was not saving correcting. Every option with a single quote was broken, after update please save the settings on every tab where you have single quotes.
91
 
1
  === Subscribe To Comments Reloaded ===
2
+ Author: camu, reedyseth, andreasbo, raamdev
3
+ Contributors: coolmann, reedyseth, raamdev
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=XF86X93FDCGYA&lc=US&item_name=Datasoft%20Engineering&item_number=DI%2dSTCR&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
5
  Tags: subscribe, comments, notification, subscription, manage, double check-in, follow, commenting
6
  Requires at least: 2.9.2
7
+ Tested up to: 4.1
8
+ Stable tag: 150207
9
 
10
  Subscribe to Comments Reloaded allows commenters to sign up for e-mail notifications of subsequent replies.
11
 
61
  The information of your configuration needs to be updated. Go to the Subscribe to Comments Reloaded settings and click the `Save Changes` button on the tab
62
  where you have you messages with HTML.
63
 
64
+ = How to generate a new Key for my Site? =
65
+ Just go to the Options Panel and click the generate button. By generating a new key you prevent the spam bots to steal your links.
66
+
67
  == Screenshots ==
68
 
69
  1. Manage your subscriptions
74
 
75
  == Upgrade Notice ==
76
 
77
+ == v150207 ==
78
+
79
+ Improvements on the links security. Now you get a Unique Key for your site. Check the Options Panel.
80
+
81
  == v141103 ==
82
 
83
  **Broken links and settings issue** Please upgrade to fix the URL creation on the Request Management link and to save the settings values correctly.
92
 
93
  == Changelog ==
94
 
95
+ = 150207 =
96
+
97
+ * **Fix** The output link for the manage subscriptions.
98
+ * **Fix** Display of URL to use escape characters.
99
+ * **New Feature** a Unique Key to the plugin. This Key will help to prevent spam bots to hijack your links.
100
+ * **Add** Plugin GitHub link for bug reporting. Check the "You can Help" panel.
101
+ * **See** the commit history on (GitHub)[https://github.com/stcr/subscribe-to-comments-reloaded]
102
+
103
+ = v141103 =
104
+
105
  * **Fix** URL generation for the Request Management link.
106
  * **Fix** Saving of settings values. Settings with a single quote was not saving correcting. Every option with a single quote was broken, after update please save the settings on every tab where you have single quotes.
107
 
subscribe-to-comments-reloaded.php CHANGED
@@ -2,15 +2,15 @@
2
  /*
3
  Plugin Name: Subscribe to Comments Reloaded
4
 
5
- Version: 141103
6
- Stable tag: 141103
7
  Requires at least: 2.9.2
8
- Tested up to: 4.0
9
 
10
  Plugin URI: http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/
11
  Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
12
- Contributors: camu, Reedyseth, andreasbo, raamdev
13
- Author: camu, Reedyseth, Raam Dev
14
  */
15
 
16
  // Avoid direct access to this piece of code
@@ -39,7 +39,9 @@ function subscribe_reloaded_show() {
39
  $user_link = qtrans_convertURL( $user_link );
40
  }
41
 
42
- $manager_link = ( strpos( $user_link, '?' ) !== false ) ? "$user_link&amp;srp=$post->ID" : "$user_link?srp=$post->ID";
 
 
43
 
44
  // Load localization files
45
  load_plugin_textdomain( 'subscribe-reloaded', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
@@ -105,7 +107,7 @@ function subscribe_reloaded_show() {
105
  if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
106
  $html_to_show = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $html_to_show );
107
  }
108
- echo "<!-- BEGIN: subscribe to comments reloaded -->" . html_entity_decode( stripslashes( $html_to_show ), ENT_QUOTES, 'UTF-8' ) . "<!-- END: subscribe to comments reloaded -->";
109
  }
110
 
111
  // Show the checkbox - You can manually override this by adding the corresponding function in your template
@@ -115,7 +117,7 @@ if ( get_option( 'subscribe_reloaded_show_subscription_box', 'yes' ) == 'yes' )
115
 
116
  class wp_subscribe_reloaded {
117
 
118
- public $current_version = '141103';
119
 
120
  /**
121
  * Constructor -- Sets things up.
@@ -281,6 +283,7 @@ class wp_subscribe_reloaded {
281
  add_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/', '', 'no' );
282
  }
283
 
 
284
  add_option( 'subscribe_reloaded_show_subscription_box', 'yes', '', 'no' );
285
  add_option( 'subscribe_reloaded_checked_by_default', 'no', '', 'no' );
286
  add_option( 'subscribe_reloaded_enable_advanced_subscriptions', 'no', '', 'no' );
@@ -639,7 +642,7 @@ class wp_subscribe_reloaded {
639
  ) {
640
  $include_post_content = include WP_PLUGIN_DIR . '/subscribe-to-comments-reloaded/templates/confirm.php';
641
  } // Manage your subscriptions (user)
642
- elseif ( ! empty( $email ) && ( ( ! empty( $key ) && $this->_is_valid_key( $key, $email ) ) || current_user_can( 'read' ) ) ) {
643
  $include_post_content = include WP_PLUGIN_DIR . '/subscribe-to-comments-reloaded/templates/user.php';
644
  }
645
 
@@ -1057,7 +1060,7 @@ class wp_subscribe_reloaded {
1057
  }
1058
 
1059
  $clean_email = $this->clean_email( $_email );
1060
- $subscriber_salt = $this->generate_key( $clean_email );
1061
 
1062
  $manager_link .= ( ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?' ) . "sre=" . urlencode( $clean_email ) . "&srk=$subscriber_salt";
1063
  $confirm_link = "$manager_link&srp=$_post_ID&sra=c";
@@ -1108,7 +1111,7 @@ class wp_subscribe_reloaded {
1108
  }
1109
 
1110
  $clean_email = $this->clean_email( $_email );
1111
- $subscriber_salt = $this->generate_key( $clean_email );
1112
 
1113
  $manager_link .= ( ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?' ) . "sre=" . urlencode( $clean_email ) . "&srk=$subscriber_salt";
1114
 
@@ -1179,8 +1182,19 @@ class wp_subscribe_reloaded {
1179
  /**
1180
  * Generate a unique key to allow users to manage their subscriptions
1181
  */
1182
- public function generate_key( $_email ) {
1183
- return md5( $this->salt . $_email );
 
 
 
 
 
 
 
 
 
 
 
1184
  }
1185
  // end generate_key
1186
 
@@ -1246,7 +1260,8 @@ class wp_subscribe_reloaded {
1246
  * Adds custom HTML code to the HEAD section of the management page
1247
  */
1248
  public function add_custom_header_meta() {
1249
- echo html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_custom_header_meta', '' ) ), ENT_COMPAT, 'UTF-8' );
 
1250
  }
1251
  // end add_custom_header_meta
1252
 
@@ -1624,7 +1639,11 @@ class wp_subscribe_reloaded {
1624
  * Checks if a key is valid for a given email address
1625
  */
1626
  private function _is_valid_key( $_key, $_email ) {
1627
- return $this->generate_key( $_email ) == $_key;
 
 
 
 
1628
  }
1629
  // end _is_valid_key
1630
  }
2
  /*
3
  Plugin Name: Subscribe to Comments Reloaded
4
 
5
+ Version: 150207
6
+ Stable tag: 150207
7
  Requires at least: 2.9.2
8
+ Tested up to: 4.1
9
 
10
  Plugin URI: http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/
11
  Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
12
+ Contributors: camu, reedyseth, andreasbo, raamdev
13
+ Author: camu, reedyseth, Raam Dev
14
  */
15
 
16
  // Avoid direct access to this piece of code
39
  $user_link = qtrans_convertURL( $user_link );
40
  }
41
 
42
+ $manager_link = ( strpos( $user_link, '?' ) !== false ) ?
43
+ "$user_link&amp;srp=$post->ID&amp;srk=" . get_option( 'subscribe_reloaded_unique_key' ) :
44
+ "$user_link?srp=$post->ID&amp;srk=" . get_option( 'subscribe_reloaded_unique_key' );
45
 
46
  // Load localization files
47
  load_plugin_textdomain( 'subscribe-reloaded', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
107
  if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
108
  $html_to_show = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $html_to_show );
109
  }
110
+ echo "<!-- BEGIN: subscribe to comments reloaded -->" . $html_to_show . "<!-- END: subscribe to comments reloaded -->";
111
  }
112
 
113
  // Show the checkbox - You can manually override this by adding the corresponding function in your template
117
 
118
  class wp_subscribe_reloaded {
119
 
120
+ public $current_version = '150207';
121
 
122
  /**
123
  * Constructor -- Sets things up.
283
  add_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/', '', 'no' );
284
  }
285
 
286
+ add_option( 'subscribe_reloaded_unique_key', $this->generate_key(), '', 'no' );
287
  add_option( 'subscribe_reloaded_show_subscription_box', 'yes', '', 'no' );
288
  add_option( 'subscribe_reloaded_checked_by_default', 'no', '', 'no' );
289
  add_option( 'subscribe_reloaded_enable_advanced_subscriptions', 'no', '', 'no' );
642
  ) {
643
  $include_post_content = include WP_PLUGIN_DIR . '/subscribe-to-comments-reloaded/templates/confirm.php';
644
  } // Manage your subscriptions (user)
645
+ elseif ( ! empty( $email ) && ( ! empty( $key ) && $this->_is_valid_key( $key, $email ) || current_user_can( 'read' ) ) ) {
646
  $include_post_content = include WP_PLUGIN_DIR . '/subscribe-to-comments-reloaded/templates/user.php';
647
  }
648
 
1060
  }
1061
 
1062
  $clean_email = $this->clean_email( $_email );
1063
+ $subscriber_salt = $this->generate_temp_key( $clean_email );
1064
 
1065
  $manager_link .= ( ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?' ) . "sre=" . urlencode( $clean_email ) . "&srk=$subscriber_salt";
1066
  $confirm_link = "$manager_link&srp=$_post_ID&sra=c";
1111
  }
1112
 
1113
  $clean_email = $this->clean_email( $_email );
1114
+ $subscriber_salt = $this->generate_temp_key( $clean_email );
1115
 
1116
  $manager_link .= ( ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?' ) . "sre=" . urlencode( $clean_email ) . "&srk=$subscriber_salt";
1117
 
1182
  /**
1183
  * Generate a unique key to allow users to manage their subscriptions
1184
  */
1185
+ public function generate_key( $_email = "" ) {
1186
+ $salt = time();
1187
+ $user = wp_get_current_user();
1188
+ $uniqueKey = md5( get_current_user_id() . $user->user_login . $salt . $_email );
1189
+
1190
+ return $uniqueKey;
1191
+ }
1192
+
1193
+ public function generate_temp_key( $_email ) {
1194
+ $uniqueKey = get_option( "subscribe_reloaded_unique_key" );
1195
+ $key = md5( $uniqueKey . $_email );
1196
+
1197
+ return $key;
1198
  }
1199
  // end generate_key
1200
 
1260
  * Adds custom HTML code to the HEAD section of the management page
1261
  */
1262
  public function add_custom_header_meta() {
1263
+ $a = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_custom_header_meta', '' ) ), ENT_QUOTES, 'UTF-8' );
1264
+ echo $a;
1265
  }
1266
  // end add_custom_header_meta
1267
 
1639
  * Checks if a key is valid for a given email address
1640
  */
1641
  private function _is_valid_key( $_key, $_email ) {
1642
+ if ( $this->generate_temp_key( $_email ) === $_key ) {
1643
+ return true;
1644
+ } else {
1645
+ return false;
1646
+ }
1647
  }
1648
  // end _is_valid_key
1649
  }
templates/request-management-link.php CHANGED
@@ -23,7 +23,7 @@ if ( ! empty( $email ) ) {
23
  }
24
 
25
  $clean_email = $wp_subscribe_reloaded->clean_email( $email );
26
- $subscriber_salt = $wp_subscribe_reloaded->generate_key( $clean_email );
27
 
28
  $headers = "MIME-Version: 1.0\n";
29
  $headers .= "From: $from_name <$from_email>\n";
@@ -36,7 +36,7 @@ if ( ! empty( $email ) ) {
36
  // Replace tags with their actual values
37
  $subject = str_replace( '[blog_name]', get_bloginfo( 'name' ), $subject );
38
  $message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $message );
39
- $message = str_replace( '[manager_link]', $manager_link, $message );
40
 
41
  // QTranslate support
42
  if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
@@ -55,7 +55,7 @@ if ( ! empty( $email ) ) {
55
  if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
56
  $message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
57
  }
58
- ?>
59
  <p><?php echo $message ?></p>
60
  <form action="<?php if ( $helper->verifyXSS( $_SERVER['REQUEST_URI'] ) ) {
61
  echo "#";
23
  }
24
 
25
  $clean_email = $wp_subscribe_reloaded->clean_email( $email );
26
+ $subscriber_salt = $wp_subscribe_reloaded->generate_temp_key( $clean_email );
27
 
28
  $headers = "MIME-Version: 1.0\n";
29
  $headers .= "From: $from_name <$from_email>\n";
36
  // Replace tags with their actual values
37
  $subject = str_replace( '[blog_name]', get_bloginfo( 'name' ), $subject );
38
  $message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $message );
39
+ $message = str_replace( '[manager_link]', '<a href="' . $manager_link . '">' . $manager_link . '</a>', $message );
40
 
41
  // QTranslate support
42
  if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
55
  if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
56
  $message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
57
  }
58
+ ?>
59
  <p><?php echo $message ?></p>
60
  <form action="<?php if ( $helper->verifyXSS( $_SERVER['REQUEST_URI'] ) ) {
61
  echo "#";
uninstall.php CHANGED
@@ -12,6 +12,7 @@ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}subscribe_reloaded" ); // Com
12
  $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
13
 
14
  // Goodbye options...
 
15
  delete_option( 'subscribe_reloaded_manager_page_enabled' );
16
  delete_option( 'subscribe_reloaded_manager_page' );
17
  delete_option( 'subscribe_reloaded_manager_page_title' );
12
  $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
13
 
14
  // Goodbye options...
15
+ delete_option( 'subscribe_reloaded_unique_key' );
16
  delete_option( 'subscribe_reloaded_manager_page_enabled' );
17
  delete_option( 'subscribe_reloaded_manager_page' );
18
  delete_option( 'subscribe_reloaded_manager_page_title' );