Contact Form Email - Version 1.2.73

Version Description

  • Removed empty spaces/line breaks causing script conflicts
Download this release

Release Info

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

Code changes from version 1.2.72 to 1.2.73

Files changed (4) hide show
  1. README.txt +4 -2
  2. cp-main-class.inc.php +133 -135
  3. form-to-email.php +1 -1
  4. js/block.js +1 -1
README.txt CHANGED
@@ -454,6 +454,8 @@ When you click a field already added into the contact form builder area, you can
454
 
455
  == Changelog ==
456
 
 
 
457
 
458
  = 1.2.72 =
459
  * New Gutemberg Block
@@ -978,5 +980,5 @@ When you click a field already added into the contact form builder area, you can
978
 
979
  == Upgrade Notice ==
980
 
981
- = 1.2.72 =
982
- * New Gutemberg Block
454
 
455
  == Changelog ==
456
 
457
+ = 1.2.73 =
458
+ * Removed empty spaces/line breaks causing script conflicts
459
 
460
  = 1.2.72 =
461
  * New Gutemberg Block
980
 
981
  == Upgrade Notice ==
982
 
983
+ = 1.2.73 =
984
+ * Removed empty spaces/line breaks causing script conflicts
cp-main-class.inc.php CHANGED
@@ -18,7 +18,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
18
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
19
 
20
  $charset_collate = $wpdb->get_charset_collate();
21
-
22
  $results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix.$this->table_messages."'");
23
  if (!count($results))
24
  {
@@ -59,7 +59,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
59
  cu_message text,
60
  cu_emailformat VARCHAR(20) DEFAULT '' NOT NULL,
61
  fp_emailfrommethod VARCHAR(20) DEFAULT '' NOT NULL,
62
-
63
  fp_enableemail VARCHAR(10) DEFAULT '' NOT NULL,
64
  onsubmitaction VARCHAR(10) DEFAULT '' NOT NULL,
65
  fp_return_message text,
@@ -77,7 +77,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
77
  vs_text_of VARCHAR(250) DEFAULT '' NOT NULL,
78
  vs_text_submitbtn VARCHAR(250) DEFAULT '' NOT NULL,
79
  vs_text_previousbtn VARCHAR(200) DEFAULT '' NOT NULL,
80
- vs_text_nextbtn VARCHAR(200) DEFAULT '' NOT NULL,
81
 
82
  rep_enable VARCHAR(10) DEFAULT '' NOT NULL,
83
  rep_days VARCHAR(10) DEFAULT '' NOT NULL,
@@ -129,7 +129,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
129
  'cu_subject' => $this->get_option('cu_subject', CP_CFEMAIL_DEFAULT_cu_subject),
130
  'cu_message' => $this->get_option('cu_message', CP_CFEMAIL_DEFAULT_cu_message),
131
  'cu_emailformat' => $this->get_option('cu_emailformat', CP_CFEMAIL_DEFAULT_email_format),
132
-
133
  'fp_return_message' => 'Thank you.',
134
  'onsubmitaction' => '0',
135
  'fp_enableemail' => 'true',
@@ -147,7 +147,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
147
  'vs_text_of' => $this->get_option('vs_text_of', 'of'),
148
  'vs_text_submitbtn' => $this->get_option('vs_text_submitbtn', 'Submit'),
149
  'vs_text_previousbtn' => $this->get_option('vs_text_previousbtn', 'Previous'),
150
- 'vs_text_nextbtn' => $this->get_option('vs_text_nextbtn', 'Next'),
151
 
152
  'rep_enable' => $this->get_option('rep_enable', 'no'),
153
  'rep_days' => $this->get_option('rep_days', '1'),
@@ -175,10 +175,10 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
175
  }
176
 
177
 
