Changeset 707942
- Timestamp:
- 05/04/2013 04:52:25 PM (13 years ago)
- Location:
- anti-captcha/trunk
- Files:
-
- 2 edited
-
anti-captcha.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
anti-captcha/trunk/anti-captcha.php
r705485 r707942 4 4 Plugin URI: http://blog.fili.nl/wordpress-anti-captcha-plugin/ 5 5 Description: Anti-Captcha is a transparent captcha solution which does not require any end-user interaction 6 Version: 20130 4296 Version: 20130504 7 7 Author: Filidor Wiese 8 8 Author URI: http://www.fili.nl/ … … 38 38 function anti_captcha_process_comment($incoming_comment) 39 39 { 40 if (is_user_logged_in()) return $incoming_comment; 41 42 if (!anti_captcha_verify_token($_POST['anti-captcha-token'])) { 43 add_filter('pre_comment_approved', create_function('$a', 'return \'spam\';')); 40 // Default to spam 41 $commentStatus = 'spam'; 42 43 // Approve comment if user is logged in or provides a valid anti-capcha-token 44 if (is_user_logged_in() || anti_captcha_verify_token($_POST['anti-captcha-token'])) { 45 $commentStatus = '1'; 46 47 // If a mailaddress is provided, check it for format and MX-records 48 if (strlen($incoming_comment['comment_author_email'])) { 49 50 // If this test fails, hold comment for moderation 51 if (!anti_captcha_validate_email($incoming_comment['comment_author_email'])) { 52 $commentStatus = '0'; 53 } 54 } 44 55 } 45 56 57 add_filter('pre_comment_approved', create_function('$a', "return '" . $commentStatus . "';")); 58 46 59 return $incoming_comment; 47 60 } … … 72 85 } 73 86 } 87 88 function anti_captcha_validate_email($email) 89 { 90 if (!strstr($email,'@')) { return false; } 91 $email = strtolower($email); 92 93 list($local, $domain) = explode('@', $email); 94 if (count(dns_get_record($domain, DNS_MX)) < 1) { 95 return false; 96 } 97 98 $match_local = preg_match('#^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?)\.([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$#', $local); 99 $match_domain = preg_match('#^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?)\.([-]?)[0-9a-z]*([-]?[0-9a-z]+)+)*\.[a-z]{2,4}$#', $domain); 100 101 return ($match_local && $match_domain ? true : false); 102 } -
anti-captcha/trunk/readme.txt
r705485 r707942 5 5 Requires at least: 2.8.4 6 6 Tested up to: 3.5.1 7 Stable tag: 20130 4297 Stable tag: 20130504 8 8 9 9 Anti-Captcha is a transparent captcha solution which does not require any end-user interaction … … 54 54 == Changelog == 55 55 56 = 20130504 = 57 * Fixed a bug in which legitimate comments where always flagged for moderation 58 * Added a check on the format of the supplied mailaddress and it's MX-records (on fail, a comment will be held for moderation instead of being approved) 59 56 60 = 20130429 = 57 61 * Updated anti-captcha to version 0.3 which introduces a new DOMReady loading method
Note: See TracChangeset
for help on using the changeset viewer.