Changeset 2075
- Timestamp:
- 01/10/2005 08:21:06 PM (21 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
wp-admin/edit-comments.php (modified) (1 diff)
-
wp-admin/options-discussion.php (modified) (2 diffs)
-
wp-admin/upgrade-schema.php (modified) (3 diffs)
-
wp-includes/comment-functions.php (modified) (1 diff)
-
wp-includes/functions-post.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r1977 r2075 67 67 $offset = 0; 68 68 69 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments ORDER BY comment_date DESC LIMIT $offset,20");69 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $offset,20"); 70 70 } 71 71 if ('view' == $mode) { -
trunk/wp-admin/options-discussion.php
r1818 r2075 23 23 <form name="form1" method="post" action="options.php"> 24 24 <input type="hidden" name="action" value="update" /> 25 <input type="hidden" name="page_options" value="'default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','comment_whitelist','comment_max_links','moderation_keys' " />25 <input type="hidden" name="page_options" value="'default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','comment_whitelist','comment_max_links','moderation_keys','blacklist_keys'" /> 26 26 <fieldset class="options"> 27 27 <legend><?php _e('Usual settings for an article: <em>(These settings may be overridden for individual articles.)</em>') ?></legend> … … 80 80 </p> 81 81 <p> 82 <a id="retrospambutton" href="options-discussion.php?action=retrospam" title="Click this link to check old comments for spam that your current filters would catch.">Check past comments against current word list</a>82 <a id="retrospambutton" href="options-discussion.php?action=retrospam"><?php _e('Check past comments against moderation list'); ?></a> 83 83 </p> 84 </fieldset> 85 <fieldset class="options"> 86 <legend><?php _e('Comment Blacklist') ?></legend> 87 <p><?php _e('This is a list of words that you want completely blacklisted from your blog. Be very careful what you add here, because if a comment matches something here it will be completely nuked and there will be no notification. Remember that partial words can match, so if there is any chance something here might match it would be better to put it in the moderation box above.') ?></p> 88 <p> 89 <textarea name="blacklist_keys" cols="60" rows="4" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea> 90 </p> 84 91 </fieldset> 85 92 <p class="submit"> -
trunk/wp-admin/upgrade-schema.php
r2009 r2075 23 23 comment_content text NOT NULL, 24 24 comment_karma int(11) NOT NULL default '0', 25 comment_approved enum('0','1' ) NOT NULL default '1',25 comment_approved enum('0','1','spam') NOT NULL default '1', 26 26 comment_agent varchar(255) NOT NULL default '', 27 27 comment_type varchar(20) NOT NULL default '', … … 213 213 add_option('comment_whitelist', 1); 214 214 add_option('page_uris'); 215 add_option('blacklist_keys'); 215 216 216 217 // Delete unused options … … 221 222 222 223 // Set up a few options not to load by default 223 $fatoptions = array( 'moderation_keys', 'recently_edited' );224 $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' ); 224 225 foreach ($fatoptions as $fatoption) : 225 226 $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); 226 227 endforeach; 227 228 } 229 228 230 ?> -
trunk/wp-includes/comment-functions.php
r2068 r2075 725 725 if ( 1 == get_settings('comment_whitelist')) { 726 726 if( $author != '' && $email != '' ) { 727 $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author _email = '$email' and comment_approved = '1' ");727 $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' "); 728 728 if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) ) 729 729 return true; 730 730 } else { 731 731 return false; 732 }733 }734 735 // Useless numeric encoding is a pretty good spam indicator:736 // Extract entities:737 if (preg_match_all('/&#(\d+);/',$comment,$chars)) {738 foreach ($chars[1] as $char) {739 // If it's an encoded char in the normal ASCII set, reject740 if ($char < 128)741 return false;742 732 } 743 733 } -
trunk/wp-includes/functions-post.php
r2064 r2075 382 382 } 383 383 384 385 function wp_new_comment( $commentdata ) { 384 function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { 385 global $wpdb; 386 387 if ( preg_match_all('/&#(\d+);/', $comment, $chars) ) { 388 foreach ($chars[1] as $char) { 389 // If it's an encoded char in the normal ASCII set, reject 390 if ($char < 128) 391 return true; 392 } 393 } 394 395 $mod_keys = trim( get_settings('blacklist_keys') ); 396 if ('' == $mod_keys ) 397 return false; // If moderation keys are empty 398 $words = explode("\n", $mod_keys ); 399 400 foreach ($words as $word) { 401 $word = trim($word); 402 403 // Skip empty lines 404 if ( empty($word) ) { continue; } 405 406 // Do some escaping magic so that '#' chars in the 407 // spam words don't break things: 408 $word = preg_quote($word, '#'); 409 410 $pattern = "#$word#i"; 411 if ( preg_match($pattern, $author ) ) return true; 412 if ( preg_match($pattern, $email ) ) return true; 413 if ( preg_match($pattern, $url ) ) return true; 414 if ( preg_match($pattern, $comment ) ) return true; 415 if ( preg_match($pattern, $user_ip ) ) return true; 416 if ( preg_match($pattern, $user_agent) ) return true; 417 } 418 419 return false; 420 } 421 422 function wp_new_comment( $commentdata, $spam = false ) { 386 423 global $wpdb; 387 424 … … 413 450 } 414 451 415 if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent) )452 if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent) ) 416 453 $approved = 1; 417 454 else 418 455 $approved = 0; 456 if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) ) 457 $approved = 'spam'; 419 458 420 459 $result = $wpdb->query("INSERT INTO $wpdb->comments … … 427 466 do_action('comment_post', $comment_id); 428 467 429 if ( !$approved ) 430 wp_notify_moderator($comment_id); 431 432 if ( get_settings('comments_notify') && $approved ) 433 wp_notify_postauthor($comment_id, 'comment'); 468 if ( 'spam' != $approved ) { // If it's spam save it silently for later crunching 469 if ( !$approved ) 470 wp_notify_moderator($comment_id); 471 472 if ( get_settings('comments_notify') && $approved ) 473 wp_notify_postauthor($comment_id, 'comment'); 474 } 434 475 435 476 return $result;
Note: See TracChangeset
for help on using the changeset viewer.