178
- public function plugins_loaded() {
179
  load_plugin_textdomain( 'contact-form-to-email', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
180
  }
181
-
182
 
183
  /* Filter for placing the maps into the contents */
184
  public function filter_content($atts) {
@@ -198,7 +198,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
198
 
199
  function insert_public_item() {
200
  global $wpdb;
201
-
202
  $page_label = $this->get_option('vs_text_page', 'Page');
203
  $page_label = ($page_label==''?'Page':$page_label);
204
  $of_label = $this->get_option('vs_text_of', 'of');
@@ -206,13 +206,13 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
206
  $previous_label = $this->get_option('vs_text_previousbtn', 'Previous');
207
  $previous_label = ($previous_label==''?'Previous':$previous_label);
208
  $next_label = $this->get_option('vs_text_nextbtn', 'Next');
209
- $next_label = ($next_label==''?'Next':$next_label);
210
-
211
  if (CP_CFEMAIL_DEFER_SCRIPTS_LOADING)
212
  {
213
  wp_enqueue_style('cfte-stylepublic', plugins_url('css/stylepublic.css', __FILE__) );
214
  wp_enqueue_style('cfte-stylecalendar', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__));
215
-
216
  wp_deregister_script('query-stringify');
217
  wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
218
 
@@ -263,21 +263,19 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
263
  var cpefb_error = 0;
264
  $dexQuery("#<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>").find(".cpefb_error").each(function(index){
265
  if ($dexQuery(this).css("display")!="none")
266
- cpefb_error++;
267
  });
268
- if (cpefb_error) return false;
269
  if (document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value != '0')
270
  return false;
271
- document.getElementById("refpage<?php echo '_'.$this->print_counter; ?>").value = document.location;
272
  cfte_blink(".pbSubmit");
273
- document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '2';
274
- <?php
275
- $option = $this->get_option('onsubmitaction', '0');
276
  $message = str_replace("\n","\\n",str_replace("\r","",str_replace("'","\'", __($this->get_option('fp_return_message', 'Thank you.')) )));
277
  if ($option == '1' || $option == '2' || $option == '3')
278
- {
279
- ?>
280
- document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '1';
281
  $dexQuery.ajax({
282
  type: "POST",
283
  url: '<?php $this->get_site_url(); ?>',
@@ -293,15 +291,15 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
293
  $dexQuery('html,body').animate({scrollTop: tag.offset().top-60},'fast');
294
  <?php
295
  }
296
- else if ($option == '1') {
297
  ?>
298
  alert('<?php echo $message; ?>');
299
  document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.reset();
300
  <?php
301
  }
302
- else if ($option == '2') {
303
  ?>
304
- $dexQuery("#cftedialog").dialog({
305
  buttons: {
306
  Ok: function() {
307
  $dexQuery( this ).dialog( "close" );
@@ -315,48 +313,48 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
315
  ?>
316
  }
317
  });
318
- return false;
319
  <?php
320
  }
321
  else
322
  echo 'return true;';
323
  ?>
324
- }
325
  }
326
  function cfte_blink(selector){
327
- try {
328
  $dexQuery = jQuery.noConflict();
329
  $dexQuery(selector).fadeOut(700, function(){
330
  $dexQuery(this).fadeIn(700, function(){
331
  try {
332
  if (document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value != '0')
333
- cfte_blink(this);
334
- } catch (e) {}
335
  });
336
- });
337
- } catch (e) {}
338
  }
339
  function <?php echo $this->prefix; ?>_cerror<?php echo '_'.$this->print_counter; ?>(){$dexQuery = jQuery.noConflict();$dexQuery("#hdcaptcha_error<?php echo '_'.$this->print_counter; ?>").css('top',$dexQuery("#hdcaptcha_<?php echo $this->prefix; ?>_post<?php echo '_'.$this->print_counter; ?>").outerHeight());$dexQuery("#hdcaptcha_error<?php echo '_'.$this->print_counter; ?>").css("display","inline");}
340
  </script>
341
  <div id="cftedialog" style="display:none;"><?php echo __($this->get_option('fp_return_message', 'Thank you.')); ?></div>
342
  <?php
343
-
344
  $button_label = $this->get_option('vs_text_submitbtn', 'Submit');
345
  $button_label = ($button_label==''?'Submit':$button_label);
346
-
347
  if (!defined('CP_AUTH_INCLUDE')) define('CP_AUTH_INCLUDE',true);
348
  @include dirname( __FILE__ ) . '/cp-public-int.inc.php';
349
  if (!CP_CFEMAIL_DEFER_SCRIPTS_LOADING)
350
  {
351
  $prefix_ui = '';
352
  if (@file_exists(dirname( __FILE__ ).'/../../../wp-includes/js/jquery/ui/jquery.ui.core.min.js'))
353
- $prefix_ui = 'jquery.ui.';
354
- // This code won't be used in most cases. This code is for preventing problems in wrong WP themes and conflicts with third party plugins.
355
  // It can be manually activated by the user if needed from the troubleshoot settings area of the plugin
356
  ?>
357
  <?php $plugin_url = plugins_url('', __FILE__); ?>
358
  <link href="<?php echo plugins_url('css/stylepublic.css', __FILE__); ?>" type="text/css" rel="stylesheet" />
359
- <link href="<?php echo plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__); ?>" type="text/css" rel="stylesheet" />
360
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/jquery.js'; ?>'></script>
361
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'core.min.js'; ?>'></script>
362
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'datepicker.min.js'; ?>'></script>
@@ -385,21 +383,21 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
385
  $settings_link = '<a href="admin.php?page='.$this->menu_parameter.'">'.__('Settings','contact-form-to-email').'</a>';
386
  array_unshift($links, $settings_link);
387
  $help_link = '<a href="https://form2email.dwbooster.com/support">'.__('Documentation','contact-form-to-email').'</a>';
388
- array_unshift($links, $help_link);
389
  $s_link = '<a href="https://wordpress.org/support/plugin/contact-form-to-email#new-post">'.__('Support','contact-form-to-email').'</a>';
390
- array_unshift($links, $s_link);
391
  return $links;
392
  }
393
 
394
 
395
  public function admin_menu() {
396
  add_options_page($this->plugin_name.' Options', $this->plugin_name, 'manage_options', $this->menu_parameter, array($this, 'settings_page') );
397
- add_menu_page( $this->plugin_name.' Options', $this->plugin_name, 'edit_pages', $this->menu_parameter, array($this, 'settings_page') );
398
- add_submenu_page( $this->menu_parameter, 'Help: Online demo', 'Help: Online demo', 'read', $this->menu_parameter."_demo", array($this, 'settings_page') );
399
- add_submenu_page( $this->menu_parameter, 'Help: Documentation', 'Help: Documentation', 'read', $this->menu_parameter."_docs", array($this, 'settings_page') );
400
- add_submenu_page( $this->menu_parameter, 'Help: Free support', 'Help: Free support', 'read', $this->menu_parameter."_fsupport", array($this, 'settings_page') );
401
-
402
- add_submenu_page( $this->menu_parameter, 'Upgrade', 'Upgrade', 'edit_pages', $this->menu_parameter."_upgrade", array($this, 'settings_page') );
403
  }
404
 
405
 
@@ -432,17 +430,17 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
432
  {
433
  echo("Redirecting to upgrade page...<script type='text/javascript'>document.location='https://form2email.dwbooster.com/download';</script>");
434
  exit;
435
- }
436
  else if ($this->get_param("page") == $this->menu_parameter.'_demo')
437
  {
438
  echo("Redirecting to demo page...<script type='text/javascript'>document.location='https://form2email.dwbooster.com/home#demos';</script>");
439
  exit;
440
- }
441
  else if ($this->get_param("page") == $this->menu_parameter.'_docs')
442
  {
443
  echo("Redirecting to demo page...<script type='text/javascript'>document.location='https://form2email.dwbooster.com/documentation?open=1';</script>");
444
  exit;
445
- }
446
  else if ($this->get_param("page") == $this->menu_parameter.'_fsupport')
447
  {
448
  echo("Redirecting to demo page...<script type='text/javascript'>document.location='https://wordpress.org/support/plugin/contact-form-to-email#new-post';</script>");
@@ -451,22 +449,22 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
451
  else
452
  @include_once dirname( __FILE__ ) . '/cp-admin-int-list.inc.php';
453
  }
454
-
455
  function gutenberg_block() {
456
  global $wpdb;
457
-
458
  wp_enqueue_script( 'cfte_gutenberg_editor', plugins_url('/js/block.js', __FILE__));
459
-
460
- wp_enqueue_style('cfte-publicstyle', plugins_url('css/stylepublic.css', __FILE__));
461
-
462
  wp_deregister_script('query-stringify');
463
  wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
464
 
465
  wp_deregister_script($this->prefix.'_validate_script');
466
- wp_register_script($this->prefix.'_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
467
  wp_enqueue_script( $this->prefix.'_builder_script',
468
- plugins_url('/js/fbuilderf.jquery.js', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip","query-stringify",$this->prefix."_validate_script"), false, true );
469
-
470
  $forms = array();
471
  $rows = $wpdb->get_results("SELECT id,form_name FROM ".$wpdb->prefix.$this->table_items." ORDER BY form_name");
472
  foreach ($rows as $item)
@@ -478,10 +476,10 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
478
  wp_localize_script( 'cfte_gutenberg_editor', 'apphourbk_forms', array(
479
  'forms' => $forms,
480
  'siteUrl' => get_site_url()
481
- ) );
482
  }
483
-
484
-
485
  public function render_form_admin ($atts) {
486
  $is_gutemberg_editor = defined( 'REST_REQUEST' ) && REST_REQUEST && ! empty( $_REQUEST['context'] ) && 'edit' === $_REQUEST['context'];
487
  if (!$is_gutemberg_editor)
@@ -507,7 +505,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
507
  wp_enqueue_style('cfte-newadminstyle', plugins_url('/css/newadminlayout.css', __FILE__));
508
  //wp_enqueue_style('jquery-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
509
  if ($this->get_param("report") == '1')
510
- wp_enqueue_script( $this->prefix.'_excanvas', plugins_url('/js/excanvas.min.js', __FILE__));
511
  }
512
  if( 'post.php' != $hook && 'post-new.php' != $hook )
513
  return;
@@ -518,7 +516,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
518
 
519
  function data_management_loaded() {
520
  global $wpdb;
521
-
522
  $action = $this->get_param('cp_contactformtoemail_do_action_loaded');
523
  if (!$action) return; // go out if the call isn't for this one
524
 
@@ -527,7 +525,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
527
  if ($action == "wizard")
528
  {
529
  $shortcode = '['.$this->shorttag.' id="'.$this->item .'"]';
530
- $this->postURL = $this->publish_on($_POST["whereto"], $_POST["publishpage"], $_POST["publishpost"], $shortcode, $_POST["posttitle"]);
531
  return;
532
  }
533
 
@@ -535,9 +533,9 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
535
  echo 'Some unexpected error happened. If you see this error contact the support service at https://form2email.dwbooster.com/contact-us';
536
 
537
  exit();
538
- }
 
539
 
540
-
541
  private function publish_on($whereto, $publishpage = '', $publishpost = '', $content = '', $posttitle = 'Booking Form')
542
  {
543
  global $wpdb;
@@ -550,11 +548,11 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
550
  'post_content' => 'This is a <b>preview</b> page, remember to publish it if needed. You can edit the full form settings into the admin settings page.<br /><br /> '.$content,
551
  'post_status' => 'draft'
552
  );
553
-
554
  // Insert the post into the database
555
  $id = wp_insert_post( $my_post );
556
  }
557
- else
558
  {
559
  $id = ($whereto == '2'?$publishpage:$publishpost);
560
  $post = get_post( $id );
@@ -571,8 +569,8 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
571
  }
572
  return get_permalink($id);
573
  }
574
-
575
-
576
  function data_management() {
577
  global $wpdb;
578
 
@@ -604,13 +602,13 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
604
  $this->save_options();
605
  return;
606
  }
607
-
608
  if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['CP_CFTE_post_edition'] ) && is_admin() )
609
  {
610
  $this->save_edition();
611
  return;
612
- }
613
-
614
  if ( 'POST' != $_SERVER['REQUEST_METHOD'] || ! isset( $_POST[$this->prefix.'_pform_process'] ) )
615
  if ( 'GET' != $_SERVER['REQUEST_METHOD'] || !isset( $_GET['hdcaptcha_'.$this->prefix.'_post'] ) )
616
  return;
@@ -631,7 +629,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
631
  )
632
  {
633
  $_SESSION['rand_code'.$sequence] = '';
634
- setCookie('rand_code'.$sequence, '', time()+36000,"/");
635
  echo 'captchafailed';
636
  exit;
637
  }
@@ -646,7 +644,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
646
  //if (get_magic_quotes_gpc())
647
  foreach ($_POST as $item => $value)
648
  $_POST[$item] = (is_array($value)?$value:stripcslashes($value));
649
-
650
  // get form info
651
  //---------------------------
652
  require_once(ABSPATH . "wp-admin" . '/includes/file.php');
@@ -670,7 +668,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
670
  //---------------------------
671
  $buffer = "";
672
  $params = array();
673
- $params["referrer"] = $_POST["refpage".$sequence];
674
  foreach ($_POST as $item => $value)
675
  if (isset($fields[str_replace($sequence,'',$item)]))
676
  {
@@ -692,9 +690,9 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
692
  // else {print_r($movefile);exit;} // un-comment this line if the uploads aren't working
693
  }
694
  $buffer_A = $buffer;
695
-
696
  $_SESSION['rand_code'.$sequence] = '';
697
- setCookie('rand_code'.$sequence, '', time()+36000,"/");
698
 
699
  $saveipaddr = ('true' == $this->get_option('fp_inc_additional_info', CP_CFEMAIL_DEFAULT_fp_inc_additional_info));
700
  // insert into database
@@ -710,7 +708,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
710
  ) );
