From 5d88c4bff0f8b42e4f58a76007c66623cd1df2e8 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 10 Nov 2009 03:01:20 +0000 Subject: [PATCH] make recaptcha work --- ext/comment/main.php | 6 +++--- ext/comment/theme.php | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ext/comment/main.php b/ext/comment/main.php index 4d5f20f9..810036c4 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -342,8 +342,7 @@ class CommentList extends SimpleExtension { } private function is_spam_recaptcha($text) { - global $user; - global $config; + global $config, $user; if(strlen($config->get_string('comment_recaptcha_privkey')) > 0) { $resp = recaptcha_check_answer( @@ -353,7 +352,7 @@ class CommentList extends SimpleExtension { $_POST["recaptcha_response_field"]); if(!$resp->is_valid) { - log_info("Captcha failed: " . $resp->error); + log_info("comment", "Captcha failed: " . $resp->error); return true; } } @@ -362,6 +361,7 @@ class CommentList extends SimpleExtension { } private function is_spam_akismet($text) { + global $config, $user; if(strlen($config->get_string('comment_wordpress_key')) > 0) { $comment = array( 'author' => $user->name, diff --git a/ext/comment/theme.php b/ext/comment/theme.php index bd488673..2b22581b 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -145,11 +145,14 @@ class CommentListTheme extends Themelet { } protected function build_postbox($image_id) { + global $config, $user; + $i_image_id = int_escape($image_id); $hash = CommentList::get_hash(); $rpk = $config->get_string("comment_recaptcha_pubkey"); - $reca = empty($rpk) ? "" : recaptcha_get_html($rpk); + $reca = (!$user->is_anonymous() || empty($rpk)) ? + "" : recaptcha_get_html($rpk); return "