Trackback Validator and Spam entries in your WordPress Table comments. Version: 1.5 Author: Frank Bueltge Author URI: http://bueltge.de */ // How many files you will see? $paginationCount = 10000; // include language-file if(function_exists('load_plugin_textdomain')) load_plugin_textdomain('spamviewer','wp-content/plugins'); $fbtbv_link = $_SERVER['REQUEST_URI']; $fbtbv_link = str_replace("\\", "/", $fbtbv_link); // pagination if ($spam_count > $paginationCount) { $paginationMsg = $paginationCount . ' ' . __('from', 'spamviewer') . ' ' . $spam_count; } else { $paginationView = $spam_count; $paginationMsg = ''; } // Counter for spam entries in comments if (! function_exists('fbtbv_get_count')) { function fbtbv_get_count() { global $wpdb, $comments; $comments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'"); return $comments; } } // Counter for entries with type SPAM in db-table if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".$wpdb->prefix . 'tb_data'."'") ) == 1) { if (! function_exists('fbtbv_get_spam_count')) { function fbtbv_get_spam_count() { global $wpdb, $comments; $comments = $wpdb->get_var("SELECT COUNT(tb_ID) FROM " . $wpdb->prefix . 'tb_data' . " WHERE tb_type = 'spam'"); return $comments; } } } // variable for comment-counter if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".$wpdb->comments."'") ) == 1) { $count = fbtbv_get_count(); } else { $count = 0; } // variable for tb_data-counter if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".$wpdb->prefix . 'tb_data'."'") ) == 1) { $spam_count = fbtbv_get_spam_count(); } else { $spam_count = 0; } // Add page in WordPress-admin-panel if (! function_exists('fbtbv_delete_add_manage_page')) { function fbtbv_delete_add_manage_page() { global $wpdb, $count, $spam_count, $paginationCount, $paginationMsg; $viewcount = $spam_count + $count; // ask for wp-version if (function_exists('add_options_page')) if (get_bloginfo('version') <= '2.0.99') { add_management_page("Spam Viewer", 'SpamV ('.$viewcount.')', 8, __FILE__); // It's Wordpress 1.5.2 or 2.x. since it has been loaded successfully } else { add_submenu_page('edit-comments.php', 'Spam Viewer', 'SpamV ('.$viewcount.')', 8, __FILE__); // In Wordpress 2.1, a new file name is being used } } } // Delete entries in comment-table if (is_plugin_page()) { global $wpdb, $count, $spam_count; if ( ($_POST['action'] == 'comment_killed') ) { $killed = $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' LIMIT $paginationCount"); if (isset($killed)){ echo '
'; if ($killed) { echo __('Spam comments destroyed!', 'spamviewer'); } echo "
'; if ($killed) { echo __('Trackback-Spamentries destroyed!', 'spamviewer'); } echo "
' . __('No comments selected.', 'spamviewer') . "
' . sprintf(__('%s entry unspam.', 'spamviewer'), $i) . "
' . sprintf(__('%s entries unspam.', 'spamviewer'), $i) . "
'; _e('Congratulations, you are free of Spam!', 'spamviewer'); echo '
plugin\'s homepage.', 'spamviewer'); ?>
© Copyright 2006 - 2007 Frank Bültge | wishlist.', 'spamviewer'); ?>