711
  if (!$rows_affected)
712
  {
713
- echo 'Error saving data! Please try again.';
714
  echo '<br /><br />If the error persists please be sure you are using the latest version and in that case contact support service at https://form2email.dwbooster.com/contact-us?debug=db';
715
  exit;
716
  }
@@ -719,7 +717,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
719
  $item_number = $myrows[0]->max_id;
720
 
721
  $this->ready_to_go_reservation($item_number, "", $params);
722
-
723
  if ($_POST[ $this->prefix."_pform_status"] == '1')
724
  echo 'OK';
725
  else
@@ -745,7 +743,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
745
  global $wpdb;
746
 
747
  $myrows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ".$wpdb->prefix.$this->table_messages." WHERE id=%d", $itemnumber ) );
748
-
749
  $mycalendarrows = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.$this->table_items.' WHERE `id`=%d', $myrows[0]->formid ) );
750
 
751
  $this->item = $myrows[0]->formid;
@@ -776,16 +774,16 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
776
  if (strpos($item,"_link"))
777
  $attachments[] = $value;
778
  }
779
-
780
  $message = str_replace('<'.'%itemnumber%'.'>',$itemnumber,$message);
781
  $subject = str_replace('<'.'%itemnumber%'.'>',$itemnumber,$subject);
782
-
783
  for ($i=0;$i<500;$i++)
784
  {
785
  $subject = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$subject);
786
- $message = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$message);
787
  }
788
-
789
  $from = trim($this->get_option('fp_from_email', @CP_CFEMAIL_DEFAULT_fp_from_email));
790
  $to = explode(",",$this->get_option('fp_destination_emails', @CP_CFEMAIL_DEFAULT_fp_destination_emails));
791
  if ('html' == $this->get_option('fp_emailformat', CP_CFEMAIL_DEFAULT_email_format)) $content_type = "Content-Type: text/html; charset=utf-8\n"; else $content_type = "Content-Type: text/plain; charset=utf-8\n";
@@ -795,14 +793,14 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
795
  $from_1 = $replyto;
796
  else
797
  $from_1 = $from;
798
-
799
  if ($this->get_option('fp_enableemail', 'true') != 'false')
800
- {
801
  foreach ($to as $item)
802
  if (trim($item) != '')
803
  {
804
  if (!strpos($from_1,">"))
805
- $from_1 = '"'.$from_1.'" <'.$from_1.'>';
806
  wp_mail(trim($item), $subject, $message,
807
  "From: ".$from_1."\r\n".
808
  ($replyto!=''?"Reply-To: \"$replyto\" <".$replyto.">\r\n":'').
@@ -828,16 +826,16 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
828
  $subject = str_replace('<'.'%'.$item.'%'.'>',(is_array($value)?(implode(", ",$value)):($value)),$subject);
829
  }
830
  if ('html' == $this->get_option('cu_emailformat', CP_CFEMAIL_DEFAULT_email_format)) $content_type = "Content-Type: text/html; charset=utf-8\n"; else $content_type = "Content-Type: text/plain; charset=utf-8\n";
831
-
832
  for ($i=0;$i<500;$i++)
833
  {
834
  $subject = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$subject);
835
- $message = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$message);
836
- }
837
-
838
  if (!strpos($from,">"))
839
  $from = '"'.$from.'" <'.$from.'>';
840
-
841
  if ($_POST[$to] != '')
842
  wp_mail(trim($_POST[$to]), $subject, $message,
843
  "From: ".$from."\r\n".
@@ -861,32 +859,32 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
861
  echo 'Error: Form cannot be authenticated. Please contact our <a href="https://form2email.dwbooster.com/contact-us">support service</a> for verification and solution. Thank you.';
862
  return;
863
  }
864
-
865
  foreach ($_POST as $item => $value)
866
  if (!is_array($value))
867
- $_POST[$item] = stripcslashes($value);
868
  if (substr_count($_POST['editionarea'],"\\\""))
869
  $_POST["editionarea"] = stripcslashes($_POST["editionarea"]);
