escape( $type ); return $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type' ORDER BY comment_date DESC LIMIT $start, $end"); } // All return $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = 'spam' ORDER BY comment_date DESC LIMIT $start, $end"); } // Totals for each comment type // returns array( type => count, ... ) function akismet_spam_totals() { global $wpdb; $totals = $wpdb->get_results( "SELECT comment_type, COUNT(*) AS cc FROM $wpdb->comments WHERE comment_approved = 'spam' GROUP BY comment_type" ); $return = array(); foreach ( $totals as $total ) $return[$total->comment_type ? $total->comment_type : 'comment'] = $total->cc; return $return; } function akismet_manage_page() { global $wpdb, $submenu, $wp_db_version; // WP 2.7 has its own spam management page if ( 8645 <= $wp_db_version ) return; $count = sprintf(__('Akismet Spam (%s)'), akismet_spam_count()); if ( isset( $submenu['edit-comments.php'] ) ) add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught' ); elseif ( function_exists('add_management_page') ) add_management_page(__('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught'); } function akismet_caught() { global $wpdb, $comment, $akismet_caught, $akismet_nonce; akismet_recheck_queue(); if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) { check_admin_referer( $akismet_nonce ); if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) die(__('You do not have sufficient permission to moderate comments.')); $i = 0; foreach ($_POST['not_spam'] as $comment): $comment = (int) $comment; if ( function_exists('wp_set_comment_status') ) wp_set_comment_status($comment, 'approve'); else $wpdb->query("UPDATE $wpdb->comments SET comment_approved = '1' WHERE comment_ID = '$comment'"); akismet_submit_nonspam_comment($comment); ++$i; endforeach; $to = add_query_arg( 'recovered', $i, $_SERVER['HTTP_REFERER'] ); wp_safe_redirect( $to ); exit; } if ('delete' == $_POST['action']) { check_admin_referer( $akismet_nonce ); if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) die(__('You do not have sufficient permission to moderate comments.')); $delete_time = $wpdb->escape( $_POST['display_time'] ); $comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); if ( !empty( $comment_ids ) ) { do_action( 'delete_comment', $comment_ids ); $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_id IN ( " . implode( ', ', $comment_ids ) . " )"); wp_cache_delete( 'akismet_spam_count', 'widget' ); } $to = add_query_arg( 'deleted', 'all', $_SERVER['HTTP_REFERER'] ); wp_safe_redirect( $to ); exit; } if ( isset( $_GET['recovered'] ) ) { $i = (int) $_GET['recovered']; echo '
' . sprintf(__('%1$s comments recovered.'), $i) . "
' . __('All spam deleted.') . '
%1$s spam for you since you first installed it.'), number_format_i18n($count) ); ?>
'.__('You have no spam currently in the queue. Must be your lucky day. :)').''; echo ''.__('You can delete all of the spam from your database with a single click. This operation cannot be undone, so you may wish to check to ensure that no legitimate comments got through first. Spam is automatically deleted after 15 days, so don’t sweat it.').'
'; ?>$r
"; ?>