Contact Form Email - Version 1.3.33

Version Description

  • Better captcha
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Contact Form Email
Version 1.3.33
Comparing to
See all releases

Code changes from version 1.3.32 to 1.3.33

Files changed (4) hide show
  1. README.txt +5 -2
  2. captcha/captcha.php +3 -1
  3. cp-main-class.inc.php +17 -4
  4. form-to-email.php +1 -1
README.txt CHANGED
@@ -456,6 +456,9 @@ When you click a field already added into the contact form builder area, you can
456
 
457
  == Changelog ==
458
 
 
 
 
459
  = 1.3.32 =
460
  * Feedback panel update
461
 
@@ -1151,5 +1154,5 @@ When you click a field already added into the contact form builder area, you can
1151
 
1152
  == Upgrade Notice ==
1153
 
1154
- = 1.3.32 =
1155
- * Feedback panel update
456
 
457
  == Changelog ==
458
 
459
+ = 1.3.33 =
460
+ * Better captcha
461
+
462
  = 1.3.32 =
463
  * Feedback panel update
464
 
1154
 
1155
  == Upgrade Notice ==
1156
 
1157
+ = 1.3.33 =
1158
+ * Better captcha
captcha/captcha.php CHANGED
@@ -64,7 +64,9 @@ for ($i = 0; $i < $letter_count; $i++) {
64
  }
65
  $_SESSION['rand_code'.sanitize_key($_GET["ps"])] = str_replace(" ", "", $str);
66
 
67
- setCookie('rand_code'.sanitize_key($_GET["ps"]), md5(str_replace(" ", "", $str)), time()+36000,"/");
 
 
68
 
69
  $image = imagecreatetruecolor($imgX, $imgY);
70
  $backgr_col = imagecolorallocate($image, $bcolor["r"],$bcolor["g"],$bcolor["b"]);
64
  }
65
  $_SESSION['rand_code'.sanitize_key($_GET["ps"])] = str_replace(" ", "", $str);
66
 
67
+ $uidt = uniqid();
68
+ set_transient( "cpeople-captcha-".$uidt , str_replace(" ", "", $str) , 1800 );
69
+ setCookie('rand_code'.sanitize_key($_GET["ps"]), $uidt, time()+36000,"/");
70
 
71
  $image = imagecreatetruecolor($imgX, $imgY);
72
  $backgr_col = imagecolorallocate($image, $bcolor["r"],$bcolor["g"],$bcolor["b"]);
cp-main-class.inc.php CHANGED
@@ -748,14 +748,18 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
748
 
749
  if (function_exists('session_start')) @session_start();
750
  if (isset($_GET["ps"])) $sequence = sanitize_key($_GET["ps"]); else if (isset($_POST["cp_pform_psequence"])) $sequence = sanitize_key($_POST["cp_pform_psequence"]);
 
 
 
 
751
  if (
752
  (!is_admin() && $this->get_option('cv_enable_captcha', CP_CFEMAIL_DEFAULT_cv_enable_captcha) != 'false') &&
753
  ( (strtolower($this->get_param('hdcaptcha_'.$this->prefix.'_post')) != strtolower($_SESSION['rand_code'.$sequence])) ||
754
  ($_SESSION['rand_code'.$sequence] == '')
755
  )
756
  &&
757
- ( (md5(strtolower($this->get_param('hdcaptcha_'.$this->prefix.'_post'))) != ($_COOKIE['rand_code'.$sequence])) ||
758
- ($_COOKIE['rand_code'.$sequence] == '')
759
  )
760
  )
761
  {
@@ -1193,6 +1197,15 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1193
  }
1194
 
1195
 
 
 
 
 
 
 
 
 
 
1196
  function export_csv ()
1197
  {
1198
  if (!is_admin())
@@ -1257,7 +1270,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1257
  for ($i=0; $i<$end; $i++)
1258
  {
1259
  $hlabel = $this->encodeFormula(iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form)));
1260
- echo '"'.str_replace('"','""', $hlabel).'",';
1261
  }
1262
  echo "\n";
1263
  foreach ($values as $item)
@@ -1269,7 +1282,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1269
  if (is_array($item[$i]))
1270
  $item[$i] = implode($item[$i],',');
1271
  $item[$i] = $this->encodeFormula(iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $item[$i]));
1272
- echo '"'.str_replace('"','""', $item[$i]).'",';
1273
  }
1274
  echo "\n";
1275
  }
748
 
749
  if (function_exists('session_start')) @session_start();
750
  if (isset($_GET["ps"])) $sequence = sanitize_key($_GET["ps"]); else if (isset($_POST["cp_pform_psequence"])) $sequence = sanitize_key($_POST["cp_pform_psequence"]);
751
+
752
+ $captcha_tr = '';
753
+ if (!empty($_COOKIE['rand_code'.$sequence])) $captcha_tr = get_transient( "cpeople-captcha-".sanitize_key($_COOKIE['rand_code'.$sequence]));
754
+
755
  if (
756
  (!is_admin() && $this->get_option('cv_enable_captcha', CP_CFEMAIL_DEFAULT_cv_enable_captcha) != 'false') &&
757
  ( (strtolower($this->get_param('hdcaptcha_'.$this->prefix.'_post')) != strtolower($_SESSION['rand_code'.$sequence])) ||
758
  ($_SESSION['rand_code'.$sequence] == '')
759
  )
760
  &&
761
+ ( ((strtolower($this->get_param('hdcaptcha_'.$this->prefix.'_post'))) != ($captcha_tr)) ||
762
+ ($captcha_tr == '')
763
  )
764
  )
765
  {
1197
  }
1198
 
1199
 
1200
+ function clean_csv_value($value)
1201
+ {
1202
+ $value = trim($value);
1203
+ while (strlen($value) > 1 && in_array($value[0],array('=','@')))
1204
+ $value = trim(substr($value, 1));
1205
+ return $value;
1206
+ }
1207
+
1208
+
1209
  function export_csv ()
1210
  {
1211
  if (!is_admin())
1270
  for ($i=0; $i<$end; $i++)
1271
  {
1272
  $hlabel = $this->encodeFormula(iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form)));
1273
+ echo '"'.str_replace('"','""', $this->clean_csv_value($hlabel)).'",';
1274
  }
1275
  echo "\n";
1276
  foreach ($values as $item)
1282
  if (is_array($item[$i]))
1283
  $item[$i] = implode($item[$i],',');
1284
  $item[$i] = $this->encodeFormula(iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $item[$i]));
1285
+ echo '"'.str_replace('"','""', $this->clean_csv_value($item[$i])).'",';
1286
  }
1287
  echo "\n";
1288
  }
form-to-email.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Contact Form Email
4
  Plugin URI: https://form2email.dwbooster.com/download
5
  Description: Contact form that sends the data to email and also to a database list and CSV file.
6
- Version: 1.3.32
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
3
  Plugin Name: Contact Form Email
4
  Plugin URI: https://form2email.dwbooster.com/download
5
  Description: Contact form that sends the data to email and also to a database list and CSV file.
6
+ Version: 1.3.33
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email