870
- if ($_POST["cfwpp_edit"] == 'js')
871
- update_option('CP_CFTE_JS', base64_encode($_POST["editionarea"]));
872
- else if ($_POST["cfwpp_edit"] == 'css')
873
- update_option('CP_CFTE_CSS', base64_encode($_POST["editionarea"]));
874
  }
875
-
876
-
877
  function save_options()
878
  {
879
  global $wpdb;
880
-
881
  $verify_nonce = wp_verify_nonce( $_POST['rsave'], 'cfpoll_update_actions_post');
882
  if (!$verify_nonce)
883
  {
884
  echo 'Error: Form cannot be authenticated. Please contact our <a href="https://form2email.dwbooster.com/contact-us">support service</a> for verification and solution. Thank you.';
885
  return;
886
  }
887
-
888
  $this->item = $_POST[$this->prefix."_id"];
889
-
890
  if (substr_count($_POST['form_structure'],"\\") > 30)
891
  foreach ($_POST as $item => $value)
892
  if (!is_array($value))
@@ -903,16 +901,16 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
903
  $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_of'," varchar(250) NOT NULL default ''");
904
  $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_submitbtn'," varchar(250) NOT NULL default ''");
905
  $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_previousbtn'," varchar(250) NOT NULL default ''");
906
- $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_nextbtn'," varchar(250) NOT NULL default ''");
907
 
908
  $this->add_field_verify($wpdb->prefix.$this->table_items, "onsubmitaction", "VARCHAR(10)");
909
- $this->add_field_verify($wpdb->prefix.$this->table_items, "fp_return_message", "text");
910
- $this->add_field_verify($wpdb->prefix.$this->table_items, "fp_enableemail", "VARCHAR(10)");
911
 
912
- $wpdb->update ( $wpdb->prefix.$this->table_items,
913
  array(
914
  'form_structure' => $_POST['form_structure'],
915
-
916
  'fp_from_email' => $_POST['fp_from_email'],
917
  'fp_destination_emails' => $_POST['fp_destination_emails'],
918
  'fp_subject' => $_POST['fp_subject'],
@@ -920,18 +918,18 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
920
  'fp_return_page' => $_POST['fp_return_page'],
921
  'fp_message' => $_POST['fp_message'],
922
  'fp_emailformat' => $_POST['fp_emailformat'],
923
-
924
  'cu_enable_copy_to_user' => $_POST['cu_enable_copy_to_user'],
925
  'cu_user_email_field' => $_POST['cu_user_email_field'],
926
  'cu_subject' => $_POST['cu_subject'],
927
  'cu_message' => $_POST['cu_message'],
928
  'cu_emailformat' => $_POST['cu_emailformat'],
929
  'fp_emailfrommethod' => $_POST['fp_emailfrommethod'],
930
-
931
  'onsubmitaction' => $_POST['onsubmitaction'],
932
  'fp_return_message' => $_POST['fp_return_message'],
933
  'fp_enableemail' => $_POST['fp_enableemail'],
934
-
935
  'vs_text_is_required' => $_POST['vs_text_is_required'],
936
  'vs_text_is_email' => $_POST['vs_text_is_email'],
937
  'vs_text_datemmddyyyy' => $_POST['vs_text_datemmddyyyy'],
@@ -945,7 +943,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
945
  'vs_text_submitbtn' => $_POST['vs_text_submitbtn'],
946
  'vs_text_previousbtn' => $_POST['vs_text_previousbtn'],
947
  'vs_text_nextbtn' => $_POST['vs_text_nextbtn'],
948
-
949
  'rep_enable' => $_POST['rep_enable'],
950
  'rep_days' => $_POST['rep_days'],
951
  'rep_hour' => $_POST['rep_hour'],
@@ -953,7 +951,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
953
  'rep_subject' => $_POST['rep_subject'],
954
  'rep_emailformat' => $_POST['rep_emailformat'],
955
  'rep_message' => $_POST['rep_message'],
956
-
957
  'cv_enable_captcha' => $_POST['cv_enable_captcha'],
958
  'cv_width' => $_POST['cv_width'],
959
  'cv_height' => $_POST['cv_height'],
@@ -1050,7 +1048,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1050
  {
1051
  $hlabel = iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form));
1052
  echo '"'.str_replace('"','""', $hlabel).'",';
1053
- }
1054
  echo "\n";
1055
  foreach ($values as $item)
1056
  {
@@ -1073,33 +1071,33 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1073
  {
1074
  $this->item = $id;
1075
  }
1076
-
1077
 
1078
  public function translate_json($str)
1079
  {
1080
- $form_data = json_decode($this->cleanJSON($str));
1081
-
1082
- $form_data[1][0]->title = __($form_data[1][0]->title,'contact-form-to-email');
1083
- $form_data[1][0]->description = __($form_data[1][0]->description,'contact-form-to-email');
1084
-
1085
- for ($i=0; $i < count($form_data[0]); $i++)
1086
  {
1087
- $form_data[0][$i]->title = __($form_data[0][$i]->title,'contact-form-to-email');
1088
- $form_data[0][$i]->userhelpTooltip = __($form_data[0][$i]->userhelpTooltip,'contact-form-to-email');
1089
- $form_data[0][$i]->userhelp = __($form_data[0][$i]->userhelp,'contact-form-to-email');
1090
  if ($form_data[0][$i]->ftype == 'fCommentArea')
1091
- $form_data[0][$i]->userhelp = __($form_data[0][$i]->userhelp,'contact-form-to-email');
1092
- else
1093
- if ($form_data[0][$i]->ftype == 'fradio' || $form_data[0][$i]->ftype == 'fcheck' || $form_data[0][$i]->ftype == 'fradio')
1094
  {
1095
- for ($j=0; $j < count($form_data[0][$i]->choices); $j++)
1096
- $form_data[0][$i]->choices[$j] = __($form_data[0][$i]->choices[$j],'contact-form-to-email');
1097
- }
1098
- }
1099
  $str = json_encode($form_data);
1100
  return $str;
1101
  }
1102
-
1103
 
1104
  private function get_records_csv($formid, $form_name = "")
1105
  {
@@ -1107,7 +1105,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1107
 
1108
  $saved_item = $this->item;
1109
  $this->item = intval($formid);
1110
-
1111
  $last_sent_id = get_option('cp_cfte_last_sent_id_'.$formid, '0');
1112
  $events = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ".$wpdb->prefix.$this->table_messages." WHERE formid=%d AND id>%d ORDER BY id ASC", $formid, $last_sent_id) );
1113
 
@@ -1161,7 +1159,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1161
  {
1162
  $hlabel = iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form));
1163
  $buffer .= '"'.str_replace('"','""', $hlabel).'",';
1164
- }
1165
  $buffer .= "\n";
1166
  foreach ($values as $item)
1167
  {
@@ -1176,8 +1174,8 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1176
  }
1177
  $buffer .= "\n";
1178
  }
1179
-
1180
- $this->item = $saved_item;
1181
  return $buffer;
1182
 
1183
  }
