summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/akismet/class.akismet-admin.php')
-rw-r--r--plugins/akismet/class.akismet-admin.php27
1 files changed, 25 insertions, 2 deletions
diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php
index f0766ebe..b5e2ef8e 100644
--- a/plugins/akismet/class.akismet-admin.php
+++ b/plugins/akismet/class.akismet-admin.php
@@ -80,6 +80,13 @@ class Akismet_Admin {
}
public static function admin_init() {
+ if ( get_option( 'Activated_Akismet' ) ) {
+ delete_option( 'Activated_Akismet' );
+ if ( ! headers_sent() ) {
+ wp_redirect( add_query_arg( array( 'page' => 'akismet-key-config', 'view' => 'start' ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'options-general.php' ) ) );
+ }
+ }
+
load_plugin_textdomain( 'akismet' );
add_meta_box( 'akismet-status', __('Comment History', 'akismet'), array( 'Akismet_Admin', 'comment_status_meta_box' ), 'comment', 'normal' );
@@ -396,8 +403,10 @@ class Akismet_Admin {
href="' . esc_url( $link ) . '"
data-active-label="' . esc_attr( __( 'Checking for Spam', 'akismet' ) ) . '"
data-progress-label-format="' . esc_attr( __( '(%1$s%)', 'akismet' ) ) . '"
- data-success-url="' . esc_attr( remove_query_arg( 'akismet_recheck', add_query_arg( array( 'akismet_recheck_complete' => 1, 'recheck_count' => urlencode( '__recheck_count__' ), 'spam_count' => urlencode( '__spam_count__' ) ) ) ) ) . '"
+ data-success-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_error' ), add_query_arg( array( 'akismet_recheck_complete' => 1, 'recheck_count' => urlencode( '__recheck_count__' ), 'spam_count' => urlencode( '__spam_count__' ) ) ) ) ) . '"
+ data-failure-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_complete' ), add_query_arg( array( 'akismet_recheck_error' => 1 ) ) ) ) . '"
data-pending-comment-count="' . esc_attr( $comments_count->moderated ) . '"
+ data-nonce="' . esc_attr( wp_create_nonce( 'akismet_check_for_spam' ) ) . '"
>';
echo '<span class="akismet-label">' . esc_html__('Check for Spam', 'akismet') . '</span>';
echo '<span class="checkforspam-progress"></span>';
@@ -414,6 +423,13 @@ class Akismet_Admin {
if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) {
return;
}
+
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'akismet_check_for_spam' ) ) {
+ wp_send_json( array(
+ 'error' => __( "You don't have permission to do that."),
+ ));
+ return;
+ }
$result_counts = self::recheck_queue_portion( empty( $_POST['offset'] ) ? 0 : $_POST['offset'], empty( $_POST['limit'] ) ? 100 : $_POST['limit'] );
@@ -1061,6 +1077,9 @@ class Akismet_Admin {
echo '<div class="notice notice-success"><p>' . esc_html( $message ) . '</p></div>';
}
+ else if ( isset( $_GET['akismet_recheck_error'] ) ) {
+ echo '<div class="notice notice-error"><p>' . esc_html( __( 'Akismet could not recheck your comments for spam.', 'akismet' ) ) . '</p></div>';
+ }
$akismet_comment_form_privacy_notice_option = get_option( 'akismet_comment_form_privacy_notice' );
if ( ! in_array( $akismet_comment_form_privacy_notice_option, array( 'hide', 'display' ) ) ) {
@@ -1108,7 +1127,11 @@ class Akismet_Admin {
if ( !class_exists('Jetpack') )
return false;
- Jetpack::load_xml_rpc_client();
+ if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) ) {
+ // For version of Jetpack prior to 7.7.
+ Jetpack::load_xml_rpc_client();
+ }
+
$xml = new Jetpack_IXR_ClientMulticall( array( 'user_id' => get_current_user_id() ) );
$xml->addCall( 'wpcom.getUserID' );