diff --git a/readme.txt b/readme.txt index c7e190a..eaa32a8 100644 --- a/readme.txt +++ b/readme.txt @@ -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. @@ -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 blaenk@gmail.com. diff --git a/recaptcha.php b/recaptcha.php index 8b6a414..8f1bb6f 100644 --- a/recaptcha.php +++ b/recaptcha.php @@ -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'); @@ -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']; @@ -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()) { @@ -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; } } @@ -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; diff --git a/wp-recaptcha.php b/wp-recaptcha.php index 55eb77a..ce2fa55 100644 --- a/wp-recaptcha.php +++ b/wp-recaptcha.php @@ -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: support@recaptcha.net Author URI: https://github.com/blaenk