Changeset 43791
- Timestamp:
- 05/01/08 09:15:21 (2 months ago)
- Files:
-
- worst-offenders/trunk/classes/domain_litmus.php (modified) (2 diffs)
- worst-offenders/trunk/classes/email_litmus.php (modified) (3 diffs)
- worst-offenders/trunk/classes/ip_litmus.php (modified) (2 diffs)
- worst-offenders/trunk/classes/litmus.php (modified) (1 diff)
- worst-offenders/trunk/classes/md5_litmus.php (modified) (1 diff)
- worst-offenders/trunk/classes/multilink_litmus.php (modified) (2 diffs)
- worst-offenders/trunk/classes/name_length_litmus.php (modified) (1 diff)
- worst-offenders/trunk/classes/obvious_name_litmus.php (modified) (1 diff)
- worst-offenders/trunk/functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
worst-offenders/trunk/classes/domain_litmus.php
r39125 r43791 22 22 23 23 public static function getMatches() { 24 global $keys ;24 global $keys, $wpdb; 25 25 $lower_limit = get_option( $keys['ui_vis'] ); 26 $wpdb->get_results("SET SESSION group_concat_max_len = 8192"); 26 27 return self::runCachedMatchesQuery( 27 28 self::getName(), … … 32 33 function content() { 33 34 if (DomainLitmus::isActive() || AllLitmus::isActive() ) { 35 echo("<table>"); 34 36 $comments = DomainLitmus::getMatches(); 35 echo("<table>"); 37 if (self::isActive()) { 38 self::wo3_include_select_all($comments); 39 } 36 40 foreach($comments as $comment) { 37 Litmus::wo3_show_row($comment->num, "comments from ".$comment->comment_author_url_simplified, $comment->comment_id_list);41 self::wo3_show_row($comment->num, "comments from ".$comment->comment_author_url_simplified, $comment->comment_id_list); 38 42 } 39 43 echo("</table>"); worst-offenders/trunk/classes/email_litmus.php
r39125 r43791 31 31 32 32 function content() { 33 if ( EmailLitmus::isActive() || AllLitmus::isActive() ) { 33 if ( self::isActive() || AllLitmus::isActive() ) { 34 echo("<table>"); 34 35 $comments = EmailLitmus::getMatches(); 35 echo("<table>"); 36 37 if (self::isActive()) { 38 self::wo3_include_select_all($comments); 39 } 40 36 41 foreach($comments as $comment) { 37 42 Litmus::wo3_show_row($comment->num, "comments from ".$comment->comment_author_email, $comment->comment_id_list); … … 46 51 47 52 //============================================ 48 // common class methods for litmus tests 53 // common class methods for litmus tests: 49 54 // (there's got to be a better way to do this! 55 // somebody please tell me what it is, because 56 // include doesn't work in objects and moving 57 // these to the superclass results in getName() 58 // (etc) not referencing the subclass. 50 59 //============================================ 51 60 52 61 function getCount() { 53 62 global $wo3_title; … … 55 64 return wp_cache_get(self::getName()."_count", $wo3_title); 56 65 } 57 66 58 67 public static function tab() { 59 68 parent::tab(self::getName(), self::getCount(), self::isActive()); 60 69 } 61 70 62 71 function isActive() { 63 72 return ($_GET['tab'] == self::getName() ) && parent::isActive(); worst-offenders/trunk/classes/ip_litmus.php
r39125 r43791 22 22 23 23 public static function getMatches() { 24 global $keys ;24 global $keys, $wpdb; 25 25 $lower_limit = get_option( $keys['ui_vis'] ); 26 $wpdb->get_results("SET SESSION group_concat_max_len = 8192"); 26 27 return self::runCachedMatchesQuery( 27 28 self::getName(), 28 "select comment_author_ip, count(comment_id) as num, group_concat(comment_ID separator ',') as comment_id_list from wp_comments where comment_approved='spam' group by comment_author_ip having num >= $lower_limit order by num ;"29 "select comment_author_ip, count(comment_id) as num, group_concat(comment_ID separator ',') as comment_id_list from wp_comments where comment_approved='spam' group by comment_author_ip having num >= $lower_limit order by num desc;" 29 30 ); 30 31 } … … 32 33 function content() { 33 34 if (IPLitmus::isActive() || AllLitmus::isActive()) { 34 $comments = IPLitmus::getMatches();35 $comments = self::getMatches(); 35 36 echo("<table>"); 37 38 if (self::isActive()) { 39 self::wo3_include_select_all($comments); 40 } 41 36 42 foreach($comments as $comment) { 37 43 Litmus::wo3_show_row($comment->num, "messages from ".$comment->comment_author_ip, $comment->comment_id_list); worst-offenders/trunk/classes/litmus.php
r39125 r43791 85 85 } 86 86 87 88 public static function wo3_show_rows($num, $comments) { 89 foreach($comments as $comment) { 90 self::wo3_show_row(1, $comment->comment_author, $comment->comment_id); 91 } 92 } 93 94 95 public static function wo3_include_select_all($comments) { 96 if (sizeof($comments) > 0) { 97 echo("<tr><td><input id='all' type='checkbox' onclick='toggleCheck(this)' name='' value='' /></td><td></td><td>Select all</td></tr>"); 98 } 99 } 100 87 101 function link_to_comments($comma_separated_list) { 88 102 foreach( explode( ",", $comma_separated_list ) as $id ) { worst-offenders/trunk/classes/md5_litmus.php
r39125 r43791 32 32 function content() { 33 33 if (self::isActive() || AllLitmus::isActive()) { 34 echo("<table>"); 34 35 $comments = self::getMatches(); 35 echo("<table>"); 36 if (!AllLitmus::isActive()) echo("<tr><th></th><th>Links</th><th>Message ID</th></tr>"); 36 if (self::isActive()) { 37 self::wo3_include_select_all($comments); 38 } 37 39 foreach($comments as $comment) { 38 40 Litmus::wo3_show_row($comment->num, "messages match MD5(".$comment->comment_content_md5.")", $comment->comment_id_list); worst-offenders/trunk/classes/multilink_litmus.php
r39125 r43791 22 22 23 23 public static function getMatches() { 24 global $keys ;24 global $keys, $wpdb; 25 25 $lower_limit = get_option( $keys['ui_vis'] ); 26 $wpdb->get_results("SET SESSION group_concat_max_len = 8192"); 26 27 return self::runCachedMatchesQuery( 27 28 self::getName(), … … 31 32 function content() { 32 33 if (self::isActive() || AllLitmus::isActive()) { 34 echo("<table>"); 33 35 $comments = MultiLinkLitmus::getMatches(); 34 echo("<table>"); 36 if (self::isActive()) { 37 self::wo3_include_select_all($comments); 38 } 35 39 foreach($comments as $comment) { 36 Litmus::wo3_show_row($comment->num, "links found in", $comment->comment_id_list );40 self::wo3_show_row($comment->num, "links found in", $comment->comment_id_list ); 37 41 } 38 42 echo("</table>"); worst-offenders/trunk/classes/name_length_litmus.php
r35682 r43791 33 33 $comments = self::getMatches(); 34 34 echo("<table>"); 35 foreach($comments as $comment) { 36 self::wo3_show_row(1, $comment->comment_author, $comment->comment_id); 35 36 if (self::isActive()) { 37 self::wo3_include_select_all($comments); 37 38 } 39 40 self::wo3_show_rows(1, $comments); 38 41 echo("</table>"); 39 42 } worst-offenders/trunk/classes/obvious_name_litmus.php
r39125 r43791 34 34 function content() { 35 35 if (self::isActive() || AllLitmus::isActive()) { 36 echo("<table>"); 36 37 $comments = self::getMatches(); 37 echo("<table>"); 38 foreach($comments as $comment) { 39 self::wo3_show_row(1, $comment->comment_author, $comment->comment_id); 38 if (self::isActive()) { 39 self::wo3_include_select_all($comments); 40 40 } 41 self::wo3_show_rows(1, $comments); 41 42 echo("</table>"); 42 43 } worst-offenders/trunk/functions.php
r39125 r43791 251 251 function do_delete($comma_separated_id_list) { 252 252 global $wpdb, $keys; 253 254 $query = "delete from wp_comments where comment_ID in ($comma_separated_id_list)"; 253 $query = "delete from wp_comments where comment_ID in ($comma_separated_id_list)"; 255 254 $result = $wpdb->query($query); 256 255 return $result; … … 264 263 <ul class="wo3_tabs"> 265 264 <?php 266 do_action( "wo3_tabs" );265 do_action( "wo3_tabs" ); 267 266 ?> 268 267 </ul> 269 268 269 <script type="text/javascript"> 270 function toggleCheck(me) { 271 var new_value = me.checked; 272 for(i=0; i<me.form.length;i++){ 273 if(me.form[i].type == 'checkbox') { 274 me.form[i].checked = new_value; 275 } 276 } 277 } 278 </script> 270 279 271 280 <form method="post" action=""> 281 <input type="submit" class="button delete" name="submit" value="<?php _e('Delete selected'); ?>" /> 272 282 <?php do_action( "wo3_content" ); ?> 273 283 <input type="hidden" name="act" value="delete" /> … … 282 292 if (!empty($_POST['worst'])) { 283 293 $deletionList = implode(",", $_POST['worst']); 294 // $wo3_feedback[] = "<div class='updated'>$deletionList</div>"; 284 295 $deleted = do_delete($deletionList); 285 296 if ($deleted === false) { 286 297 $wo3_feedback[] = "<div class='updated'>DB Error - Failed to delete - Boo! Perhaps the DB log can help!</div>"; 287 298 } else { 288 $wo3_feedback[] = "<div class='updated'>Congratulations , you just deleted <strong>$deleted</strong> spam comments!</div>";299 $wo3_feedback[] = "<div class='updated'>Congratulations! You just ignored <strong>$deleted</strong> servings of spam!</div>"; 289 300 update_option( $keys['counter'], $deleted + get_option( $keys['counter'] ) ); 290 301 reset_current_count();
