Akismet Anti-Spam - Version 3.1.8

Version Description

Release Date - 4 March 2016

  • Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs.
  • Reduced the amount of bandwidth used on Akismet API calls
  • Reduced the amount of space Akismet uses in the database
  • Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
Download this release

Release Info

Developer cfinke
Plugin Icon 128x128 Akismet Anti-Spam
Version 3.1.8
Comparing to
See all releases

Code changes from version 3.1.7 to 3.1.8

Files changed (4) hide show
  1. akismet.php +2 -3
  2. class.akismet-admin.php +3 -3
  3. class.akismet.php +24 -13
  4. readme.txt +9 -1
akismet.php CHANGED
@@ -6,7 +6,7 @@
6
  Plugin Name: Akismet
7
  Plugin URI: http://akismet.com/
8
  Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key.
9
- Version: 3.1.7
10
  Author: Automattic
11
  Author URI: http://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
@@ -37,9 +37,8 @@ if ( !function_exists( 'add_action' ) ) {
37
  exit;
38
  }
39
 
40
- define( 'AKISMET_VERSION', '3.1.7' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
42
- define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
43
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
44
  define( 'AKISMET_DELETE_LIMIT', 100000 );
45
 
6
  Plugin Name: Akismet
7
  Plugin URI: http://akismet.com/
8
  Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key.
9
+ Version: 3.1.8
10
  Author: Automattic
11
  Author URI: http://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
37
  exit;
38
  }
39
 
40
+ define( 'AKISMET_VERSION', '3.1.8' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
 
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 100000 );
44
 
