Ticket #36401: akismet-3.1.10.patch
| File akismet-3.1.10.patch, 11.7 KB (added by , 10 years ago) |
|---|
-
wp-content/plugins/akismet/akismet.php
diff -ru wordpress-4.4.2/wp-content/plugins/akismet/akismet.php wordpress-4.4.2-akismetbump/wp-content/plugins/akismet/akismet.php
old new 6 6 Plugin Name: Akismet 7 7 Plugin URI: http://akismet.com/ 8 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. 79 Version: 3.1.10 10 10 Author: Automattic 11 11 Author URI: http://automattic.com/wordpress-plugins/ 12 12 License: GPLv2 or later … … 37 37 exit; 38 38 } 39 39 40 define( 'AKISMET_VERSION', '3.1. 7' );40 define( 'AKISMET_VERSION', '3.1.10' ); 41 41 define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' ); 42 define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );43 42 define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 44 43 define( 'AKISMET_DELETE_LIMIT', 100000 ); 45 44 -
wp-content/plugins/akismet/class.akismet-admin.php
diff -ru wordpress-4.4.2/wp-content/plugins/akismet/class.akismet-admin.php wordpress-4.4.2-akismetbump/wp-content/plugins/akismet/class.akismet-admin.php
old new 111 111 'jetpack_page_akismet-key-config', 112 112 'plugins.php', 113 113 ) ) ) { 114 wp_register_style( 'akismet.css', AKISMET__PLUGIN_URL. '_inc/akismet.css', array(), AKISMET_VERSION );114 wp_register_style( 'akismet.css', plugin_dir_url( __FILE__ ) . '_inc/akismet.css', array(), AKISMET_VERSION ); 115 115 wp_enqueue_style( 'akismet.css'); 116 116 117 wp_register_script( 'akismet.js', AKISMET__PLUGIN_URL. '_inc/akismet.js', array('jquery','postbox'), AKISMET_VERSION );117 wp_register_script( 'akismet.js', plugin_dir_url( __FILE__ ) . '_inc/akismet.js', array('jquery','postbox'), AKISMET_VERSION ); 118 118 wp_enqueue_script( 'akismet.js' ); 119 119 wp_localize_script( 'akismet.js', 'WPAkismet', array( 120 120 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ), … … 605 605 } 606 606 607 607 public static function plugin_action_links( $links, $file ) { 608 if ( $file == plugin_basename( AKISMET__PLUGIN_URL. '/akismet.php' ) ) {608 if ( $file == plugin_basename( plugin_dir_url( __FILE__ ) . '/akismet.php' ) ) { 609 609 $links[] = '<a href="' . esc_url( self::get_page_url() ) . '">'.esc_html__( 'Settings' , 'akismet').'</a>'; 610 610 } 611 611 -
wp-content/plugins/akismet/class.akismet.php
diff -ru wordpress-4.4.2/wp-content/plugins/akismet/class.akismet.php wordpress-4.4.2-akismetbump/wp-content/plugins/akismet/class.akismet.php
old new 53 53 54 54 // Run this early in the pingback call, before doing a remote fetch of the source uri 55 55 add_action( 'xmlrpc_call', array( 'Akismet', 'pre_check_pingback' ) ); 56 57 // Jetpack compatibility 58 add_filter( 'jetpack_options_whitelist', array( 'Akismet', 'add_to_jetpack_options_whitelist' ) ); 59 add_action( 'update_option_wordpress_api_key', array( 'Akismet', 'updated_option' ), 10, 2 ); 56 60 } 57 61 58 62 public static function get_api_key() { … … 81 85 return $response[1]; 82 86 } 83 87 88 /** 89 * Add the akismet option to the Jetpack options management whitelist. 90 * 91 * @param array $options The list of whitelisted option names. 92 * @return array The updated whitelist 93 */ 94 public static function add_to_jetpack_options_whitelist( $options ) { 95 $options[] = 'wordpress_api_key'; 96 return $options; 97 } 98 99 /** 100 * When the akismet option is updated, run the registration call. 101 * 102 * This should only be run when the option is updated from the Jetpack/WP.com 103 * API call, and only if the new key is different than the old key. 104 * 105 * @param mixed $old_value The old option value. 106 * @param mixed $value The new option value. 107 */ 108 public static function updated_option( $old_value, $value ) { 109 // Not an API call 110 if ( ! class_exists( 'WPCOM_JSON_API_Update_Option_Endpoint' ) ) { 111 return; 112 } 113 // Only run the registration if the old key is different. 114 if ( $old_value !== $value ) { 115 self::verify_key( $value ); 116 } 117 } 118 84 119 public static function auto_check_comment( $commentdata ) { 85 120 self::$last_comment_result = null; 86 121 … … 119 154 $comment["POST_{$key}"] = $value; 120 155 } 121 156 122 $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );123 124 157 foreach ( $_SERVER as $key => $value ) { 125 if ( !in_array( $key, $ignore ) && is_string($value) ) 126 $comment["$key"] = $value; 127 else 128 $comment["$key"] = ''; 158 if ( ! is_string( $value ) ) { 159 continue; 160 } 161 162 if ( preg_match( "/^HTTP_COOKIE/", $key ) ) { 163 continue; 164 } 165 166 // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. 167 if ( preg_match( "/^(HTTP_|REMOTE_ADDR|REQUEST_URI|DOCUMENT_URI)/", $key ) ) { 168 $comment[ "$key" ] = $value; 169 } 129 170 } 130 171 131 172 $post = get_post( $comment['comment_post_ID'] ); … … 248 289 elseif ( self::$last_comment['akismet_result'] == 'false' ) { 249 290 update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' ); 250 291 self::update_comment_history( $comment->comment_ID, '', 'check-ham' ); 251 if ( $comment->comment_approved == 'spam' ) { 292 // Status could be spam or trash, depending on the WP version and whether this change applies: 293 // https://core.trac.wordpress.org/changeset/34726 294 if ( $comment->comment_approved == 'spam' || $comment->comment_approved == 'trash' ) { 252 295 if ( wp_blacklist_check($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent) ) 253 296 self::update_comment_history( $comment->comment_ID, '', 'wp-blacklisted' ); 254 297 else … … 707 750 $comment1 = (array) $comment1; 708 751 $comment2 = (array) $comment2; 709 752 710 return(753 $comments_match = ( 711 754 isset( $comment1['comment_post_ID'], $comment2['comment_post_ID'] ) 712 755 && intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] ) 713 756 && ( 714 757 // 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 ) 758 // If the comment author includes multibyte characters right around the 255-byte mark, they 759 // may be stripped when the author is saved in the DB, so a 300+ char author may turn into 760 // a 253-char author when it's saved, not 255 exactly. The longest possible character is 761 // theoretically 6 bytes, so we'll only look at the first 248 bytes to be safe. 762 substr( $comment1['comment_author'], 0, 248 ) == substr( $comment2['comment_author'], 0, 248 ) 763 || substr( stripslashes( $comment1['comment_author'] ), 0, 248 ) == substr( $comment2['comment_author'], 0, 248 ) 764 || substr( $comment1['comment_author'], 0, 248 ) == substr( stripslashes( $comment2['comment_author'] ), 0, 248 ) 765 // Certain long comment author names will be truncated to nothing, depending on their encoding. 766 || ( ! $comment1['comment_author'] && strlen( $comment2['comment_author'] ) > 248 ) 767 || ( ! $comment2['comment_author'] && strlen( $comment1['comment_author'] ) > 248 ) 718 768 ) 719 769 && ( 720 770 // 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 ) 771 // Same argument as above for only looking at the first 93 characters. 772 substr( $comment1['comment_author_email'], 0, 93 ) == substr( $comment2['comment_author_email'], 0, 93 ) 773 || substr( stripslashes( $comment1['comment_author_email'] ), 0, 93 ) == substr( $comment2['comment_author_email'], 0, 93 ) 774 || substr( $comment1['comment_author_email'], 0, 93 ) == substr( stripslashes( $comment2['comment_author_email'] ), 0, 93 ) 724 775 // Very long emails can be truncated and then stripped if the [0:100] substring isn't a valid address. 725 776 || ( ! $comment1['comment_author_email'] && strlen( $comment2['comment_author_email'] ) > 100 ) 726 777 || ( ! $comment2['comment_author_email'] && strlen( $comment1['comment_author_email'] ) > 100 ) 727 778 ) 728 779 ); 780 781 return $comments_match; 729 782 } 730 783 731 784 // Does the supplied comment match the details of the one most recently stored in self::$last_comment? … … 956 1009 public static function load_form_js() { 957 1010 // WP < 3.3 can't enqueue a script this late in the game and still have it appear in the footer. 958 1011 // 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 );1012 wp_register_script( 'akismet-form', plugin_dir_url( __FILE__ ) . '_inc/form.js', array(), AKISMET_VERSION, true ); 960 1013 add_action( 'wp_footer', array( 'Akismet', 'print_form_js' ) ); 961 1014 add_action( 'admin_footer', array( 'Akismet', 'print_form_js' ) ); 962 1015 } … … 1153 1206 1154 1207 return $meta_value; 1155 1208 } 1156 } 1157 No newline at end of file 1209 } -
wp-content/plugins/akismet/readme.txt
diff -ru wordpress-4.4.2/wp-content/plugins/akismet/readme.txt wordpress-4.4.2-akismetbump/wp-content/plugins/akismet/readme.txt
old new 2 2 Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs 3 3 Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments 4 4 Requires at least: 3.2 5 Tested up to: 4. 4.16 Stable tag: 3.1. 75 Tested up to: 4.5 6 Stable tag: 3.1.10 7 7 License: GPLv2 or later 8 8 9 9 Akismet checks your comments against the Akismet Web service to see if they look like spam or not. … … 30 30 31 31 == Changelog == 32 32 33 = 3.1.10 = 34 *Release Date - 1 April 2016* 35 36 * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. 37 * Fixed a bug that could have resulted in comments that were caught by the core WordPress comment blacklist not to have a corresponding History entry. 38 * Fixed a bug that could have caused avoidable PHP warnings in the error log. 39 40 = 3.1.9 = 41 *Release Date - 28 March 2016* 42 43 * Add compatibility with Jetpack so that Jetpack can automatically configure Akismet settings when appropriate. 44 * Fixed a bug preventing some comment data from being sent to Akismet. 45 46 = 3.1.8 = 47 *Release Date - 4 March 2016* 48 49 * Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs. 50 * Reduced the amount of bandwidth used on Akismet API calls 51 * Reduced the amount of space Akismet uses in the database 52 * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. 53 33 54 = 3.1.7 = 34 55 *Release Date - 4 January 2016* 35 56
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)