Cookies for Comments - Version 0.5.5

Version Description

Cookie key name sanitized before the cookie is set.

=

Download this release

Release Info

Developer donncha
Plugin Icon wp plugin Cookies for Comments
Version 0.5.5
Comparing to
See all releases

Code changes from version 0.5.4 to 0.5.5

Files changed (3) hide show
  1. cookies-for-comments.php +2 -2
  2. css.php +6 -2
  3. readme.txt +10 -2
cookies-for-comments.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cookies for Comments
4
  Plugin URI: http://ocaoimh.ie/cookies-for-comments/
5
  Description: Sets a cookie that must exist for a comment to be allowed through
6
- Version: 0.5.4
7
  Author: Donncha O Caoimh
8
  Author URI: http://ocaoimh.ie/
9
 
@@ -33,7 +33,7 @@ function cfc_img_html() {
33
  if ( $cfc_key == '' )
34
  return false;
35
 
36
- ?><img src="<?php echo plugins_url( "css.php?k={$cfc_key}&amp;o=i&amp;t=" . mt_rand(), __FILE__ ); ?>" width='1' height='1' /><?php
37
  }
38
  if ( get_option( 'cfc_delivery' ) == 'css' ) {
39
  add_action( 'wp_head', 'cfc_stylesheet_html' );
3
  Plugin Name: Cookies for Comments
4
  Plugin URI: http://ocaoimh.ie/cookies-for-comments/
5
  Description: Sets a cookie that must exist for a comment to be allowed through
6
+ Version: 0.5.5
7
  Author: Donncha O Caoimh
8
  Author URI: http://ocaoimh.ie/
9
 
33
  if ( $cfc_key == '' )
34
  return false;
35
 
36
+ ?><img alt='css.php' src="<?php echo plugins_url( "css.php?k={$cfc_key}&amp;o=i&amp;t=" . mt_rand(), __FILE__ ); ?>" width='1' height='1' /><?php
37
  }
38
  if ( get_option( 'cfc_delivery' ) == 'css' ) {
39
  add_action( 'wp_head', 'cfc_stylesheet_html' );
css.php CHANGED
@@ -1,6 +1,10 @@
1
  <?php
2
- if ( !isset( $_COOKIE[ $_GET[ 'k' ] ] ) || ( isset( $_COOKIE[ $_GET[ 'k' ] ] ) && $_COOKIE[ $_GET[ 'k' ] ] == 1 ) )
3
- @setcookie( $_GET[ 'k' ], time(), time()+604800, '/' );
 
 
 
 
4
  if ( isset( $_GET[ 'o' ] ) ) {
5
  header("Content-type: image/gif");
6
  readfile( './blank.gif' );
1
  <?php
2
+ if ( isset( $_GET[ 'k' ] ) ) {
3
+ $k = preg_replace( "/[^[:alnum:]]/i", "", $_GET[ 'k' ] );
4
+ if ( !isset( $_COOKIE[ $k ] ) || ( isset( $_COOKIE[ $k ] ) && $_COOKIE[ $k ] == 1 ) )
5
+ @setcookie( $k, time(), time()+604800, '/' );
6
+ }
7
+
8
  if ( isset( $_GET[ 'o' ] ) ) {
9
  header("Content-type: image/gif");
10
  readfile( './blank.gif' );
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Cookies for Comments ===
2
  Contributors: donncha, automattic
3
  Tags: cookies, comments, spam
4
- Tested up to: 3.5
5
- Stable tag: 0.5.4
6
  Requires at least: 3.1
7
 
8
  Sets a cookie on a random URL that is then checked when a comment is posted. If the cookie is missing the comment is marked as spam. This plugin will reduce your comment spam by at least 90%, probably.
@@ -24,8 +24,16 @@ If you use WordPress MU, replace wp-comments-post.php above with wp-signup.php t
24
  == Installation ==
25
  Copy into your plugins folder and activate. If you are using a caching plugin such as [WP Super Cache](http://ocaoimh.ie/wp-super-cache/) make sure you clear the cache after enabling this plugin.
26
 
 
 
 
 
 
27
  == Changelog ==
28
 
 
 
 
29
  = 0.5.4 =
30
  * Added a rejection message for when people trip over the cookie protection.
31
  * Plugin requires WordPress 3.1+ now.
1
  === Cookies for Comments ===
2
  Contributors: donncha, automattic
3
  Tags: cookies, comments, spam
4
+ Tested up to: 4.8
5
+ Stable tag: 0.5.5
6
  Requires at least: 3.1
7
 
8
  Sets a cookie on a random URL that is then checked when a comment is posted. If the cookie is missing the comment is marked as spam. This plugin will reduce your comment spam by at least 90%, probably.
24
  == Installation ==
25
  Copy into your plugins folder and activate. If you are using a caching plugin such as [WP Super Cache](http://ocaoimh.ie/wp-super-cache/) make sure you clear the cache after enabling this plugin.
26
 
27
+ == Upgrade Notice ==
28
+
29
+ = 0.5.5 =
30
+ Cookie key name sanitized before the cookie is set.
31
+
32
  == Changelog ==
33
 
34
+ = 0.5.5 =
35
+ * Sanitize the cookie key before setting it. Props Matt Cutts and @planetzuda
36
+
37
  = 0.5.4 =
38
  * Added a rejection message for when people trip over the cookie protection.
39
  * Plugin requires WordPress 3.1+ now.