Show
Ignore:
Timestamp:
05/09/08 11:29:00 (2 months ago)
Author:
ear1grey
Message:

Improved to count the number of obvious word matches and thus auto-select those authors which include more than a certain threshold of obvious words.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • worst-offenders/trunk/classes/obvious_name_litmus.php

    r44627 r45016  
    99*/ 
    1010 
    11 $obvious_words = "baccarat casino casinos cialis consolidation craps credit debit download gambling holdem kasino kredit payday payment poker ringtone ringtones roulette tramadol slots viagra xxx zocor"; 
     11$obvious_words = "baccarat cash casino casinos cialis consolidation craps credit debit download free gambling holdem kasino kredit loan payday payment poker ringtone ringtones roulette tramadol slots screensaver viagra xxx zocor"; 
    1212$obvious_words_array = explode(" ",$obvious_words); 
    1313 
     
    3232                  return self::runCachedMatchesQuery( 
    3333                        self::getName(), 
    34                         "SELECT comment_author, comment_id FROM wp_comments where comment_approved='spam' and MATCH (comment_author) AGAINST ('".$obvious_words."' IN BOOLEAN MODE);" 
     34                        "SELECT comment_author, comment_id, MATCH (comment_author) AGAINST ('".$obvious_words."' IN BOOLEAN MODE) as score FROM wp_comments where comment_approved='spam' and MATCH (comment_author) AGAINST ('".$obvious_words."' IN BOOLEAN MODE) order by score desc;" 
    3535                  ); 
    3636            } 
     
    5353                  $results = array(); 
    5454                  foreach($comments as $item) { 
     55                        $num=0; 
    5556                        $new_name_bits = array(); 
    5657                        $name_bits = explode(" ",strtolower($item->comment_author)); 
     
    5859                              if (in_array($name_bit,$obvious_words_array)) { 
    5960                                    $name_bit = "<strong>$name_bit</strong>"; 
     61                                    $num++; 
    6062                              } 
    6163                              $new_name_bits[] = $name_bit; 
    6264                        } 
    6365                        $item->comment_author = implode(" ",$new_name_bits); 
     66                        $item->num = $num; 
    6467                        $results[] = $item; 
    6568                  }