remote api keys in their own block
This commit is contained in:
		
							parent
							
								
									5d88c4bff0
								
							
						
					
					
						commit
						92c8738747
					
				@ -193,11 +193,6 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
		$sb->add_label("<br>Show ");
 | 
							$sb->add_label("<br>Show ");
 | 
				
			||||||
		$sb->add_int_option("comment_list_count");
 | 
							$sb->add_int_option("comment_list_count");
 | 
				
			||||||
		$sb->add_label(" comments per image on the list");
 | 
							$sb->add_label(" comments per image on the list");
 | 
				
			||||||
		$sb->add_label("<br> <br><a href='http://akismet.com/'>Akismet</a>");
 | 
					 | 
				
			||||||
		$sb->add_text_option("comment_wordpress_key", "<br>API key: ");
 | 
					 | 
				
			||||||
		$sb->add_label("<br> <br><a href='http://recaptcha.net/'>ReCAPTCHA</a>");
 | 
					 | 
				
			||||||
		$sb->add_text_option("comment_recaptcha_privkey", "<br>Private key: ");
 | 
					 | 
				
			||||||
		$sb->add_text_option("comment_recaptcha_pubkey", "<br>Public key: ");
 | 
					 | 
				
			||||||
		$event->panel->add_block($sb);
 | 
							$event->panel->add_block($sb);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -344,9 +339,9 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
	private function is_spam_recaptcha($text) {
 | 
						private function is_spam_recaptcha($text) {
 | 
				
			||||||
		global $config, $user;
 | 
							global $config, $user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(strlen($config->get_string('comment_recaptcha_privkey')) > 0) {
 | 
							if(strlen($config->get_string('api_recaptcha_privkey')) > 0) {
 | 
				
			||||||
			$resp = recaptcha_check_answer(
 | 
								$resp = recaptcha_check_answer(
 | 
				
			||||||
					$config->get_string('comment_recaptcha_privkey'),
 | 
										$config->get_string('api_recaptcha_privkey'),
 | 
				
			||||||
					$_SERVER["REMOTE_ADDR"],
 | 
										$_SERVER["REMOTE_ADDR"],
 | 
				
			||||||
					$_POST["recaptcha_challenge_field"],
 | 
										$_POST["recaptcha_challenge_field"],
 | 
				
			||||||
					$_POST["recaptcha_response_field"]);
 | 
										$_POST["recaptcha_response_field"]);
 | 
				
			||||||
 | 
				
			|||||||
@ -150,7 +150,7 @@ class CommentListTheme extends Themelet {
 | 
				
			|||||||
		$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("api_recaptcha_pubkey");
 | 
				
			||||||
		$reca = (!$user->is_anonymous() || empty($rpk)) ?
 | 
							$reca = (!$user->is_anonymous() || empty($rpk)) ?
 | 
				
			||||||
				"" : recaptcha_get_html($rpk);
 | 
									"" : recaptcha_get_html($rpk);
 | 
				
			||||||
		return "
 | 
							return "
 | 
				
			||||||
 | 
				
			|||||||
@ -252,6 +252,14 @@ class Setup extends SimpleExtension {
 | 
				
			|||||||
		$sb->add_bool_option("nice_urls", "<br>Nice URLs: ");
 | 
							$sb->add_bool_option("nice_urls", "<br>Nice URLs: ");
 | 
				
			||||||
		$sb->add_label("<span id='nicetest'>(Javascript inactive, can't test!)</span>$nicescript");
 | 
							$sb->add_label("<span id='nicetest'>(Javascript inactive, can't test!)</span>$nicescript");
 | 
				
			||||||
		$event->panel->add_block($sb);
 | 
							$event->panel->add_block($sb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							$sb = new SetupBlock("Remote API Integration");
 | 
				
			||||||
 | 
							$sb->add_label("<br> <br><a href='http://akismet.com/'>Akismet</a>");
 | 
				
			||||||
 | 
							$sb->add_text_option("comment_wordpress_key", "<br>API key: ");
 | 
				
			||||||
 | 
							$sb->add_label("<br> <br><a href='http://recaptcha.net/'>ReCAPTCHA</a>");
 | 
				
			||||||
 | 
							$sb->add_text_option("api_recaptcha_privkey", "<br>Private key: ");
 | 
				
			||||||
 | 
							$sb->add_text_option("api_recaptcha_pubkey", "<br>Public key: ");
 | 
				
			||||||
 | 
							$event->panel->add_block($sb);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public function onConfigSave($event) {
 | 
						public function onConfigSave($event) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user