@@ -1195,7 +1193,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1195
  {
1196
  $formid = 0;
1197
  $verify_after = date("Y-m-d H:i:s", strtotime("-".get_option('cp_cfte_rep_days', '')." days"));
1198
- $last_sent = get_option('cp_cfte_last_sent'.$formid, '');
1199
  if ($last_sent == '' || $last_sent < $verify_after) // check if this form needs to check for a new report
1200
  {
1201
  update_option('cp_cfte_last_sent'.$formid, date("Y-m-d ".(get_option('cp_cfte_rep_hour', '')<'10'?'0':'').get_option('cp_cfte_rep_hour', '').":00:00"));
@@ -1203,7 +1201,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1203
  $forms = $wpdb->get_results("SELECT id,fp_from_email,form_name,rep_days,rep_hour,rep_emails,rep_subject,rep_emailformat,rep_message,rep_enable FROM ".$wpdb->prefix.$this->table_items." WHERE rep_emails<>'' AND rep_enable='yes'");
1204
  $attachments = array();
1205
  foreach ($forms as $form) // for each form with the reports enabled
1206
- {
1207
  $csv = $this->get_records_csv($form->id, $form->form_name);
1208
  if ($csv != '')
1209
  {
18
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
19
 
20
  $charset_collate = $wpdb->get_charset_collate();
21
+
22
  $results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix.$this->table_messages."'");
23
  if (!count($results))
24
  {
59
  cu_message text,
60
  cu_emailformat VARCHAR(20) DEFAULT '' NOT NULL,
61
  fp_emailfrommethod VARCHAR(20) DEFAULT '' NOT NULL,
62
+
63
  fp_enableemail VARCHAR(10) DEFAULT '' NOT NULL,
64
  onsubmitaction VARCHAR(10) DEFAULT '' NOT NULL,
65
  fp_return_message text,
77
  vs_text_of VARCHAR(250) DEFAULT '' NOT NULL,
78
  vs_text_submitbtn VARCHAR(250) DEFAULT '' NOT NULL,
79
  vs_text_previousbtn VARCHAR(200) DEFAULT '' NOT NULL,
80
+ vs_text_nextbtn VARCHAR(200) DEFAULT '' NOT NULL,
81
 
82
  rep_enable VARCHAR(10) DEFAULT '' NOT NULL,
83
  rep_days VARCHAR(10) DEFAULT '' NOT NULL,
129
  'cu_subject' => $this->get_option('cu_subject', CP_CFEMAIL_DEFAULT_cu_subject),
130
  'cu_message' => $this->get_option('cu_message', CP_CFEMAIL_DEFAULT_cu_message),
131
  'cu_emailformat' => $this->get_option('cu_emailformat', CP_CFEMAIL_DEFAULT_email_format),
132
+
133
  'fp_return_message' => 'Thank you.',
134
  'onsubmitaction' => '0',
135
  'fp_enableemail' => 'true',
147
  'vs_text_of' => $this->get_option('vs_text_of', 'of'),
148
  'vs_text_submitbtn' => $this->get_option('vs_text_submitbtn', 'Submit'),
149
  'vs_text_previousbtn' => $this->get_option('vs_text_previousbtn', 'Previous'),
150
+ 'vs_text_nextbtn' => $this->get_option('vs_text_nextbtn', 'Next'),
151
 
152
  'rep_enable' => $this->get_option('rep_enable', 'no'),
153
  'rep_days' => $this->get_option('rep_days', '1'),
175
  }
176
 
177
 
178
+ public function plugins_loaded() {
179
  load_plugin_textdomain( 'contact-form-to-email', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
180
  }
181
+
182
 
183
  /* Filter for placing the maps into the contents */
184
  public function filter_content($atts) {
198
 
199
  function insert_public_item() {
200
  global $wpdb;
201
+
202
  $page_label = $this->get_option('vs_text_page', 'Page');
203
  $page_label = ($page_label==''?'Page':$page_label);
204
  $of_label = $this->get_option('vs_text_of', 'of');
206
  $previous_label = $this->get_option('vs_text_previousbtn', 'Previous');
207
  $previous_label = ($previous_label==''?'Previous':$previous_label);
208
  $next_label = $this->get_option('vs_text_nextbtn', 'Next');
209
+ $next_label = ($next_label==''?'Next':$next_label);
210
+
211
  if (CP_CFEMAIL_DEFER_SCRIPTS_LOADING)
212
  {
213
  wp_enqueue_style('cfte-stylepublic', plugins_url('css/stylepublic.css', __FILE__) );
214
  wp_enqueue_style('cfte-stylecalendar', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__));
215
+
216
  wp_deregister_script('query-stringify');
217
  wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
218
 
263
  var cpefb_error = 0;
264
  $dexQuery("#<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>").find(".cpefb_error").each(function(index){
265
  if ($dexQuery(this).css("display")!="none")
266
+ cpefb_error++;
267
  });
268
+ if (cpefb_error) return false;
269
  if (document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value != '0')
270
  return false;
271
+ document.getElementById("refpage<?php echo '_'.$this->print_counter; ?>").value = document.location;
272
  cfte_blink(".pbSubmit");
273
+ document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '2';<?php
274
+ $option = $this->get_option('onsubmitaction', '0');
 
275
  $message = str_replace("\n","\\n",str_replace("\r","",str_replace("'","\'", __($this->get_option('fp_return_message', 'Thank you.')) )));
276
  if ($option == '1' || $option == '2' || $option == '3')
277
+ {
278
+ ?>document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '1';
 
279
  $dexQuery.ajax({
280
  type: "POST",
281
  url: '<?php $this->get_site_url(); ?>',
291
  $dexQuery('html,body').animate({scrollTop: tag.offset().top-60},'fast');
292
  <?php
293
  }
294
+ else if ($option == '1') {
295
  ?>
296
  alert('<?php echo $message; ?>');
297
  document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.reset();
298
  <?php
299
  }
300
+ else if ($option == '2') {
301
  ?>
302
+ $dexQuery("#cftedialog").dialog({
303
  buttons: {
304
  Ok: function() {
305
  $dexQuery( this ).dialog( "close" );
313
  ?>
314
  }
315
  });
316
+ return false;
317
  <?php
318
  }
319
  else
320
  echo 'return true;';
321
  ?>
322
+ }
323
  }
324
  function cfte_blink(selector){
325
+ try {
326
  $dexQuery = jQuery.noConflict();
327
  $dexQuery(selector).fadeOut(700, function(){
328
  $dexQuery(this).fadeIn(700, function(){
329
  try {
330
  if (document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value != '0')
331
+ cfte_blink(this);
332
+ } catch (e) {}
333
  });
334
+ });
335
+ } catch (e) {}
336
  }
337
  function <?php echo $this->prefix; ?>_cerror<?php echo '_'.$this->print_counter; ?>(){$dexQuery = jQuery.noConflict();$dexQuery("#hdcaptcha_error<?php echo '_'.$this->print_counter; ?>").css('top',$dexQuery("#hdcaptcha_<?php echo $this->prefix; ?>_post<?php echo '_'.$this->print_counter; ?>").outerHeight());$dexQuery("#hdcaptcha_error<?php echo '_'.$this->print_counter; ?>").css("display","inline");}
338
  </script>
339
  <div id="cftedialog" style="display:none;"><?php echo __($this->get_option('fp_return_message', 'Thank you.')); ?></div>
340
  <?php
341
+
342
  $button_label = $this->get_option('vs_text_submitbtn', 'Submit');
343
  $button_label = ($button_label==''?'Submit':$button_label);
344
+
345
  if (!defined('CP_AUTH_INCLUDE')) define('CP_AUTH_INCLUDE',true);
346
  @include dirname( __FILE__ ) . '/cp-public-int.inc.php';
347
  if (!CP_CFEMAIL_DEFER_SCRIPTS_LOADING)
348
  {
349
  $prefix_ui = '';
350
  if (@file_exists(dirname( __FILE__ ).'/../../../wp-includes/js/jquery/ui/jquery.ui.core.min.js'))
351
+ $prefix_ui = 'jquery.ui.';
352
+ // This code won't be used in most cases. This code is for preventing problems in wrong WP themes and conflicts with third party plugins.
353
  // It can be manually activated by the user if needed from the troubleshoot settings area of the plugin
354
  ?>
355
  <?php $plugin_url = plugins_url('', __FILE__); ?>
356
  <link href="<?php echo plugins_url('css/stylepublic.css', __FILE__); ?>" type="text/css" rel="stylesheet" />
357
+ <link href="<?php echo plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__); ?>" type="text/css" rel="stylesheet" />
358
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/jquery.js'; ?>'></script>
359
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'core.min.js'; ?>'></script>
360
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'datepicker.min.js'; ?>'></script>
383
  $settings_link = '<a href="admin.php?page='.$this->menu_parameter.'">'.__('Settings','contact-form-to-email').'</a>';
384
  array_unshift($links, $settings_link);
385
  $help_link = '<a href="https://form2email.dwbooster.com/support">'.__('Documentation','contact-form-to-email').'</a>';
386
+ array_unshift($links, $help_link);
387
  $s_link = '<a href="https://wordpress.org/support/plugin/contact-form-to-email#new-post">'.__('Support','contact-form-to-email').'</a>';
388
+ array_unshift($links, $s_link);
389
  return $links;
390
  }
391
 
392
 
393
  public function admin_menu() {
394
  add_options_page($this->plugin_name.' Options', $this->plugin_name, 'manage_options', $this->menu_parameter, array($this, 'settings_page') );
395
+ add_menu_page( $this->plugin_name.' Options', $this->plugin_name, 'edit_pages', $this->menu_parameter, array($this, 'settings_page') );
396
+ add_submenu_page( $this->menu_parameter, 'Help: Online demo', 'Help: Online demo', 'read', $this->menu_parameter."_demo", array($this, 'settings_page') );
397
+ add_submenu_page( $this->menu_parameter, 'Help: Documentation', 'Help: Documentation', 'read', $this->menu_parameter."_docs", array($this, 'settings_page') );
398
+ add_submenu_page( $this->menu_parameter, 'Help: Free support', 'Help: Free support', 'read', $this->menu_parameter."_fsupport", array($this, 'settings_page') );
399
+
400
+ add_submenu_page( $this->menu_parameter, 'Upgrade', 'Upgrade', 'edit_pages', $this->menu_parameter."_upgrade", array($this, 'settings_page') );
401
  }
402
 
403
 
430
  {
431
  echo("Redirecting to upgrade page...<script type='text/javascript'>document.location='https://form2email.dwbooster.com/download';</script>");
432
  exit;
433
+ }
434
  else if ($this->get_param("page") == $this->menu_parameter.'_demo')
435
  {
436
  echo("Redirecting to demo page...<script type='text/javascript'>document.location='https://form2email.dwbooster.com/home#demos';</script>");
437
  exit;
438
+ }
439
  else if ($this->get_param("page") == $this->menu_parameter.'_docs')
440
  {
441
  echo("Redirecting to demo page...<script type='text/javascript'>document.location='https://form2email.dwbooster.com/documentation?open=1';</script>");
442
  exit;
443
+ }
444
  else if ($this->get_param("page") == $this->menu_parameter.'_fsupport')
445
  {
446
  echo("Redirecting to demo page...<script type='text/javascript'>document.location='https://wordpress.org/support/plugin/contact-form-to-email#new-post';</script>");
449
  else
450
  @include_once dirname( __FILE__ ) . '/cp-admin-int-list.inc.php';
451
  }
452
+
453
  function gutenberg_block() {
454
  global $wpdb;
455
+
456
  wp_enqueue_script( 'cfte_gutenberg_editor', plugins_url('/js/block.js', __FILE__));
457
+
458
+ wp_enqueue_style('cfte-publicstyle', plugins_url('css/stylepublic.css', __FILE__));
459
+
460
  wp_deregister_script('query-stringify');
461
  wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
462
 
463
  wp_deregister_script($this->prefix.'_validate_script');
464
+ wp_register_script($this->prefix.'_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
465
  wp_enqueue_script( $this->prefix.'_builder_script',
466
+ plugins_url('/js/fbuilderf.jquery.js', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip","query-stringify",$this->prefix."_validate_script"), false, true );
467
+
468
  $forms = array();
469
  $rows = $wpdb->get_results("SELECT id,form_name FROM ".$wpdb->prefix.$this->table_items." ORDER BY form_name");
470
  foreach ($rows as $item)
476
  wp_localize_script( 'cfte_gutenberg_editor', 'apphourbk_forms', array(
477
  'forms' => $forms,
478
  'siteUrl' => get_site_url()
479
+ ) );
480
  }
481
+
482
+
483
  public function render_form_admin ($atts) {
484
  $is_gutemberg_editor = defined( 'REST_REQUEST' ) && REST_REQUEST && ! empty( $_REQUEST['context'] ) && 'edit' === $_REQUEST['context'];
485
  if (!$is_gutemberg_editor)
505
  wp_enqueue_style('cfte-newadminstyle', plugins_url('/css/newadminlayout.css', __FILE__));
506
  //wp_enqueue_style('jquery-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
507
  if ($this->get_param("report") == '1')
508
+ wp_enqueue_script( $this->prefix.'_excanvas', plugins_url('/js/excanvas.min.js', __FILE__));
509
  }
510
  if( 'post.php' != $hook && 'post-new.php' != $hook )
511
  return;
516
 
517
  function data_management_loaded() {
518
  global $wpdb;
519
+
520
  $action = $this->get_param('cp_contactformtoemail_do_action_loaded');
521
  if (!$action) return; // go out if the call isn't for this one
522
 
525
  if ($action == "wizard")
526
  {
527
  $shortcode = '['.$this->shorttag.' id="'.$this->item .'"]';
528
+ $this->postURL = $this->publish_on($_POST["whereto"], $_POST["publishpage"], $_POST["publishpost"], $shortcode, $_POST["posttitle"]);
529
  return;
530
  }
531
 
533
  echo 'Some unexpected error happened. If you see this error contact the support service at https://form2email.dwbooster.com/contact-us';
534
 
535
  exit();
536
+ }
537
+
538
 
 
539
  private function publish_on($whereto, $publishpage = '', $publishpost = '', $content = '', $posttitle = 'Booking Form')
540
  {
541
  global $wpdb;
548
  'post_content' => 'This is a <b>preview</b> page, remember to publish it if needed. You can edit the full form settings into the admin settings page.<br /><br /> '.$content,
549
  'post_status' => 'draft'
550
  );
551
+
552
  // Insert the post into the database
553
  $id = wp_insert_post( $my_post );
554
  }
555
+ else
556
  {
557
  $id = ($whereto == '2'?$publishpage:$publishpost);
558
  $post = get_post( $id );
569
  }
570
  return get_permalink($id);
571
  }
572
+
573
+
574
  function data_management() {
575
  global $wpdb;
576
 
602
  $this->save_options();
603
  return;
604
  }
605
+
606
  if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['CP_CFTE_post_edition'] ) && is_admin() )
607
  {
608
  $this->save_edition();
609
  return;
610
+ }
611
+
612
  if ( 'POST' != $_SERVER['REQUEST_METHOD'] || ! isset( $_POST[$this->prefix.'_pform_process'] ) )
613
  if ( 'GET' != $_SERVER['REQUEST_METHOD'] || !isset( $_GET['hdcaptcha_'.$this->prefix.'_post'] ) )
614
  return;
629
  )
630
  {
631
  $_SESSION['rand_code'.$sequence] = '';
632
+ setCookie('rand_code'.$sequence, '', time()+36000,"/");
633
  echo 'captchafailed';
634
  exit;
635
  }
644
  //if (get_magic_quotes_gpc())
645
  foreach ($_POST as $item => $value)
646
  $_POST[$item] = (is_array($value)?$value:stripcslashes($value));
647
+
648
  // get form info
649
  //---------------------------
650
  require_once(ABSPATH . "wp-admin" . '/includes/file.php');
668
  //---------------------------
669
  $buffer = "";
670
  $params = array();
671
+ $params["referrer"] = $_POST["refpage".$sequence];
672
  foreach ($_POST as $item => $value)
673
  if (isset($fields[str_replace($sequence,'',$item)]))
674
  {
690
  // else {print_r($movefile);exit;} // un-comment this line if the uploads aren't working
691
  }
692
  $buffer_A = $buffer;
693
+
694
  $_SESSION['rand_code'.$sequence] = '';
695
+ setCookie('rand_code'.$sequence, '', time()+36000,"/");
696
 
697
  $saveipaddr = ('true' == $this->get_option('fp_inc_additional_info', CP_CFEMAIL_DEFAULT_fp_inc_additional_info));
698
  // insert into database
708
  ) );
709
  if (!$rows_affected)
710
  {
711
+ echo 'Error saving data! Please try again.';
712
  echo '<br /><br />If the error persists please be sure you are using the latest version and in that case contact support service at https://form2email.dwbooster.com/contact-us?debug=db';
713
  exit;
714
  }
717
  $item_number = $myrows[0]->max_id;
718
 
719
  $this->ready_to_go_reservation($item_number, "", $params);
720
+
721
  if ($_POST[ $this->prefix."_pform_status"] == '1')
722
  echo 'OK';
723
  else
743
  global $wpdb;
744
 
745
  $myrows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ".$wpdb->prefix.$this->table_messages." WHERE id=%d", $itemnumber ) );
746
+
747
  $mycalendarrows = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.$this->table_items.' WHERE `id`=%d', $myrows[0]->formid ) );
748
 
749
  $this->item = $myrows[0]->formid;
774
  if (strpos($item,"_link"))
775
  $attachments[] = $value;
776
  }
