From 57a2dfdc1935173ec31bf933bca9327a86fa8f30 Mon Sep 17 00:00:00 2001 From: bgermann Date: Wed, 25 Mar 2015 11:40:27 +0500 Subject: [PATCH] version 14.9.1 --- cforms-captcha.php | 5 ++--- cforms-global-settings.php | 2 +- cforms-options.php | 2 +- cforms.php | 4 ++-- lib_activate.php | 4 ++-- lib_options_add.php | 4 ++-- lib_validate.php | 3 +-- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/cforms-captcha.php b/cforms-captcha.php index 977fa86..5d90159 100644 --- a/cforms-captcha.php +++ b/cforms-captcha.php @@ -82,7 +82,6 @@ final class cforms2_question_and_answer extends cforms2_captcha { private $cforms_settings; public function __construct() { - srand(microtime()*1000003); $this->cforms_settings = get_option('cforms_settings'); } @@ -120,7 +119,7 @@ public function get_request($input_classes, $input_title) { private function question_and_answer($n = -1) { $qall = explode( "\r\n", $this->cforms_settings['global']['cforms_sec_qa'] ); if ($n < 0) - $n = rand( 0, count($qall)-1 ); + $n = mt_rand( 0, count($qall)-1 ); $q = explode( '=', $qall[$n]); array_unshift($q, $n); return $q; @@ -132,7 +131,7 @@ public function render_settings() { } -add_action('cforms2_add_captcha', array(new cforms2_question_and_answer(), 'add_instance')); +add_filter('cforms2_add_captcha', array(new cforms2_question_and_answer(), 'add_instance')); add_action( 'wp_ajax_cforms2_reset_captcha', 'cforms2_reset_captcha' ); add_action( 'wp_ajax_nopriv_cforms2_reset_captcha', 'cforms2_reset_captcha' ); diff --git a/cforms-global-settings.php b/cforms-global-settings.php index 026c0f4..fb91990 100644 --- a/cforms-global-settings.php +++ b/cforms-global-settings.php @@ -58,7 +58,7 @@ } else if( isset($_REQUEST['cforms_rsskeysnew']) ) { ### new RSS key computed - $cformsSettings['global']['cforms_rsskeyall'] = md5(rand()); + $cformsSettings['global']['cforms_rsskeyall'] = md5(mt_rand()); update_option('cforms_settings',$cformsSettings); } else if( isset($_REQUEST['restoreallcformsdata']) ) diff --git a/cforms-options.php b/cforms-options.php index d979914..f09debc 100644 --- a/cforms-options.php +++ b/cforms-options.php @@ -108,7 +108,7 @@ ### new RSS key computed if( isset($_REQUEST['cforms_rsskeysnew']) ) { - $cformsSettings['form'.$no]['cforms'.$no.'_rsskey'] = md5(rand()); + $cformsSettings['form'.$no]['cforms'.$no.'_rsskey'] = md5(mt_rand()); update_option('cforms_settings',$cformsSettings); } diff --git a/cforms.php b/cforms.php index 0f8d4ce..107b3cd 100644 --- a/cforms.php +++ b/cforms.php @@ -20,13 +20,13 @@ * Plugin URI: https://wordpress.org/plugins/cforms2/ * Description: cformsII offers unparalleled flexibility in deploying contact forms across your blog. Features include: comprehensive SPAM protection, Ajax support, Backup & Restore, Multi-Recipients, Role Manager support, Database tracking and many more. * Author: Oliver Seidel, Bastian Germann - * Version: 14.9 + * Version: 14.9.1 * Text Domain: cforms * Domain Path: ____Plugin_Localization */ global $localversion; -$localversion = '14.9'; +$localversion = '14.9.1'; ### db settings global $wpdb; diff --git a/lib_activate.php b/lib_activate.php index 95b17c1..76f4e0f 100644 --- a/lib_activate.php +++ b/lib_activate.php @@ -59,7 +59,7 @@ function cforms2_setup_db () { cforms2_setINI('form','cforms_dontclear', false); ### tracking settings -cforms2_setINI('form','cforms_rsskey', md5(rand()) ); +cforms2_setINI('form','cforms_rsskey', md5(mt_rand()) ); cforms2_setINI('form','cforms_rss', false ); cforms2_setINI('form','cforms_rss_count', 5 ); @@ -126,7 +126,7 @@ function cforms2_setup_db () { cforms2_setINI('global','cforms_upload_err4', __('File upload failed. Please try again or contact the blog admin.', 'cforms')); cforms2_setINI('global','cforms_upload_err5', __('File not accepted, file type not allowed.', 'cforms')); -cforms2_setINI('global','cforms_rsskeyall', md5(rand()) ); +cforms2_setINI('global','cforms_rsskeyall', md5(mt_rand()) ); cforms2_setINI('global','cforms_rssall', false ); cforms2_setINI('global','cforms_rssall_count', 5 ); diff --git a/lib_options_add.php b/lib_options_add.php index b6ff41f..5acacb0 100644 --- a/lib_options_add.php +++ b/lib_options_add.php @@ -1,7 +1,7 @@ check_response($_REQUEST[$field_type + '/hint'], $_REQUEST[$field_type]) ) { + if ( !$captchas[$field_type]->check_response($_REQUEST[$field_type . '/hint'], $_REQUEST[$field_type]) ) { $validations[$i+$off] = 0; $err = $err ? $err : 2; }