Plugin Directory

Changeset 3057012

Timestamp:
03/22/2024 05:41:13 PM (5 months ago)
Author:
cfinke
Message:

The akismet_request_args filter, which is not yet used anywhere, expects an array of values. These two functions were sending it an object.

Location:
akismet/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • akismet/trunk/akismet.php

    r3056338 r3057012  
    77Plugin URI: https://akismet.com/
    88Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
    9 Version: 5.3.3a1
     9Version: 5.3.3a
    1010Requires at least: 5.8
    1111Requires PHP: 5.6.20
     
    4040}
    4141
    42 define( 'AKISMET_VERSION', '5.3.3a1' );
     42define( 'AKISMET_VERSION', '5.3.3a' );
    4343define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' );
    4444define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • akismet/trunk/class.akismet.php

    r3056338 r3057012  
    888888        $comment_id = (int) $comment_id;
    889889
    890         $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ) );
    891 
    892         if ( !$comment ) // it was deleted
     890        $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ), ARRAY_A );
     891
     892        if ( ! $comment ) {
     893            // it was deleted
    893894            return;
    894 
    895         if ( 'spam' != $comment->comment_approved )
     895        }
     896
     897        if ( 'spam' != $comment['comment_approved'] ) {
    896898            return;
     899
    897900
    898901        self::update_comment_history( $comment_id, '', 'report-spam' );
     
    906909        $as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) );
    907910
    908         if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) )
    909             $comment = (object) array_merge( (array)$comment, $as_submitted );
    910 
    911         $comment->blog         = get_option( 'home' );
    912         $comment->blog_lang    = get_locale();
    913         $comment->blog_charset = get_option('blog_charset');
    914         $comment->permalink    = get_permalink($comment->comment_post_ID);
    915 
    916         if ( is_object($current_user) )
    917             $comment->reporter = $current_user->user_login;
    918 
    919         if ( is_object($current_site) )
    920             $comment->site_domain = $current_site->domain;
    921 
    922         $comment->user_role = '';
    923         if ( ! empty( $comment->user_ID ) ) {
    924             $comment->user_role = Akismet::get_user_roles( $comment->user_ID );
    925         }
    926 
    927         if ( self::is_test_mode() )
    928             $comment->is_test = 'true';
    929 
    930         $post = get_post( $comment->comment_post_ID );
     911        if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) {
     912            $comment = array_merge( $comment, $as_submitted );
     913        }
     914
     915        $comment['blog'] = get_option( 'home' );
     916        $comment['blog_lang'] = get_locale();
     917        $comment['blog_charset'] = get_option( 'blog_charset' );
     918        $comment['permalink'] = get_permalink( $comment['comment_post_ID'] );
     919
     920        if ( is_object( $current_user ) ) {
     921            $comment['reporter'] = $current_user->user_login;
     922        }
     923
     924        if ( is_object( $current_site ) ) {
     925            $comment['site_domain'] = $current_site->domain;
     926        }
     927
     928        $comment['user_role'] = '';
     929        if ( ! empty( $comment['user_ID'] ) ) {
     930            $comment['user_role'] = self::get_user_roles( $comment['user_ID'] );
     931        }
     932
     933        if ( self::is_test_mode() ) {
     934            $comment['is_test'] = 'true';
     935        }
     936
     937        $post = get_post( $comment['comment_post_ID'] );
    931938
    932939        if ( ! is_null( $post ) ) {
    933             $comment->comment_post_modified_gmt = $post->post_modified_gmt;
     940            $comment = $post->post_modified_gmt;
    934941        }
    935942
     
    940947        update_comment_meta( $comment_id, 'akismet_user_result', 'true' );
    941948
    942         if ( $comment->reporter ) {
    943             update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
     949        if ( $comment ) {
     950            update_comment_meta( $comment_id, 'akismet_user', $comment );
    944951        }
    945952
     
    952959        $comment_id = (int) $comment_id;
    953960
    954         $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ) );
    955         if ( !$comment ) // it was deleted
     961        $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ), ARRAY_A );
     962
     963        if ( ! $comment ) {
     964            // it was deleted
    956965            return;
     966
    957967
    958968        self::update_comment_history( $comment_id, '', 'report-ham' );
     
    966976        $as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) );
    967977
    968         if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) )
    969             $comment = (object) array_merge( (array)$comment, $as_submitted );
    970 
    971         $comment->blog         = get_option( 'home' );
    972         $comment->blog_lang    = get_locale();
    973         $comment->blog_charset = get_option('blog_charset');
    974         $comment->permalink    = get_permalink( $comment->comment_post_ID );
    975         $comment->user_role    = '';
    976 
    977         if ( is_object($current_user) )
    978             $comment->reporter = $current_user->user_login;
    979 
    980         if ( is_object($current_site) )
    981             $comment->site_domain = $current_site->domain;
    982 
    983         if ( ! empty( $comment->user_ID ) ) {
    984             $comment->user_role = Akismet::get_user_roles( $comment->user_ID );
    985         }
    986 
    987         if ( Akismet::is_test_mode() )
    988             $comment->is_test = 'true';
    989 
    990         $post = get_post( $comment->comment_post_ID );
     978        if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) {
     979            $comment = array_merge( $comment, $as_submitted );
     980        }
     981
     982        $comment['blog'] = get_option( 'home' );
     983        $comment['blog_lang'] = get_locale();
     984        $comment['blog_charset'] = get_option( 'blog_charset' );
     985        $comment['permalink'] = get_permalink( $comment['comment_post_ID'] );
     986        $comment['user_role'] = '';
     987
     988        if ( is_object( $current_user ) ) {
     989            $comment['reporter'] = $current_user->user_login;
     990        }
     991
     992        if ( is_object( $current_site ) ) {
     993            $comment['site_domain'] = $current_site->domain;
     994        }
     995
     996        if ( ! empty( $comment['user_ID'] ) ) {
     997            $comment['user_role'] = self::get_user_roles( $comment['user_ID'] );
     998        }
     999
     1000        if ( self::is_test_mode() ) {
     1001            $comment['is_test'] = 'true';
     1002        }
     1003
     1004        $post = get_post( $comment['comment_post_ID'] );
    9911005
    9921006        if ( ! is_null( $post ) ) {
    993             $comment->comment_post_modified_gmt = $post->post_modified_gmt;
     1007            $comment = $post->post_modified_gmt;
    9941008        }
    9951009
     
    10001014        update_comment_meta( $comment_id, 'akismet_user_result', 'false' );
    10011015
    1002         if ( $comment->reporter ) {
    1003             update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
     1016        if ( $comment ) {
     1017            update_comment_meta( $comment_id, 'akismet_user', $comment );
    10041018        }
    10051019
Note: See TracChangeset for help on using the changeset viewer.