777
+
778
  $message = str_replace('<'.'%itemnumber%'.'>',$itemnumber,$message);
779
  $subject = str_replace('<'.'%itemnumber%'.'>',$itemnumber,$subject);
780
+
781
  for ($i=0;$i<500;$i++)
782
  {
783
  $subject = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$subject);
784
+ $message = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$message);
785
  }
786
+
787
  $from = trim($this->get_option('fp_from_email', @CP_CFEMAIL_DEFAULT_fp_from_email));
788
  $to = explode(",",$this->get_option('fp_destination_emails', @CP_CFEMAIL_DEFAULT_fp_destination_emails));
789
  if ('html' == $this->get_option('fp_emailformat', CP_CFEMAIL_DEFAULT_email_format)) $content_type = "Content-Type: text/html; charset=utf-8\n"; else $content_type = "Content-Type: text/plain; charset=utf-8\n";
793
  $from_1 = $replyto;
794
  else
795
  $from_1 = $from;
796
+
797
  if ($this->get_option('fp_enableemail', 'true') != 'false')
798
+ {
799
  foreach ($to as $item)
800
  if (trim($item) != '')
801
  {
802
  if (!strpos($from_1,">"))
803
+ $from_1 = '"'.$from_1.'" <'.$from_1.'>';
804
  wp_mail(trim($item), $subject, $message,
805
  "From: ".$from_1."\r\n".
806
  ($replyto!=''?"Reply-To: \"$replyto\" <".$replyto.">\r\n":'').
826
  $subject = str_replace('<'.'%'.$item.'%'.'>',(is_array($value)?(implode(", ",$value)):($value)),$subject);
827
  }
828
  if ('html' == $this->get_option('cu_emailformat', CP_CFEMAIL_DEFAULT_email_format)) $content_type = "Content-Type: text/html; charset=utf-8\n"; else $content_type = "Content-Type: text/plain; charset=utf-8\n";
829
+
830
  for ($i=0;$i<500;$i++)
831
  {
832
  $subject = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$subject);
833
+ $message = str_replace('<'.'%fieldname'.$i.'%'.'>',"",$message);
834
+ }
835
+
836
  if (!strpos($from,">"))
837
  $from = '"'.$from.'" <'.$from.'>';
838
+
839
  if ($_POST[$to] != '')
840
  wp_mail(trim($_POST[$to]), $subject, $message,
841
  "From: ".$from."\r\n".
859
  echo 'Error: Form cannot be authenticated. Please contact our <a href="https://form2email.dwbooster.com/contact-us">support service</a> for verification and solution. Thank you.';
860
  return;
861
  }
862
+
863
  foreach ($_POST as $item => $value)
864
  if (!is_array($value))
865
+ $_POST[$item] = stripcslashes($value);
866
  if (substr_count($_POST['editionarea'],"\\\""))
867
  $_POST["editionarea"] = stripcslashes($_POST["editionarea"]);
868
+ if ($_POST["cfwpp_edit"] == 'js')
869
+ update_option('CP_CFTE_JS', base64_encode($_POST["editionarea"]));
870
+ else if ($_POST["cfwpp_edit"] == 'css')
871
+ update_option('CP_CFTE_CSS', base64_encode($_POST["editionarea"]));
872
  }
