Ticket #1028: comment-functions.php.patch
| File comment-functions.php.patch, 2.4 KB (added by ColdForged, 7 years ago) |
|---|
-
comment-functions.php
727 727 return false; // Check # of external links 728 728 729 729 $mod_keys = trim( get_settings('moderation_keys') ); 730 if ('' == $mod_keys )731 return true; // If moderation keys are empty 732 $words = explode("\n", $mod_keys );730 if ('' !== $mod_keys ) 731 { 732 $words = explode("\n", $mod_keys ); 733 733 734 foreach ($words as $word) {735 $word = trim($word);734 foreach ($words as $word) { 735 $word = trim($word); 736 736 737 // Skip empty lines738 if (empty($word)) { continue; }737 // Skip empty lines 738 if (empty($word)) { continue; } 739 739 740 // Do some escaping magic so that '#' chars in the741 // spam words don't break things:742 $word = preg_quote($word, '#');740 // Do some escaping magic so that '#' chars in the 741 // spam words don't break things: 742 $word = preg_quote($word, '#'); 743 743 744 $pattern = "#$word#i"; 745 if ( preg_match($pattern, $author) ) return false; 746 if ( preg_match($pattern, $email) ) return false; 747 if ( preg_match($pattern, $url) ) return false; 748 if ( preg_match($pattern, $comment) ) return false; 749 if ( preg_match($pattern, $user_ip) ) return false; 750 if ( preg_match($pattern, $user_agent) ) return false; 751 } 744 $pattern = "#$word#i"; 745 if ( preg_match($pattern, $author) ) return false; 746 if ( preg_match($pattern, $email) ) return false; 747 if ( preg_match($pattern, $url) ) return false; 748 if ( preg_match($pattern, $comment) ) return false; 749 if ( preg_match($pattern, $user_ip) ) return false; 750 if ( preg_match($pattern, $user_agent) ) return false; 751 } 752 } 752 753 753 754 // Comment whitelisting: 754 755 if ( 1 == get_settings('comment_whitelist')) { … … 760 761 else 761 762 return false; 762 763 } elseif( $author != '' && $email != '' ) { 763 $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' ");764 $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' LIMIT 1"); 764 765 if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) ) 765 766 return true; 766 767 else
