Changeset 3057012
- Timestamp:
- 03/22/2024 05:41:13 PM (5 months ago)
- Location:
- akismet/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
akismet/trunk/akismet.php
r3056338 r3057012 7 7 Plugin URI: https://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>. 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.3a 19 Version: 5.3.3a 10 10 Requires at least: 5.8 11 11 Requires PHP: 5.6.20 … … 40 40 } 41 41 42 define( 'AKISMET_VERSION', '5.3.3a 1' );42 define( 'AKISMET_VERSION', '5.3.3a' ); 43 43 define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' ); 44 44 define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
akismet/trunk/class.akismet.php
r3056338 r3057012 888 888 $comment_id = (int) $comment_id; 889 889 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 893 894 return; 894 895 if ( 'spam' != $comment->comment_approved ) 895 } 896 897 if ( 'spam' != $comment['comment_approved'] ) { 896 898 return; 899 897 900 898 901 self::update_comment_history( $comment_id, '', 'report-spam' ); … … 906 909 $as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) ); 907 910 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'] ); 931 938 932 939 if ( ! is_null( $post ) ) { 933 $comment ->comment_post_modified_gmt= $post->post_modified_gmt;940 $comment = $post->post_modified_gmt; 934 941 } 935 942 … … 940 947 update_comment_meta( $comment_id, 'akismet_user_result', 'true' ); 941 948 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 ); 944 951 } 945 952 … … 952 959 $comment_id = (int) $comment_id; 953 960 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 956 965 return; 966 957 967 958 968 self::update_comment_history( $comment_id, '', 'report-ham' ); … … 966 976 $as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) ); 967 977 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'] ); 991 1005 992 1006 if ( ! is_null( $post ) ) { 993 $comment ->comment_post_modified_gmt= $post->post_modified_gmt;1007 $comment = $post->post_modified_gmt; 994 1008 } 995 1009 … … 1000 1014 update_comment_meta( $comment_id, 'akismet_user_result', 'false' ); 1001 1015 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 ); 1004 1018 } 1005 1019
Note: See TracChangeset
for help on using the changeset viewer.