873
+
874
+
875
  function save_options()
876
  {
877
  global $wpdb;
878
+
879
  $verify_nonce = wp_verify_nonce( $_POST['rsave'], 'cfpoll_update_actions_post');
880
  if (!$verify_nonce)
881
  {
882
  echo 'Error: Form cannot be authenticated. Please contact our <a href="https://form2email.dwbooster.com/contact-us">support service</a> for verification and solution. Thank you.';
883
  return;
884
  }
885
+
886
  $this->item = $_POST[$this->prefix."_id"];
887
+
888
  if (substr_count($_POST['form_structure'],"\\") > 30)
889
  foreach ($_POST as $item => $value)
890
  if (!is_array($value))
901
  $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_of'," varchar(250) NOT NULL default ''");
902
  $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_submitbtn'," varchar(250) NOT NULL default ''");
903
  $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_previousbtn'," varchar(250) NOT NULL default ''");
904
+ $this->add_field_verify($wpdb->prefix.$this->table_items,'vs_text_nextbtn'," varchar(250) NOT NULL default ''");
905
 
906
  $this->add_field_verify($wpdb->prefix.$this->table_items, "onsubmitaction", "VARCHAR(10)");
907
+ $this->add_field_verify($wpdb->prefix.$this->table_items, "fp_return_message", "text");
908
+ $this->add_field_verify($wpdb->prefix.$this->table_items, "fp_enableemail", "VARCHAR(10)");
909
 
910
+ $wpdb->update ( $wpdb->prefix.$this->table_items,
911
  array(
912
  'form_structure' => $_POST['form_structure'],
913
+
914
  'fp_from_email' => $_POST['fp_from_email'],
915
  'fp_destination_emails' => $_POST['fp_destination_emails'],
916
  'fp_subject' => $_POST['fp_subject'],
918
  'fp_return_page' => $_POST['fp_return_page'],
919
  'fp_message' => $_POST['fp_message'],
920
  'fp_emailformat' => $_POST['fp_emailformat'],
921
+
922
  'cu_enable_copy_to_user' => $_POST['cu_enable_copy_to_user'],
923
  'cu_user_email_field' => $_POST['cu_user_email_field'],
924
  'cu_subject' => $_POST['cu_subject'],
925
  'cu_message' => $_POST['cu_message'],
926
  'cu_emailformat' => $_POST['cu_emailformat'],
927
  'fp_emailfrommethod' => $_POST['fp_emailfrommethod'],
928
+
929
  'onsubmitaction' => $_POST['onsubmitaction'],
930
  'fp_return_message' => $_POST['fp_return_message'],
931
  'fp_enableemail' => $_POST['fp_enableemail'],
932
+
933
  'vs_text_is_required' => $_POST['vs_text_is_required'],
934
  'vs_text_is_email' => $_POST['vs_text_is_email'],
935
  'vs_text_datemmddyyyy' => $_POST['vs_text_datemmddyyyy'],
943
  'vs_text_submitbtn' => $_POST['vs_text_submitbtn'],
944
  'vs_text_previousbtn' => $_POST['vs_text_previousbtn'],
945
  'vs_text_nextbtn' => $_POST['vs_text_nextbtn'],
946
+
947
  'rep_enable' => $_POST['rep_enable'],
948
  'rep_days' => $_POST['rep_days'],
949
  'rep_hour' => $_POST['rep_hour'],
951
  'rep_subject' => $_POST['rep_subject'],
952
  'rep_emailformat' => $_POST['rep_emailformat'],
953
  'rep_message' => $_POST['rep_message'],
954
+
955
  'cv_enable_captcha' => $_POST['cv_enable_captcha'],
956
  'cv_width' => $_POST['cv_width'],
957
  'cv_height' => $_POST['cv_height'],
1048
  {
1049
  $hlabel = iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form));
1050
  echo '"'.str_replace('"','""', $hlabel).'",';
1051
+ }
1052
  echo "\n";
1053
  foreach ($values as $item)
1054
  {
1071
  {
1072
  $this->item = $id;
1073
  }
1074
+
1075
 
1076
  public function translate_json($str)
1077
  {
1078
+ $form_data = json_decode($this->cleanJSON($str));
1079
+
1080
+ $form_data[1][0]->title = __($form_data[1][0]->title,'contact-form-to-email');
1081
+ $form_data[1][0]->description = __($form_data[1][0]->description,'contact-form-to-email');
1082
+
1083
+ for ($i=0; $i < count($form_data[0]); $i++)
1084
  {
1085
+ $form_data[0][$i]->title = __($form_data[0][$i]->title,'contact-form-to-email');
1086
+ $form_data[0][$i]->userhelpTooltip = __($form_data[0][$i]->userhelpTooltip,'contact-form-to-email');
1087
+ $form_data[0][$i]->userhelp = __($form_data[0][$i]->userhelp,'contact-form-to-email');
1088
  if ($form_data[0][$i]->ftype == 'fCommentArea')
1089
+ $form_data[0][$i]->userhelp = __($form_data[0][$i]->userhelp,'contact-form-to-email');
1090
+ else
1091
+ if ($form_data[0][$i]->ftype == 'fradio' || $form_data[0][$i]->ftype == 'fcheck' || $form_data[0][$i]->ftype == 'fradio')
1092
  {
1093
+ for ($j=0; $j < count($form_data[0][$i]->choices); $j++)
1094
+ $form_data[0][$i]->choices[$j] = __($form_data[0][$i]->choices[$j],'contact-form-to-email');
1095
+ }
1096
+ }
1097
  $str = json_encode($form_data);
1098
  return $str;
1099
  }
1100
+
1101
 
1102
  private function get_records_csv($formid, $form_name = "")
1103
  {
1105
 
1106
  $saved_item = $this->item;
1107
  $this->item = intval($formid);
1108
+
1109
  $last_sent_id = get_option('cp_cfte_last_sent_id_'.$formid, '0');
1110
  $events = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ".$wpdb->prefix.$this->table_messages." WHERE formid=%d AND id>%d ORDER BY id ASC", $formid, $last_sent_id) );
1111
 
1159
  {
1160
  $hlabel = iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form));
1161
  $buffer .= '"'.str_replace('"','""', $hlabel).'",';
1162
+ }
1163
  $buffer .= "\n";
1164
  foreach ($values as $item)
1165
  {
1174
  }
1175
  $buffer .= "\n";
1176
  }