class.akismet-admin.php CHANGED
@@ -111,10 +111,10 @@ class Akismet_Admin {
111
  'jetpack_page_akismet-key-config',
112
  'plugins.php',
113
  ) ) ) {
114
- wp_register_style( 'akismet.css', AKISMET__PLUGIN_URL . '_inc/akismet.css', array(), AKISMET_VERSION );
115
  wp_enqueue_style( 'akismet.css');
116
 
117
- wp_register_script( 'akismet.js', AKISMET__PLUGIN_URL . '_inc/akismet.js', array('jquery','postbox'), AKISMET_VERSION );
118
  wp_enqueue_script( 'akismet.js' );
119
  wp_localize_script( 'akismet.js', 'WPAkismet', array(
120
  'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ),
@@ -605,7 +605,7 @@ class Akismet_Admin {
605
  }
606
 
607
  public static function plugin_action_links( $links, $file ) {
608
- if ( $file == plugin_basename( AKISMET__PLUGIN_URL . '/akismet.php' ) ) {
609
  $links[] = '<a href="' . esc_url( self::get_page_url() ) . '">'.esc_html__( 'Settings' , 'akismet').'</a>';
610
  }
611
 
111
  'jetpack_page_akismet-key-config',
112
  'plugins.php',
113
  ) ) ) {
114
+ wp_register_style( 'akismet.css', plugin_dir_url( __FILE__ ) . '_inc/akismet.css', array(), AKISMET_VERSION );
115
  wp_enqueue_style( 'akismet.css');
116
 
117
+ wp_register_script( 'akismet.js', plugin_dir_url( __FILE__ ) . '_inc/akismet.js', array('jquery','postbox'), AKISMET_VERSION );
118
  wp_enqueue_script( 'akismet.js' );
119
  wp_localize_script( 'akismet.js', 'WPAkismet', array(
120
  'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ),
605
  }
606
 
607
  public static function plugin_action_links( $links, $file ) {
608
+ if ( $file == plugin_basename( plugin_dir_url( __FILE__ ) . '/akismet.php' ) ) {
609
  $links[] = '<a href="' . esc_url( self::get_page_url() ) . '">'.esc_html__( 'Settings' , 'akismet').'</a>';
610
  }
611
 
class.akismet.php CHANGED
@@ -119,13 +119,19 @@ class Akismet {
119
  $comment["POST_{$key}"] = $value;
120
  }
121
 
122
- $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
123
-
124
  foreach ( $_SERVER as $key => $value ) {
125
- if ( !in_array( $key, $ignore ) && is_string($value) )
126
- $comment["$key"] = $value;
127
- else
128
- $comment["$key"] = '';
 
 
 
 
 
 
 
 
129
  }
130
 
131
  $post = get_post( $comment['comment_post_ID'] );
@@ -712,15 +718,20 @@ class Akismet {
712
  && intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] )
713
  && (
714
  // The comment author length max is 255 characters, limited by the TINYTEXT column type.
715
- substr( $comment1['comment_author'], 0, 255 ) == substr( $comment2['comment_author'], 0, 255 )
716
- || substr( stripslashes( $comment1['comment_author'] ), 0, 255 ) == substr( $comment2['comment_author'], 0, 255 )
717
- || substr( $comment1['comment_author'], 0, 255 ) == substr( stripslashes( $comment2['comment_author'] ), 0, 255 )
 
 
 
 
718
  )
719
  && (
720
  // The email max length is 100 characters, limited by the VARCHAR(100) column type.
721
- substr( $comment1['comment_author_email'], 0, 100 ) == substr( $comment2['comment_author_email'], 0, 100 )
722
- || substr( stripslashes( $comment1['comment_author_email'] ), 0, 100 ) == substr( $comment2['comment_author_email'], 0, 100 )
723
- || substr( $comment1['comment_author_email'], 0, 100 ) == substr( stripslashes( $comment2['comment_author_email'] ), 0, 100 )
 
724
  // Very long emails can be truncated and then stripped if the [0:100] substring isn't a valid address.
725
  || ( ! $comment1['comment_author_email'] && strlen( $comment2['comment_author_email'] ) > 100 )
726
  || ( ! $comment2['comment_author_email'] && strlen( $comment1['comment_author_email'] ) > 100 )
@@ -956,7 +967,7 @@ class Akismet {
956
  public static function load_form_js() {
957
  // WP < 3.3 can't enqueue a script this late in the game and still have it appear in the footer.
958
  // Once we drop support for everything pre-3.3, this can change back to a single enqueue call.
959
- wp_register_script( 'akismet-form', AKISMET__PLUGIN_URL . '_inc/form.js', array(), AKISMET_VERSION, true );
960
  add_action( 'wp_footer', array( 'Akismet', 'print_form_js' ) );
961
  add_action( 'admin_footer', array( 'Akismet', 'print_form_js' ) );
962
  }
119
  $comment["POST_{$key}"] = $value;
120
  }
121
 
 
 
122
  foreach ( $_SERVER as $key => $value ) {
123
+ if ( ! is_string( $value ) ) {
124
+ continue;
125
+ }
126
+
127
+ if ( preg_match( "/^HTTP_COOKIE/", $key ) ) {
128
+ continue;
129
+ }
130
+
131
+ // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need.
132
+ if ( preg_match( "/^(HTTP_|REMOTE_ADDR|REQUEST_URI|DOCUMENT_URI)/", $key ) ) {
133
+ $form[ "$key" ] = $value;
134
+ }
135
  }
136
 
137
  $post = get_post( $comment['comment_post_ID'] );
718
  && intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] )
719
  && (
720
  // The comment author length max is 255 characters, limited by the TINYTEXT column type.
721
+ // If the comment author includes multibyte characters right around the 255-byte mark, they
722
+ // may be stripped when the author is saved in the DB, so a 300+ char author may turn into
723
+ // a 253-char author when it's saved, not 255 exactly. The longest possible character is
724
+ // theoretically 6 bytes, so we'll only look at the first 248 bytes to be safe.
725
+ substr( $comment1['comment_author'], 0, 248 ) == substr( $comment2['comment_author'], 0, 248 )
726
+ || substr( stripslashes( $comment1['comment_author'] ), 0, 248 ) == substr( $comment2['comment_author'], 0, 248 )
727
+ || substr( $comment1['comment_author'], 0, 248 ) == substr( stripslashes( $comment2['comment_author'] ), 0, 248 )
728
  )
729
  && (
730
  // The email max length is 100 characters, limited by the VARCHAR(100) column type.
731
+ // Same argument as above for only looking at the first 93 characters.
732
+ substr( $comment1['comment_author_email'], 0, 93 ) == substr( $comment2['comment_author_email'], 0, 93 )
733
+ || substr( stripslashes( $comment1['comment_author_email'] ), 0, 93 ) == substr( $comment2['comment_author_email'], 0, 93 )
734
+ || substr( $comment1['comment_author_email'], 0, 93 ) == substr( stripslashes( $comment2['comment_author_email'] ), 0, 93 )
735
  // Very long emails can be truncated and then stripped if the [0:100] substring isn't a valid address.
736
  || ( ! $comment1['comment_author_email'] && strlen( $comment2['comment_author_email'] ) > 100 )
737
  || ( ! $comment2['comment_author_email'] && strlen( $comment1['comment_author_email'] ) > 100 )
967
  public static function load_form_js() {
968
  // WP < 3.3 can't enqueue a script this late in the game and still have it appear in the footer.
969
  // Once we drop support for everything pre-3.3, this can change back to a single enqueue call.
970
+ wp_register_script( 'akismet-form', plugin_dir_url( __FILE__ ) . '_inc/form.js', array(), AKISMET_VERSION, true );
971
  add_action( 'wp_footer', array( 'Akismet', 'print_form_js' ) );
972
  add_action( 'admin_footer', array( 'Akismet', 'print_form_js' ) );
973
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eo
3
  Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 3.2
5
  Tested up to: 4.4.1
6
- Stable tag: 3.1.7
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
@@ -30,6 +30,14 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
 
 
33
  = 3.1.7 =
34
  *Release Date - 4 January 2016*
35
 
3
  Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 3.2
5
  Tested up to: 4.4.1
6
+ Stable tag: 3.1.8
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
30
 
31
  == Changelog ==
32
 
33
+ = 3.1.8 =
34
+ *Release Date - 4 March 2016*
35
+
36
+ * Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs.
37
+ * Reduced the amount of bandwidth used on Akismet API calls
38
+ * Reduced the amount of space Akismet uses in the database
39
+ * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
40
+
41
  = 3.1.7 =
42
  *Release Date - 4 January 2016*
43