make recaptcha work
This commit is contained in:
		
							parent
							
								
									68df7b45e0
								
							
						
					
					
						commit
						5d88c4bff0
					
				@ -342,8 +342,7 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private function is_spam_recaptcha($text) {
 | 
						private function is_spam_recaptcha($text) {
 | 
				
			||||||
		global $user;
 | 
							global $config, $user;
 | 
				
			||||||
		global $config;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(strlen($config->get_string('comment_recaptcha_privkey')) > 0) {
 | 
							if(strlen($config->get_string('comment_recaptcha_privkey')) > 0) {
 | 
				
			||||||
			$resp = recaptcha_check_answer(
 | 
								$resp = recaptcha_check_answer(
 | 
				
			||||||
@ -353,7 +352,7 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
					$_POST["recaptcha_response_field"]);
 | 
										$_POST["recaptcha_response_field"]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if(!$resp->is_valid) {
 | 
								if(!$resp->is_valid) {
 | 
				
			||||||
				log_info("Captcha failed: " . $resp->error);
 | 
									log_info("comment", "Captcha failed: " . $resp->error);
 | 
				
			||||||
				return true;
 | 
									return true;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -362,6 +361,7 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private function is_spam_akismet($text) {
 | 
						private function is_spam_akismet($text) {
 | 
				
			||||||
 | 
							global $config, $user;
 | 
				
			||||||
		if(strlen($config->get_string('comment_wordpress_key')) > 0) {
 | 
							if(strlen($config->get_string('comment_wordpress_key')) > 0) {
 | 
				
			||||||
			$comment = array(
 | 
								$comment = array(
 | 
				
			||||||
				'author'       => $user->name,
 | 
									'author'       => $user->name,
 | 
				
			||||||
 | 
				
			|||||||
@ -145,11 +145,14 @@ class CommentListTheme extends Themelet {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected function build_postbox($image_id) {
 | 
						protected function build_postbox($image_id) {
 | 
				
			||||||
 | 
							global $config, $user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$i_image_id = int_escape($image_id);
 | 
							$i_image_id = int_escape($image_id);
 | 
				
			||||||
		$hash = CommentList::get_hash();
 | 
							$hash = CommentList::get_hash();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$rpk = $config->get_string("comment_recaptcha_pubkey");
 | 
							$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 "
 | 
							return "
 | 
				
			||||||
			<form action='".make_link("comment/add")."' method='POST'>
 | 
								<form action='".make_link("comment/add")."' method='POST'>
 | 
				
			||||||
				<input type='hidden' name='image_id' value='$i_image_id' />
 | 
									<input type='hidden' name='image_id' value='$i_image_id' />
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user