Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed undefined indexes, increased version and tested WP 3.6.1 compatibility (OK) #58

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: BlaenkDenum
Tags: comments, registration, recaptcha, antispam, mailhide, captcha
Requires at least: 2.7
Tested up to: 2.9.1
Stable tag: 3.1.6
Tested up to: 3.6.1
Stable tag: 3.1.7

Integrates reCAPTCHA anti-spam methods with WordPress including comment, registration, and email spam protection.

Expand Down Expand Up @@ -44,6 +44,9 @@ To install in regular WordPress and [WordPress MultiSite](http://codex.wordpress

== ChangeLog ==

= Version 3.1.7 =
* Fixed undefined indexes when displaying reCAPTCHA with the comment form.
* Fixed undefined index when displaying reCAPTCHA with the registration form.
= Version 3.1.6 =
* WordPress MS fixes. Should now work out of the box at the individual blog level. Thanks to [huyz](http://huyz.us/)
* NOTICE: If anyone is interested in taking up development of this plugin, please contact me at [email protected].
Expand Down
22 changes: 11 additions & 11 deletions recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ function validate_options($input) {
$validated['public_key'] = trim($input['public_key']);
$validated['private_key'] = trim($input['private_key']);

$validated['show_in_comments'] = ($input['show_in_comments'] == 1 ? 1 : 0);
$validated['bypass_for_registered_users'] = ($input['bypass_for_registered_users'] == 1 ? 1: 0);
$validated['show_in_comments'] = !empty( $input['show_in_comments'] ) ? 1 : 0;
$validated['bypass_for_registered_users'] = !empty( $input['bypass_for_registered_users'] ) ? 1 : 0;

$capabilities = array ('read', 'edit_posts', 'publish_posts', 'moderate_comments', 'activate_plugins');
$themes = array ('red', 'white', 'blackglass', 'clean');
Expand All @@ -240,14 +240,14 @@ function validate_options($input) {
$validated['minimum_bypass_level'] = $this->validate_dropdown($capabilities, 'minimum_bypass_level', $input['minimum_bypass_level']);
$validated['comments_theme'] = $this->validate_dropdown($themes, 'comments_theme', $input['comments_theme']);

$validated['comments_tab_index'] = $input['comments_tab_index'] ? $input["comments_tab_index"] : 5; // use the intval filter
$validated['comments_tab_index'] = !empty( $input['comments_tab_index'] ) ? absint( $input["comments_tab_index"] ) : 5;

$validated['show_in_registration'] = ($input['show_in_registration'] == 1 ? 1 : 0);
$validated['show_in_registration'] = !empty( $input['show_in_registration'] ) ? 1 : 0;
$validated['registration_theme'] = $this->validate_dropdown($themes, 'registration_theme', $input['registration_theme']);
$validated['registration_tab_index'] = $input['registration_tab_index'] ? $input["registration_tab_index"] : 30; // use the intval filter
$validated['registration_tab_index'] = !empty( $input['registration_tab_index'] ) ? absint( $input["registration_tab_index"] ) : 30;

$validated['recaptcha_language'] = $this->validate_dropdown($recaptcha_languages, 'recaptcha_language', $input['recaptcha_language']);
$validated['xhtml_compliance'] = ($input['xhtml_compliance'] == 1 ? 1 : 0);
$validated['xhtml_compliance'] = !empty( $input['xhtml_compliance'] ) ? 1 : 0;

$validated['no_response_error'] = $input['no_response_error'];
$validated['incorrect_response_error'] = $input['incorrect_response_error'];
Expand Down Expand Up @@ -275,7 +275,7 @@ function show_recaptcha_in_registration($errors) {
else
$use_ssl = false;

$escaped_error = htmlentities($_GET['rerror'], ENT_QUOTES);
$escaped_error = !empty( $_GET['rerror'] ) ? htmlentities($_GET['rerror'], ENT_QUOTES) : null;

// if it's for wordpress mu, show the errors
if ($this->is_multi_blog()) {
Expand Down Expand Up @@ -398,9 +398,9 @@ function show_recaptcha_in_comments() {

$use_ssl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on");

$escaped_error = htmlentities($_GET['rerror'], ENT_QUOTES);
$escaped_error = !empty( $_GET['rerror'] ) ? htmlentities($_GET['rerror'], ENT_QUOTES) : null;

echo $recaptcha_js_opts . $this->get_recaptcha_html(isset($escaped_error) ? $escaped_error : null, $use_ssl) . $comment_string;
echo $recaptcha_js_opts . $this->get_recaptcha_html( $escaped_error, $use_ssl ) . $comment_string;
}
}

Expand Down Expand Up @@ -478,8 +478,8 @@ function saved_comment() {
if (!is_single() && !is_page())
return;

$comment_id = $_REQUEST['rcommentid'];
$comment_hash = $_REQUEST['rchash'];
$comment_id = !empty( $_REQUEST['rcommentid'] ) ? $_REQUEST['rcommentid'] : null;
$comment_hash = !empty( $_REQUEST['rchash'] ) ? $_REQUEST['rchash'] : null;

if (empty($comment_id) || empty($comment_hash))
return;
Expand Down
2 changes: 1 addition & 1 deletion wp-recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: WP-reCAPTCHA
Plugin URI: https://github.com/blaenk/wp-recaptcha
Description: Integrates reCAPTCHA anti-spam solutions with wordpress
Version: 3.1.6
Version: 3.1.7
Author: Jorge Peña
Email: [email protected]
Author URI: https://github.com/blaenk
Expand Down