1177
+
1178
+ $this->item = $saved_item;
1179
  return $buffer;
1180
 
1181
  }
1193
  {
1194
  $formid = 0;
1195
  $verify_after = date("Y-m-d H:i:s", strtotime("-".get_option('cp_cfte_rep_days', '')." days"));
1196
+ $last_sent = get_option('cp_cfte_last_sent'.$formid, '');
1197
  if ($last_sent == '' || $last_sent < $verify_after) // check if this form needs to check for a new report
1198
  {
1199
  update_option('cp_cfte_last_sent'.$formid, date("Y-m-d ".(get_option('cp_cfte_rep_hour', '')<'10'?'0':'').get_option('cp_cfte_rep_hour', '').":00:00"));
1201
  $forms = $wpdb->get_results("SELECT id,fp_from_email,form_name,rep_days,rep_hour,rep_emails,rep_subject,rep_emailformat,rep_message,rep_enable FROM ".$wpdb->prefix.$this->table_items." WHERE rep_emails<>'' AND rep_enable='yes'");
1202
  $attachments = array();
1203
  foreach ($forms as $form) // for each form with the reports enabled
1204
+ {
1205
  $csv = $this->get_records_csv($form->id, $form->form_name);
1206
  if ($csv != '')
1207
  {
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.2.72
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.2.73
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
js/block.js CHANGED
@@ -52,7 +52,7 @@ jQuery(function()
52
  edit: function( { attributes, className, isSelected, setAttributes } ) {
53
  const formOptions = apphourbk_forms.forms;
54
  if (!formOptions.length)
55
- return el("div", null, 'Please create a booking form first.' );
56
  var iId = attributes.instanceId;
57
  if (!iId)
58
  {
52
  edit: function( { attributes, className, isSelected, setAttributes } ) {
53
  const formOptions = apphourbk_forms.forms;
54
  if (!formOptions.length)
55
+ return el("div", null, 'Please create a contact form first.' );
56
  var iId = attributes.instanceId;
57
  if (!iId)
58
  {