Created
May 11, 2011 21:36
-
-
Save DamianZaremba/967423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r cluebotng_changes/reportinterface/includes/header.php cluebotng/reportinterface/includes/header.php | |
7d6 | |
< require_once 'includes/recaptchalib.php'; | |
22c21 | |
< ?> | |
--- | |
> ?> | |
\ No newline at end of file | |
Only in cluebotng_changes/reportinterface/includes: recaptchalib.php | |
diff -r cluebotng_changes/reportinterface/includes/settings.php cluebotng/reportinterface/includes/settings.php | |
8,9c8 | |
< $recaptcha_key = ''; | |
< ?> | |
--- | |
> ?> | |
\ No newline at end of file | |
diff -r cluebotng_changes/reportinterface/pages/View.page.php cluebotng/reportinterface/pages/View.page.php | |
19,41c19 | |
< if( $this->looks_like_spam($_POST[ 'comment' ]) === True ) { | |
< if( trim( $_POST[ 'recaptcha_challenge_field' ] ) != '' && trim( $_POST[ 'recaptcha_response_field' ] ) != '' ) { | |
< // Captcha submit - lets check it | |
< $resp = recaptcha_check_answer ($privatekey, | |
< $_SERVER["REMOTE_ADDR"], | |
< $_POST["recaptcha_challenge_field"], | |
< $_POST["recaptcha_response_field"]); | |
< | |
< if (!$resp->is_valid) { | |
< // Bad captcha, try again | |
< define("BAD_CAPTCHA", True); | |
< $this->writeContent(); | |
< } else { | |
< createComment( $this->id, $_POST[ 'user' ], $_POST[ 'comment' ] ); | |
< } | |
< } else { | |
< // Not a captcha submit, show box | |
< define("LOOKS_LIKE_SPAM", True); | |
< $this->writeContent(); | |
< } | |
< } else { | |
< createComment( $this->id, $_POST[ 'user' ], $_POST[ 'comment' ] ); | |
< } | |
--- | |
> createComment( $this->id, $_POST[ 'user' ], $_POST[ 'comment' ] ); | |
58,69d35 | |
< private function looks_like_spam($text) { | |
< if(preg_match("/\[url=(.*)\](.*)\[\/url\]/", $text)) { | |
< return True; | |
< } | |
< | |
< if(preg_match("/<a href=['\"](.*)['\"]>(.*)<\/a>/", $text)) { | |
< return True; | |
< } | |
< | |
< return False; | |
< } | |
< | |
79c45 | |
< ?> | |
--- | |
> ?> | |
\ No newline at end of file | |
diff -r cluebotng_changes/reportinterface/pages/View.tpl.php cluebotng/reportinterface/pages/View.tpl.php | |
99,107d98 | |
< <?php | |
< if( defined("LOOKS_LIKE_SPAM") ) { | |
< echo '<p>Sorry, your comment looks like spam. Please complete the captcha to continue.</p>'; | |
< } | |
< | |
< if( defined("BAD_CAPTCHA") ) { | |
< echo '<p>Sorry, you entered a bad captcha response. Please try again.</p>'; | |
< } | |
< ?> | |
118,127d108 | |
< <?php | |
< if( defined("LOOKS_LIKE_SPAM") ) { | |
< ?> | |
< <tr> | |
< <th>Spam check:</th> | |
< <td><?php echo recaptcha_get_html($recaptcha_key); ?></td></td> | |
< </tr> | |
< <?php | |
< } | |
< ?> | |
132c113 | |
< </form> | |
--- | |
> </form> | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment