Contact Bank: WordPress Form Builder for Contact Forms - Version 2.1.27

Version Description

  • Security Patch
  • Code Optimized
Download this release

Release Info

Developer contact-banker
Plugin Icon 128x128 Contact Bank: WordPress Form Builder for Contact Forms
Version 2.1.27
Comparing to
See all releases

Code changes from version 2.1.26 to 2.1.27

contact-bank.php CHANGED
@@ -4,13 +4,14 @@ Plugin Name: Contact Bank Lite Edition
4
  Plugin URI: http://tech-banker.com
5
  Description: Build Complex, Powerful Contact Forms in Just Seconds. No Programming Knowledge Required! Yeah, It's Really That Easy.
6
  Author: Tech Banker
7
- Version: 2.1.26
8
  Author URI: http://tech-banker.com
9
  License: GPLv3 or later
10
  */
11
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12
  // D e f i n e CONSTANTS //////////////////////////////////////////////////////////////////////////////////////////////////
13
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
14
  if (!defined("CONTACT_BK_PLUGIN_DIR")) define("CONTACT_BK_PLUGIN_DIR", plugin_dir_path( __FILE__ ));
15
  if (!defined("CONTACT_BK_PLUGIN_DIRNAME")) define("CONTACT_BK_PLUGIN_DIRNAME", plugin_basename(dirname(__FILE__)));
16
  if (!defined("CONTACT_BK")) define("CONTACT_BK","contact-bank/contact-bank.php");
@@ -37,7 +38,17 @@ if(!function_exists("plugin_install_script_for_contact_bank"))
37
  {
38
  function plugin_install_script_for_contact_bank()
39
  {
40
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
41
  if (is_multisite())
42
  {
43
  $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
@@ -411,6 +422,10 @@ if(!function_exists("contact_feature_request"))
411
  {
412
  include_once CONTACT_BK_PLUGIN_DIR ."/views/contact-feedback.php";
413
  }
 
 
 
 
414
  }
415
  }
416
  if(!function_exists("contact_system_status"))
@@ -1373,11 +1388,15 @@ if(!class_exists("Contact_Bank_Widget"))
1373
  {
1374
  class Contact_Bank_Widget extends WP_Widget
1375
  {
1376
- function Contact_Bank_Widget()
1377
  {
1378
- $widget_ops = array("classname" => "Contact_Bank_Widget", "description" => "Uses Contact Form" );
1379
- $this->__construct("Contact_Bank_Widget", "Contact Bank", $widget_ops);
 
 
 
1380
  }
 
1381
  function form($instance)
1382
  {
1383
  $instance = wp_parse_args((array) $instance, array( "title" => "", "form_id" => "0" ) );
4
  Plugin URI: http://tech-banker.com
5
  Description: Build Complex, Powerful Contact Forms in Just Seconds. No Programming Knowledge Required! Yeah, It's Really That Easy.
6
  Author: Tech Banker
7
+ Version: 2.1.27
8
  Author URI: http://tech-banker.com
9
  License: GPLv3 or later
10
  */
11
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12
  // D e f i n e CONSTANTS //////////////////////////////////////////////////////////////////////////////////////////////////
13
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
14
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
15
  if (!defined("CONTACT_BK_PLUGIN_DIR")) define("CONTACT_BK_PLUGIN_DIR", plugin_dir_path( __FILE__ ));
16
  if (!defined("CONTACT_BK_PLUGIN_DIRNAME")) define("CONTACT_BK_PLUGIN_DIRNAME", plugin_basename(dirname(__FILE__)));
17
  if (!defined("CONTACT_BK")) define("CONTACT_BK","contact-bank/contact-bank.php");
38
  {
39
  function plugin_install_script_for_contact_bank()
40
  {
41
+ global $wpdb,$current_user,$cb_user_role_permission;
42
+ if (is_super_admin())
43
+ {
44
+ $cb_role = "administrator";
45
+ }
46
+ else
47
+ {
48
+ $cb_role = $wpdb->prefix . "capabilities";
49
+ $current_user->role = array_keys($current_user->$cb_role);
50
+ $cb_role = $current_user->role[0];
51
+ }
52
  if (is_multisite())
53
  {
54
  $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
422
  {
423
  include_once CONTACT_BK_PLUGIN_DIR ."/views/contact-feedback.php";
424
  }
425
+ if(file_exists(CONTACT_BK_PLUGIN_DIR ."/views/footer.php"))
426
+ {
427
+ include_once CONTACT_BK_PLUGIN_DIR ."/views/footer.php";
428
+ }
429
  }
430
  }
431
  if(!function_exists("contact_system_status"))
1388
  {
1389
  class Contact_Bank_Widget extends WP_Widget
1390
  {
1391
+ function __construct()
1392
  {
1393
+ parent::__construct(
1394
+ "Contact_Bank_Widget", // Base ID
1395
+ __("Contact Bank Widget", "contact_bank"), // Name
1396
+ array( "description" => __( "Build Complex, Powerful Contact Forms in Just Seconds.", "contact_bank" ), ) // Args
1397
+ );
1398
  }
1399
+
1400
  function form($instance)
1401
  {
1402
  $instance = wp_parse_args((array) $instance, array( "title" => "", "form_id" => "0" ) );
frontend_views/contact_bank_forms.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  global $wpdb;
3
  $control_settings_array = array();
4
  $form_settings_array = array();
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  global $wpdb;
4
  $control_settings_array = array();
5
  $form_settings_array = array();
includes/cb_checkbox.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
includes/cb_dropdown.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
includes/cb_email.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
includes/cb_multiple.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
includes/cb_text.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
includes/cb_textarea.php CHANGED
@@ -1,16 +1,16 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
5
  $cb_user_role_permission = "manage_options";
6
- break;
7
  case "editor":
8
  $cb_user_role_permission = "publish_pages";
9
- break;
10
  case "author":
11
  $cb_user_role_permission = "publish_posts";
12
- break;
13
-
14
  }
15
  if (!current_user_can($cb_user_role_permission))
16
  {
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
6
  $cb_user_role_permission = "manage_options";
7
+ break;
8
  case "editor":
9
  $cb_user_role_permission = "publish_pages";
10
+ break;
11
  case "author":
12
  $cb_user_role_permission = "publish_posts";
13
+ break;
 
14
  }
15
  if (!current_user_can($cb_user_role_permission))
16
  {
lib/contact_bank_email-class.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
lib/contact_bank_email_management.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  global $wpdb;
3
  if(isset($_REQUEST["param"]))
4
  {
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  global $wpdb;
4
  if(isset($_REQUEST["param"]))
5
  {
lib/contact_bank_frontend-class.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  global $wpdb;
3
  if(isset($_REQUEST["param"]))
4
  {
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  global $wpdb;
4
  if(isset($_REQUEST["param"]))
5
  {
lib/contact_bank_layout-class.php CHANGED
@@ -1,17 +1,17 @@
1
  <?php
2
-
3
- switch($cb_role)
4
- {
5
- case "administrator":
6
- $cb_user_role_permission = "manage_options";
7
- break;
8
- case "editor":
9
- $cb_user_role_permission = "publish_pages";
10
- break;
11
- case "author":
12
- $cb_user_role_permission = "publish_posts";
13
- break;
14
- }
15
  if (!current_user_can($cb_user_role_permission))
16
  {
17
  return;
@@ -19,8 +19,8 @@ if (!current_user_can($cb_user_role_permission))
19
  else
20
  {
21
  $settings = array();
22
- $settings["label_setting_font_family"] = isset($_REQUEST["ux_ddl_font_family"]) ? esc_attr($_REQUEST["ux_ddl_font_family"]): "inherit";
23
- $settings["label_setting_font_color"] = isset($_REQUEST["ux_clr_font_color"]) ? esc_attr($_REQUEST["ux_clr_font_color"]): "#000000";
24
  $settings["label_setting_font_style"] = isset($_REQUEST["ux_ddl_font_style"]) ? esc_attr($_REQUEST["ux_ddl_font_style"]): "normal";
25
  $settings["label_setting_font_size"] = isset($_REQUEST["ux_txt_font_size"]) ? esc_attr($_REQUEST["ux_txt_font_size"]): "16";
26
  $settings["label_setting_font_align_left"] = isset($_REQUEST["ux_rdl_font_align"]) ? intval($_REQUEST["ux_rdl_font_align"]): "0";
@@ -29,7 +29,7 @@ else
29
  $settings["label_setting_field_align"] = isset($_REQUEST["ux_ddl_field_align"]) ? esc_attr($_REQUEST["ux_ddl_field_align"]): "left";
30
  $settings["label_setting_hide_label"] = isset($_REQUEST["ux_chk_hide_label"]) ? esc_attr($_REQUEST["ux_chk_hide_label"]): "0";
31
  $settings["label_setting_text_direction"] = isset($_REQUEST["ux_ddl_direction"]) ? esc_attr($_REQUEST["ux_ddl_direction"]): "inherit";
32
-
33
  $settings["input_field_font_family"] = isset($_REQUEST["ux_ddl_font_family_input_field"]) ? esc_attr($_REQUEST["ux_ddl_font_family_input_field"]): "inherit";
34
  $settings["input_field_font_color"] = isset($_REQUEST["ux_clr_text_color_input_field"]) ? esc_attr($_REQUEST["ux_clr_text_color_input_field"]): "#000000";
35
  $settings["input_field_font_style"] = isset($_REQUEST["ux_ddl_font_style_input_field"]) ? esc_attr($_REQUEST["ux_ddl_font_style_input_field"]): "normal";
@@ -43,7 +43,7 @@ else
43
  $settings["input_field_rdl_text_align"] = isset($_REQUEST["ux_rdl_font_align_input_field"]) ? intval($_REQUEST["ux_rdl_font_align_input_field"]): "0";
44
  $settings["input_field_text_direction"] = isset($_REQUEST["ux_ddl_input_field_direction"]) ? esc_attr($_REQUEST["ux_ddl_input_field_direction"]): "inherit";
45
  $settings["input_field_input_size"] = isset($_REQUEST["ux_input_size_input_field"]) ? esc_attr($_REQUEST["ux_input_size_input_field"]): "layout-span6";
46
-
47
  $settings["submit_button_font_family"] = isset($_REQUEST["ux_ddl_font_family_submit_button"]) ? esc_attr($_REQUEST["ux_ddl_font_family_submit_button"]): "inherit";
48
  $settings["submit_button_text"] = isset($_REQUEST["ux_txt_text_submit_button"]) ? esc_attr($_REQUEST["ux_txt_text_submit_button"]): "Submit";
49
  $settings["submit_button_font_style"] = isset($_REQUEST["ux_ddl_font_style_submit_button"]) ? esc_attr($_REQUEST["ux_ddl_font_style_submit_button"]): "normal";
@@ -57,7 +57,7 @@ else
57
  $settings["submit_button_border_radius"] = isset($_REQUEST["ux_txt_border_radius_submit_button"]) ? esc_attr($_REQUEST["ux_txt_border_radius_submit_button"]): "0";
58
  $settings["submit_button_rdl_text_align"] = isset($_REQUEST["ux_rdl_font_align_submit_button"]) ? intval($_REQUEST["ux_rdl_font_align_submit_button"]): "0";
59
  $settings["submit_button_text_direction"] = isset($_REQUEST["ux_ddl_submit_button_direction"]) ? esc_attr($_REQUEST["ux_ddl_submit_button_direction"]): "inherit";
60
-
61
  $settings["success_msg_font_family"] = isset($_REQUEST["ux_ddl_font_family_success_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_family_success_msg"]): "inherit";
62
  $settings["success_msg_font_size"] = isset($_REQUEST["ux_ddl_font_size_success_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_size_success_msg"]): "12";
63
  $settings["success_msg_bg_color"] = isset($_REQUEST["ux_clr_bg_color_success_msg"]) ? esc_attr($_REQUEST["ux_clr_bg_color_success_msg"]): "#e5ffd5";
@@ -65,7 +65,7 @@ else
65
  $settings["success_msg_text_color"] = isset($_REQUEST["ux_clr_text_color_success_msg"]) ? esc_attr($_REQUEST["ux_clr_text_color_success_msg"]): "#6aa500";
66
  $settings["success_msg_rdl_text_align"] = isset($_REQUEST["ux_rdl_font_align_success_msg"]) ? intval($_REQUEST["ux_rdl_font_align_success_msg"]): "0";
67
  $settings["success_msg_text_direction"] = isset($_REQUEST["ux_ddl_success_msg_direction"]) ? esc_attr($_REQUEST["ux_ddl_success_msg_direction"]): "default";
68
-
69
  $settings["error_msg_font_family"] = isset($_REQUEST["ux_ddl_font_family_error_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_family_error_msg"]): "inherit";
70
  $settings["error_msg_font_size"] = isset($_REQUEST["ux_ddl_font_size_error_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_size_error_msg"]): "12";
71
  $settings["error_msg_bg_color"] = isset($_REQUEST["ux_clr_bg_color_error_msg"]) ? esc_attr($_REQUEST["ux_clr_bg_color_error_msg"]): "#ffcaca";
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
4
+ {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
+ }
15
  if (!current_user_can($cb_user_role_permission))
16
  {
17
  return;
19
  else
20
  {
21
  $settings = array();
22
+ $settings["label_setting_font_family"] = isset($_REQUEST["ux_ddl_font_family"]) ? esc_attr($_REQUEST["ux_ddl_font_family"]): "inherit";
23
+ $settings["label_setting_font_color"] = isset($_REQUEST["ux_clr_font_color"]) ? esc_attr($_REQUEST["ux_clr_font_color"]): "#000000";
24
  $settings["label_setting_font_style"] = isset($_REQUEST["ux_ddl_font_style"]) ? esc_attr($_REQUEST["ux_ddl_font_style"]): "normal";
25
  $settings["label_setting_font_size"] = isset($_REQUEST["ux_txt_font_size"]) ? esc_attr($_REQUEST["ux_txt_font_size"]): "16";
26
  $settings["label_setting_font_align_left"] = isset($_REQUEST["ux_rdl_font_align"]) ? intval($_REQUEST["ux_rdl_font_align"]): "0";
29
  $settings["label_setting_field_align"] = isset($_REQUEST["ux_ddl_field_align"]) ? esc_attr($_REQUEST["ux_ddl_field_align"]): "left";
30
  $settings["label_setting_hide_label"] = isset($_REQUEST["ux_chk_hide_label"]) ? esc_attr($_REQUEST["ux_chk_hide_label"]): "0";
31
  $settings["label_setting_text_direction"] = isset($_REQUEST["ux_ddl_direction"]) ? esc_attr($_REQUEST["ux_ddl_direction"]): "inherit";
32
+
33
  $settings["input_field_font_family"] = isset($_REQUEST["ux_ddl_font_family_input_field"]) ? esc_attr($_REQUEST["ux_ddl_font_family_input_field"]): "inherit";
34
  $settings["input_field_font_color"] = isset($_REQUEST["ux_clr_text_color_input_field"]) ? esc_attr($_REQUEST["ux_clr_text_color_input_field"]): "#000000";
35
  $settings["input_field_font_style"] = isset($_REQUEST["ux_ddl_font_style_input_field"]) ? esc_attr($_REQUEST["ux_ddl_font_style_input_field"]): "normal";
43
  $settings["input_field_rdl_text_align"] = isset($_REQUEST["ux_rdl_font_align_input_field"]) ? intval($_REQUEST["ux_rdl_font_align_input_field"]): "0";
44
  $settings["input_field_text_direction"] = isset($_REQUEST["ux_ddl_input_field_direction"]) ? esc_attr($_REQUEST["ux_ddl_input_field_direction"]): "inherit";
45
  $settings["input_field_input_size"] = isset($_REQUEST["ux_input_size_input_field"]) ? esc_attr($_REQUEST["ux_input_size_input_field"]): "layout-span6";
46
+
47
  $settings["submit_button_font_family"] = isset($_REQUEST["ux_ddl_font_family_submit_button"]) ? esc_attr($_REQUEST["ux_ddl_font_family_submit_button"]): "inherit";
48
  $settings["submit_button_text"] = isset($_REQUEST["ux_txt_text_submit_button"]) ? esc_attr($_REQUEST["ux_txt_text_submit_button"]): "Submit";
49
  $settings["submit_button_font_style"] = isset($_REQUEST["ux_ddl_font_style_submit_button"]) ? esc_attr($_REQUEST["ux_ddl_font_style_submit_button"]): "normal";
57
  $settings["submit_button_border_radius"] = isset($_REQUEST["ux_txt_border_radius_submit_button"]) ? esc_attr($_REQUEST["ux_txt_border_radius_submit_button"]): "0";
58
  $settings["submit_button_rdl_text_align"] = isset($_REQUEST["ux_rdl_font_align_submit_button"]) ? intval($_REQUEST["ux_rdl_font_align_submit_button"]): "0";
59
  $settings["submit_button_text_direction"] = isset($_REQUEST["ux_ddl_submit_button_direction"]) ? esc_attr($_REQUEST["ux_ddl_submit_button_direction"]): "inherit";
60
+
61
  $settings["success_msg_font_family"] = isset($_REQUEST["ux_ddl_font_family_success_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_family_success_msg"]): "inherit";
62
  $settings["success_msg_font_size"] = isset($_REQUEST["ux_ddl_font_size_success_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_size_success_msg"]): "12";
63
  $settings["success_msg_bg_color"] = isset($_REQUEST["ux_clr_bg_color_success_msg"]) ? esc_attr($_REQUEST["ux_clr_bg_color_success_msg"]): "#e5ffd5";
65
  $settings["success_msg_text_color"] = isset($_REQUEST["ux_clr_text_color_success_msg"]) ? esc_attr($_REQUEST["ux_clr_text_color_success_msg"]): "#6aa500";
66
  $settings["success_msg_rdl_text_align"] = isset($_REQUEST["ux_rdl_font_align_success_msg"]) ? intval($_REQUEST["ux_rdl_font_align_success_msg"]): "0";
67
  $settings["success_msg_text_direction"] = isset($_REQUEST["ux_ddl_success_msg_direction"]) ? esc_attr($_REQUEST["ux_ddl_success_msg_direction"]): "default";
68
+
69
  $settings["error_msg_font_family"] = isset($_REQUEST["ux_ddl_font_family_error_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_family_error_msg"]): "inherit";
70
  $settings["error_msg_font_size"] = isset($_REQUEST["ux_ddl_font_size_error_msg"]) ? esc_attr($_REQUEST["ux_ddl_font_size_error_msg"]): "12";
71
  $settings["error_msg_bg_color"] = isset($_REQUEST["ux_clr_bg_color_error_msg"]) ? esc_attr($_REQUEST["ux_clr_bg_color_error_msg"]): "#ffcaca";
lib/contact_bank_layout_settings-class.php CHANGED
@@ -1,18 +1,18 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- switch($cb_role)
4
- {
5
- case "administrator":
6
- $cb_user_role_permission = "manage_options";
7
- break;
8
- case "editor":
9
- $cb_user_role_permission = "publish_pages";
10
- break;
11
- case "author":
12
- $cb_user_role_permission = "publish_posts";
13
- break;
14
-
15
- }
16
  if (!current_user_can($cb_user_role_permission))
17
  {
18
  return;
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
4
+ {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
 
15
+ }
 
 
 
 
 
 
 
 
 
 
 
 
16
  if (!current_user_can($cb_user_role_permission))
17
  {
18
  return;
lib/contact_bank_show_form_control_data-class.php CHANGED
@@ -1,18 +1,17 @@
1
  <?php
2
-
3
- switch($cb_role)
4
- {
5
- case "administrator":
6
- $cb_user_role_permission = "manage_options";
7
- break;
8
- case "editor":
9
- $cb_user_role_permission = "publish_pages";
10
- break;
11
- case "author":
12
- $cb_user_role_permission = "publish_posts";
13
- break;
14
-
15
- }
16
  if (!current_user_can($cb_user_role_permission))
17
  {
18
  return;
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
4
+ {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
+ }
 
15
  if (!current_user_can($cb_user_role_permission))
16
  {
17
  return;
lib/contact_frontend_data_class.php CHANGED
@@ -1,18 +1,18 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- switch($cb_role)
4
- {
5
- case "administrator":
6
- $cb_user_role_permission = "manage_options";
7
- break;
8
- case "editor":
9
- $cb_user_role_permission = "publish_pages";
10
- break;
11
- case "author":
12
- $cb_user_role_permission = "publish_posts";
13
- break;
14
-
15
- }
16
  if(!current_user_can($cb_user_role_permission))
17
  {
18
  return;
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
4
+ {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
 
15
+ }
 
 
 
 
 
 
 
 
 
 
 
 
16
  if(!current_user_can($cb_user_role_permission))
17
  {
18
  return;
lib/contact_view-class.php CHANGED
@@ -1,17 +1,18 @@
1
  <?php
2
- switch($cb_role)
3
- {
4
- case "administrator":
5
- $cb_user_role_permission = "manage_options";
6
- break;
7
- case "editor":
8
- $cb_user_role_permission = "publish_pages";
9
- break;
10
- case "author":
11
- $cb_user_role_permission = "publish_posts";
12
- break;
 
13
 
14
- }
15
  if(!current_user_can($cb_user_role_permission))
16
  {
17
  return;
@@ -341,7 +342,7 @@ else
341
  {
342
  $id = $element["dynamic_id"];
343
  $control_type = $element["control_type"];
344
- echo $event;
345
  if($event == "add")
346
  {
347
  $wpdb->query
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
4
+ {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
 
15
+ }
16
  if(!current_user_can($cb_user_role_permission))
17
  {
18
  return;
342
  {
343
  $id = $element["dynamic_id"];
344
  $control_type = $element["control_type"];
345
+
346
  if($event == "add")
347
  {
348
  $wpdb->query
lib/install-script.php CHANGED
@@ -1,514 +1,906 @@
1
  <?php
2
- if(!function_exists("create_table_contact_bank_forms"))
 
3
  {
4
- function create_table_contact_bank_forms()
5
- {
6
- $sql = 'CREATE TABLE ' . contact_bank_contact_form() . '(
7
- form_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
8
- form_name VARCHAR(200) NOT NULL,
9
- PRIMARY KEY (form_id)
10
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
11
- dbDelta($sql);
12
-
13
- }
14
  }
15
- if(!function_exists("create_table_contact_bank_dynamic_settings"))
16
  {
17
- function create_table_contact_bank_dynamic_settings()
18
- {
19
- $sql = 'CREATE TABLE ' . contact_bank_dynamic_settings_form() . '(
20
- dynamic_settings_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
21
- dynamicId INTEGER(10) NOT NULL,
22
- dynamic_settings_key VARCHAR(100) NOT NULL,
23
- dynamic_settings_value TEXT NOT NULL,
24
- PRIMARY KEY (dynamic_settings_id)
25
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
26
- dbDelta($sql);
27
- }
28
  }
29
- if(!function_exists("create_table_contact_bank_controls"))
30
  {
31
- function create_table_contact_bank_controls()
32
  {
33
- $sql = 'CREATE TABLE '.create_control_Table(). '(
34
- control_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
35
- field_id INTEGER(50) NOT NULL,
36
- form_id INTEGER(10) NOT NULL,
37
- column_dynamicId INTEGER(10) NOT NULL,
38
- sorting_order INTEGER(10) NOT NULL,
39
- PRIMARY KEY(control_id)
40
- )ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
41
- dbDelta($sql);
42
- }
43
- }
44
 
45
- if(!function_exists("create_table_front_end_data"))
46
- {
47
- function create_table_front_end_data()
48
  {
49
- $sql = 'CREATE TABLE ' . frontend_controls_data_Table() . '(
50
- id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
51
- form_id INTEGER(10) NOT NULL,
52
- field_Id INTEGER(10) NOT NULL,
53
- dynamic_control_id INTEGER(10) NOT NULL,
54
- dynamic_frontend_value TEXT NOT NULL,
55
- form_submit_id INTEGER(10) NOT NULL,
56
- PRIMARY KEY (id)
57
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
58
- dbDelta($sql);
 
59
  }
60
- }
61
- if(!function_exists("create_table_contact_bank_email_templates"))
62
- {
63
- function create_table_contact_bank_email_templates()
64
  {
65
- $sql = 'CREATE TABLE ' . contact_bank_email_template_admin() . '(
66
- email_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
67
- email_to VARCHAR(100) NOT NULL,
68
- email_from VARCHAR(100) NOT NULL,
69
- body_content TEXT NOT NULL,
70
- subject VARCHAR(400) NOT NULL,
71
- send_to INTEGER(1) NOT NULL,
72
- form_id INTEGER(10) NOT NULL,
73
- from_name VARCHAR(200) NOT NULL,
74
- reply_to VARCHAR(200) NOT NULL,
75
- cc VARCHAR(200) NOT NULL,
76
- bcc VARCHAR(200) NOT NULL,
77
- name VARCHAR(100) NOT NULL,
78
- PRIMARY KEY (email_id)
79
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
80
- dbDelta($sql);
81
  }
82
- }
83
- if(!function_exists("create_table_contact_bank_front_end_forms"))
84
- {
85
- function create_table_contact_bank_front_end_forms()
86
  {
87
- $sql = 'CREATE TABLE ' . contact_bank_frontend_forms_Table() . '(
88
- id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
89
- form_id INTEGER(10) NOT NULL,
90
- submit_id INTEGER(10) NOT NULL,
91
- PRIMARY KEY (id)
92
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
93
- dbDelta($sql);
 
 
 
 
 
 
94
  }
95
- }
96
- if(!function_exists("create_contact_bank_layout_settings"))
97
- {
98
- function create_contact_bank_layout_settings()
99
  {
100
- $sql = 'CREATE TABLE ' . contact_bank_layout_settings_Table() . '(
101
- id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
102
- form_id INTEGER(10) NOT NULL,
103
- form_settings_key VARCHAR(200) NOT NULL,
104
- form_settings_value VARCHAR(200) NOT NULL,
105
- PRIMARY KEY (id)
106
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
107
- dbDelta($sql);
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
- }
110
- if(!function_exists("create_contact_bank_form_settings"))
111
- {
112
- function create_contact_bank_form_settings()
113
  {
114
- $sql = 'CREATE TABLE ' . contact_bank_form_settings_Table() . '(
115
- id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
116
- form_id INTEGER(10) NOT NULL,
117
- form_message_key VARCHAR(200) NOT NULL,
118
- form_message_value TEXT NOT NULL,
119
- PRIMARY KEY (id)
120
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
121
- dbDelta($sql);
 
 
122
  }
123
- }
124
- if(!function_exists("create_cb_table_licensing"))
125
- {
126
- function create_cb_table_licensing()
127
  {
128
- global $wpdb;
129
- $sql = "CREATE TABLE " . contact_bank_licensing() . "(
130
- licensing_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
131
- version VARCHAR(10) NOT NULL,
132
- type VARCHAR(100) NOT NULL,
133
- url TEXT NOT NULL,
134
- api_key TEXT NOT NULL,
135
- order_id VARCHAR(100) NOT NULL,
136
- PRIMARY KEY (licensing_id)
137
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci";
138
- dbDelta($sql);
139
-
140
- $wpdb->query
141
- (
142
- $wpdb->prepare
143
- (
144
- "INSERT INTO " . contact_bank_licensing() . "(version, type, url) VALUES(%s, %s, %s)",
145
- "2.1.0",
146
- "Contact Bank",
147
- "" . site_url() . ""
148
- )
149
- );
150
  }
151
- }
152
- if(!function_exists("create_table_roles_capability"))
153
- {
154
- function create_table_roles_capability()
155
  {
156
- $sql = 'CREATE TABLE ' . contact_bank_roles_capability() . '(
157
- id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
158
- roles_capability_key VARCHAR(200) NOT NULL,
159
- roles_capability_value VARCHAR(200) NOT NULL,
160
- PRIMARY KEY (id)
161
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
162
- dbDelta($sql);
 
 
 
 
163
  }
164
- }
165
- global $wpdb;
166
- require_once(ABSPATH . "wp-admin/includes/upgrade.php");
167
- update_option("contact-bank-updation-check-url","http://tech-banker.com/wp-admin/admin-ajax.php");
168
- $version = get_option("contact-bank-version-number");
169
- if($version == "" || $version == "1.0")
170
- {
171
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_form_settings_Table() . '"')) == 0)
172
  {
173
- create_contact_bank_form_settings();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_contact_form() . '"')) == 0)
176
  {
177
- create_table_contact_bank_forms();
 
 
 
 
 
 
 
 
 
178
  }
179
- else
 
 
 
 
180
  {
181
- $contact_forms = $wpdb->get_results
182
- (
183
- "SELECT * FROM ".contact_bank_contact_form()
184
- );
185
- $sql = "DROP TABLE " . contact_bank_contact_form();
186
- $wpdb->query($sql);
187
- create_table_contact_bank_forms();
188
-
189
- if(count($contact_forms) > 0)
190
  {
191
- for($flag = 0; $flag < count($contact_forms); $flag++)
 
 
 
 
 
 
 
 
192
  {
193
- $wpdb->query
194
- (
195
- $wpdb->prepare
196
  (
197
- "INSERT INTO " . contact_bank_contact_form() . "(form_id, form_name) VALUES(%d, %s)",
198
- $contact_forms[$flag]->form_id,
199
- $contact_forms[$flag]->form_name
200
- )
201
- );
202
- $wpdb->query
203
- (
204
- $wpdb->prepare
205
  (
206
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
207
- $contact_forms[$flag]->form_id,
208
- "redirect",
209
- $contact_forms[$flag]->chk_url
210
- )
211
- );
212
- $wpdb->query
213
- (
214
- $wpdb->prepare
215
  (
216
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
217
- $contact_forms[$flag]->form_id,
218
- "redirect_url",
219
- $contact_forms[$flag]->redirect_url
220
- )
221
- );
222
- $wpdb->query
223
- (
224
- $wpdb->prepare
225
  (
226
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
227
- $contact_forms[$flag]->form_id,
228
- "success_message",
229
- $contact_forms[$flag]->success_message
230
- )
231
- );
232
- $wpdb->query
233
- (
234
- $wpdb->prepare
235
  (
236
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
237
- $contact_forms[$flag]->form_id,
238
- "blank_field_message",
239
- "Required field must not be blank"
240
- )
241
- );
242
- $wpdb->query
243
- (
244
- $wpdb->prepare
245
  (
246
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
247
- $contact_forms[$flag]->form_id,
248
- "incorrect_email_message",
249
- "Please enter a valid email address"
250
- )
251
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  $wpdb->query
253
  (
254
  $wpdb->prepare
255
  (
256
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
257
- $contact_forms[$flag]->form_id,
258
- "form_description",
 
259
  ""
260
  )
261
  );
262
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  }
264
  }
265
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . create_control_Table() . '"')) == 0)
 
266
  {
267
- create_table_contact_bank_controls();
268
  }
269
  else
270
  {
271
- $contact_forms_controls = $wpdb->get_results
272
  (
273
- "SELECT * FROM ".create_control_Table()." where field_id not in (9,12,13,14,15)"
274
  );
275
- $sql = "DROP TABLE " . create_control_Table();
 
276
  $wpdb->query($sql);
277
 
278
- create_table_contact_bank_controls();
279
 
280
- if(count($contact_forms_controls) > 0)
281
  {
282
- for($flag = 0; $flag < count($contact_forms_controls); $flag++)
283
  {
284
  $wpdb->query
285
  (
286
  $wpdb->prepare
287
  (
288
- "INSERT INTO " . create_control_Table() . "(field_id,form_id,
289
- column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d)",
290
- $contact_forms_controls[$flag]->field_id,
291
- $contact_forms_controls[$flag]->form_id,
292
- $contact_forms_controls[$flag]->column_dynamicId,
293
- $contact_forms_controls[$flag]->sorting_order
 
 
 
 
 
 
 
 
 
294
  )
295
  );
296
  }
297
  }
 
298
  }
299
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_dynamic_settings_form() . '"')) == 0)
300
  {
301
- create_table_contact_bank_dynamic_settings();
302
  }
303
  else
304
  {
305
- $contact_forms_dynamic_settings = $wpdb->get_results
306
- (
307
- "SELECT * FROM ". contact_bank_dynamic_settings_form(). " JOIN " . create_control_Table(). " ON " . contact_bank_dynamic_settings_form().".dynamicId = ". create_control_Table(). ".column_dynamicId"
308
- );
309
- $contact_forms_email_dynamic_settings = $wpdb->get_results
310
  (
311
- $wpdb->prepare
312
- (
313
- "SELECT control_id,column_dynamicId FROM ".create_control_Table()." where field_id = 3 ",""
314
- )
315
  );
316
 
317
- $sql = "DROP TABLE " . contact_bank_dynamic_settings_form();
318
  $wpdb->query($sql);
319
 
320
- create_table_contact_bank_dynamic_settings();
321
 
322
- $column_dynamicId = Array();
323
- for($flag = 0; $flag < count($contact_forms_email_dynamic_settings);$flag++)
324
  {
325
- array_push($column_dynamicId,$contact_forms_email_dynamic_settings[$flag]->column_dynamicId);
326
  $wpdb->query
327
  (
328
  $wpdb->prepare
329
  (
330
- "INSERT INTO ". contact_bank_dynamic_settings_form() ."(dynamicId,dynamic_settings_key,
331
- dynamic_settings_value)VALUES(%d, %s, %s)",
332
- $contact_forms_email_dynamic_settings[$flag]->control_id,
333
- "cb_default_txt_val",
334
- ""
335
  )
336
  );
337
  }
338
 
339
- if(count($contact_forms_dynamic_settings) > 0)
 
 
 
 
 
340
  {
341
- $settings_keys = array();
342
- array_push($settings_keys, "");
343
- array_push($settings_keys, "cb_button_set_outer_label");
344
- array_push($settings_keys, "cb_button_set_description");
345
- array_push($settings_keys, "cb_button_set_options_outer_wrapper");
346
- array_push($settings_keys, "cb_button_set_options_wrapper");
347
- array_push($settings_keys, "cb_button_set_options_label");
348
- array_push($settings_keys, "cb_button_set_txt_input");
349
- array_push($settings_keys, "cb_date_day_dropdown");
350
- array_push($settings_keys, "cb_date_month_dropdown");
351
- array_push($settings_keys, "cb_date_year_dropdown");
352
- array_push($settings_keys, "cb_button_set_dropdown_menu");
353
- array_push($settings_keys, "cb_button_set_txt_description");
354
- array_push($settings_keys, "cb_uploaded_file_email_db");
355
- array_push($settings_keys, "cb_button_set_outer_label_file");
356
- array_push($settings_keys, "cb_button_set_outer_description_fileuplod");
357
- array_push($settings_keys, "cb_button_set_time_hour_dropdown");
358
- array_push($settings_keys, "cb_button_set_time_minute_dropdown");
359
- array_push($settings_keys, "cb_button_set_time_am_pm_dropdown");
360
- array_push($settings_keys, "cb_error_invalid");
361
 
362
- $settings_keys_email = array();
363
 
364
- array_push($settings_keys_email, "");
365
- array_push($settings_keys_email, "cb_checkbox_alpha_filter");
366
- array_push($settings_keys_email, "cb_ux_checkbox_alpha_num_filter");
367
- array_push($settings_keys_email, "cb_checkbox_digit_filter");
368
- array_push($settings_keys_email, "cb_checkbox_strip_tag_filter");
369
- array_push($settings_keys_email, "cb_checkbox_trim_filter");
370
- $settings_keys_multiple_options = array();
371
- array_push($settings_keys_multiple_options, "");
372
- array_push($settings_keys_multiple_options, "cb_dropdown_option_id");
373
- array_push($settings_keys_multiple_options, "cb_checkbox_option_id");
374
- array_push($settings_keys_multiple_options, "cb_radio_option_id");
375
- array_push($settings_keys_multiple_options, "cb_dropdown_option_val");
376
- array_push($settings_keys_multiple_options, "cb_checkbox_option_val");
377
- array_push($settings_keys_multiple_options, "cb_radio_option_val");
378
- for($flag = 0; $flag < count($contact_forms_dynamic_settings); $flag++)
379
  {
380
- $position_keys = array_search($contact_forms_dynamic_settings[$flag]->dynamic_settings_key,$settings_keys);
381
- $position_email_keys = array_search($contact_forms_dynamic_settings[$flag]->dynamic_settings_key,$settings_keys_email);
382
- if($position_keys == false && !($position_email_keys != false && in_array($contact_forms_dynamic_settings[$flag]->dynamicId,$column_dynamicId)))
383
- {
384
- $wpdb->query
385
  (
386
- $wpdb->prepare
387
- (
388
- "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,
389
- dynamic_settings_key,dynamic_settings_value) VALUES(%d, %s, %s)",
390
- $contact_forms_dynamic_settings[$flag]->control_id,
391
- $contact_forms_dynamic_settings[$flag]->dynamic_settings_key,
392
- array_search($contact_forms_dynamic_settings[$flag]->dynamic_settings_key,$settings_keys_multiple_options)
393
- ? serialize(explode(";",$contact_forms_dynamic_settings[$flag]->dynamic_settings_value)) : $contact_forms_dynamic_settings[$flag]->dynamic_settings_value
394
- )
395
- );
396
- }
397
  }
398
  }
399
- }
400
-
401
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_email_template_admin() . '"')) == 0)
402
- {
403
- create_table_contact_bank_email_templates();
404
- }
405
- else
406
- {
407
- $contact_forms_emails = $wpdb->get_results
408
- (
409
- "SELECT * FROM ".contact_bank_email_template_admin()
410
- );
411
-
412
- $sql = "DROP TABLE " . contact_bank_email_template_admin();
413
- $wpdb->query($sql);
414
-
415
- create_table_contact_bank_email_templates();
416
-
417
- if(count($contact_forms_emails) > 0)
418
  {
419
- for($flag = 0; $flag < count($contact_forms_emails); $flag++)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  {
 
 
 
 
 
421
  $wpdb->query
422
  (
423
  $wpdb->prepare
424
  (
425
- "INSERT INTO " . contact_bank_email_template_admin() . "(email_id, email_to, email_from,
426
- body_content, subject, send_to, form_id, from_name, reply_to, cc, bcc, name) VALUES(%d, %s,
427
- %s, %s, %s, %d, %d, %s, %s, %s, %s, %s)",
428
- $contact_forms_emails[$flag]->email_id,
429
- $contact_forms_emails[$flag]->email_to,
430
- $contact_forms_emails[$flag]->email_from,
431
- $contact_forms_emails[$flag]->body_content,
432
- $contact_forms_emails[$flag]->subject,
433
- isset($contact_forms_emails[$flag]->send_to) ? $contact_forms_emails[$flag]->send_to : "",
434
- $contact_forms_emails[$flag]->form_id,
435
- isset($contact_forms_emails[$flag]->from_name) ? $contact_forms_emails[$flag]->from_name : "",
436
- isset($contact_forms_emails[$flag]->reply_to) ? $contact_forms_emails[$flag]->reply_to : "",
437
- isset($contact_forms_emails[$flag]->cc) ? $contact_forms_emails[$flag]->cc : "",
438
- isset($contact_forms_emails[$flag]->bcc) ? $contact_forms_emails[$flag]->bcc : "",
439
- isset($contact_forms_emails[$flag]->name) ? $contact_forms_emails[$flag]->name : ""
440
  )
441
  );
442
  }
443
  }
444
-
445
- }
446
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_frontend_forms_Table() . '"')) == 0)
447
- {
448
- create_table_contact_bank_front_end_forms();
449
- }
450
- else
451
- {
452
- $contact_front_end_forms = $wpdb->get_results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  (
454
- "SELECT * FROM ".contact_bank_frontend_forms_Table()
 
 
 
 
 
455
  );
456
-
457
- $sql = "DROP TABLE " . contact_bank_frontend_forms_Table();
458
- $wpdb->query($sql);
459
-
460
- create_table_contact_bank_front_end_forms();
461
-
462
- for($flag = 0; $flag < count($contact_front_end_forms);$flag++)
463
- {
464
- $wpdb->query
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  (
 
 
 
 
 
 
 
 
466
  $wpdb->prepare
467
  (
468
- "INSERT INTO ". contact_bank_frontend_forms_Table() ."(form_id,submit_id)VALUES(%d, %d)",
469
- $contact_front_end_forms[$flag]->form_id,
470
- $contact_front_end_forms[$flag]->submit_id
 
471
  )
472
- );
473
- }
474
-
475
- }
476
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . frontend_controls_data_Table() . '"')) == 0)
477
- {
478
- create_table_front_end_data();
479
- }
480
- else
481
- {
482
- $contact_front_end_forms_data = $wpdb->get_results
483
  (
484
- "SELECT * FROM ".frontend_controls_data_Table() . " JOIN " . create_control_Table(). " ON " . frontend_controls_data_Table().".dynamic_control_id = ". create_control_Table(). ".column_dynamicId"
 
 
 
 
 
 
485
  );
486
-
487
- $sql = "DROP TABLE " . frontend_controls_data_Table();
488
- $wpdb->query($sql);
489
-
490
- create_table_front_end_data();
491
-
492
- for($flag = 0; $flag < count($contact_front_end_forms_data);$flag++)
493
- {
494
- $wpdb->query
495
- (
496
  $wpdb->prepare
497
  (
498
- "INSERT INTO ". frontend_controls_data_Table() ."(form_id,field_Id,dynamic_control_id,
499
- dynamic_frontend_value,form_submit_id)VALUES(%d, %d, %d, %s, %d)",
500
- $contact_front_end_forms_data[$flag]->form_id,
501
- $contact_front_end_forms_data[$flag]->field_Id,
502
- $contact_front_end_forms_data[$flag]->control_id,
503
- $contact_front_end_forms_data[$flag]->dynamic_frontend_value,
504
- $contact_front_end_forms_data[$flag]->form_submit_id
505
  )
506
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  }
508
- }
509
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_layout_settings_Table() . '"')) == 0)
510
- {
511
- create_contact_bank_layout_settings();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  $settings = array();
513
  $settings["label_setting_font_family"] = "inherit";
514
  $settings["label_setting_font_color"] = "#000000";
@@ -567,7 +959,7 @@ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_layout_settings_Tab
567
 
568
  $contact_forms_for_settings = $wpdb->get_results
569
  (
570
- "SELECT * FROM ".contact_bank_contact_form()
571
  );
572
  for($flag = 0; $flag < count($contact_forms_for_settings); $flag++)
573
  {
@@ -578,594 +970,216 @@ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_layout_settings_Tab
578
  }
579
  $wpdb->query
580
  (
581
- $wpdb->prepare
582
- (
583
- "INSERT INTO " . contact_bank_layout_settings_Table() . "(form_id,form_settings_key,form_settings_value) VALUES ".implode(',', $sql),""
584
- )
585
  );
586
  }
587
- }
588
- if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_licensing() . "'")) == 0)
589
- {
590
- create_cb_table_licensing();
591
- }
592
- if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_roles_capability() . "'")) == 0)
593
- {
594
- create_table_roles_capability();
595
- $settings_roles = array();
596
- $settings_roles["admin_full_control"] = "1";
597
- $settings_roles["admin_read_control"] = "0";
598
- $settings_roles["admin_write_control"] = "0";
599
- $settings_roles["editor_full_control"] = "0";
600
- $settings_roles["editor_read_control"] = "1";
601
- $settings_roles["editor_write_control"] = "0";
602
- $settings_roles["author_full_control"] = "0";
603
- $settings_roles["author_read_control"] = "1";
604
- $settings_roles["author_write_control"] = "0";
605
- $settings_roles["contributor_full_control"] = "0";
606
- $settings_roles["contributor_read_control"] = "1";
607
- $settings_roles["contributor_write_control"] = "0";
608
- $settings_roles["subscriber_full_control"] = "0";
609
- $settings_roles["subscriber_read_control"] = "1";
610
- $settings_roles["subscriber_write_control"] = "0";
611
- foreach($settings_roles as $key => $value)
612
  {
613
- $sql1[] = '("'.$key.'", "'.$value.'")';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  }
 
 
 
 
 
 
 
 
 
 
 
 
615
  $wpdb->query
616
  (
617
- "INSERT INTO " . contact_bank_roles_capability() . "(roles_capability_key,roles_capability_value) VALUES ".implode(',', $sql1),""
618
- );
619
- }
620
- $wpdb->query
621
- (
622
- $wpdb->prepare
623
- (
624
- "INSERT INTO " . contact_bank_contact_form() . "(form_id, form_name) VALUES(%d, %s)",
625
- 1,
626
- "Contact Form Demo"
627
- )
628
- );
629
- $wpdb->query
630
- (
631
- $wpdb->prepare
632
- (
633
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
634
- 1,
635
- "redirect",
636
- "0"
637
- )
638
- );
639
- $wpdb->query
640
- (
641
- $wpdb->prepare
642
- (
643
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
644
- 1,
645
- "redirect_url",
646
- ""
647
- )
648
- );
649
- $wpdb->query
650
- (
651
- $wpdb->prepare
652
- (
653
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
654
- 1,
655
- "success_message",
656
- "Your message was sent successfully. Thanks."
657
- )
658
- );
659
- $wpdb->query
660
- (
661
- $wpdb->prepare
662
- (
663
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
664
- 1,
665
- "blank_field_message",
666
- "Required field must not be blank"
667
- )
668
- );
669
- $wpdb->query
670
- (
671
- $wpdb->prepare
672
- (
673
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
674
- 1,
675
- "incorrect_email_message",
676
- "Please enter a valid email address"
677
- )
678
- );
679
- $wpdb->query
680
- (
681
- $wpdb->prepare
682
- (
683
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
684
- 1,
685
- "form_description",
686
- ""
687
- )
688
- );
689
-
690
- $wpdb->query
691
- (
692
- $wpdb->prepare
693
- (
694
- "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
695
- column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
696
- 1,
697
- 1,
698
- 1,
699
  1,
700
- 1
701
- )
702
- );
703
-
704
-
705
- $dynamic_Id = 1;
706
- $form_id = 1;
707
- $form_settings = array();
708
- $form_settings["dynamic_id"] = $dynamic_Id;
709
- $form_settings["control_type"] = "1";
710
- $form_settings["cb_label_value"] = "Your Name";
711
- $form_settings["cb_description"] = "";
712
- $form_settings["cb_control_required"] = "1";
713
- $form_settings["cb_tooltip_txt"] = "";
714
- $form_settings["cb_default_txt_val"] = "Your Name";
715
- $form_settings["cb_admin_label"] = "Your Name";
716
- $form_settings["cb_show_email"] = "0";
717
- $form_settings["cb_checkbox_alpha_filter"] = "0";
718
- $form_settings["cb_ux_checkbox_alpha_num_filter"] = "0";
719
- $form_settings["cb_checkbox_digit_filter"] = "0";
720
- $form_settings["cb_checkbox_strip_tag_filter"] = "0";
721
- $form_settings["cb_checkbox_trim_filter"] = "0";
722
-
723
-
724
- foreach($form_settings as $key => $value)
725
- {
726
- if($key == "dynamic_id" || $key == "control_type")
727
- {
728
- continue;
729
- }
730
- else
731
- {
732
- $sql_name[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
733
-
734
- }
735
- }
736
- $wpdb->query
737
- (
738
- "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_name),""
739
- );
740
-
741
 
742
- $wpdb->query
743
- (
744
- $wpdb->prepare
 
 
 
 
 
 
745
  (
746
- "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
747
- column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
748
- 2,
749
- 3,
750
- 1,
751
- 2,
752
- 2
753
- )
754
- );
755
-
756
- $dynamic_Id = 2;
757
- $form_id = 1;
758
- $form_settings = array();
759
- $form_settings["dynamic_id"] = $dynamic_Id;
760
- $form_settings["control_type"] = "1";
761
- $form_settings["cb_label_value"] = "Your Email";
762
- $form_settings["cb_description"] = "";
763
- $form_settings["cb_control_required"] = "1";
764
- $form_settings["cb_tooltip_txt"] = "";
765
- $form_settings["cb_default_txt_val"] = "Your Email";
766
- $form_settings["cb_admin_label"] = "Your Email";
767
- $form_settings["cb_show_email"] = "0";
768
-
769
-
770
- foreach($form_settings as $key => $value)
771
- {
772
- if($key == "dynamic_id" || $key == "control_type")
773
- {
774
- continue;
775
- }
776
- else
777
- {
778
- $sql_email[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
779
-
780
- }
781
- }
782
- $wpdb->query
783
- (
784
- "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_email),""
785
- );
786
-
787
-
788
- $wpdb->query
789
- (
790
- $wpdb->prepare
791
- (
792
- "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
793
- column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
794
- 3,
795
- 1,
796
- 1,
797
- 3,
798
- 3
799
- )
800
- );
801
-
802
- $dynamic_Id = 3;
803
- $form_id = 1;
804
- $form_settings = array();
805
- $form_settings["dynamic_id"] = $dynamic_Id;
806
- $form_settings["control_type"] = "1";
807
- $form_settings["cb_label_value"] = "Subject";
808
- $form_settings["cb_description"] = "";
809
- $form_settings["cb_control_required"] = "0";
810
- $form_settings["cb_tooltip_txt"] = "";
811
- $form_settings["cb_default_txt_val"] = "Subject";
812
- $form_settings["cb_admin_label"] = "Subject";
813
- $form_settings["cb_show_email"] = "0";
814
- $form_settings["cb_checkbox_alpha_filter"] = "0";
815
- $form_settings["cb_ux_checkbox_alpha_num_filter"] = "0";
816
- $form_settings["cb_checkbox_digit_filter"] = "0";
817
- $form_settings["cb_checkbox_strip_tag_filter"] = "0";
818
- $form_settings["cb_checkbox_trim_filter"] = "0";
819
-
820
-
821
- foreach($form_settings as $key => $value)
822
- {
823
- if($key == "dynamic_id" || $key == "control_type")
824
- {
825
- continue;
826
- }
827
- else
828
- {
829
- $sql_subject[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
830
-
831
- }
832
- }
833
- $wpdb->query
834
- (
835
- "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_subject),""
836
- );
837
-
838
-
839
-
840
- $wpdb->query
841
- (
842
- $wpdb->prepare
843
- (
844
- "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
845
- column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
846
- 4,
847
- 2,
848
- 1,
849
- 4,
850
- 4
851
- )
852
- );
853
-
854
-
855
- $dynamic_Id = 4;
856
- $form_id = 1;
857
- $form_settings = array();
858
- $form_settings["dynamic_id"] = $dynamic_Id;
859
- $form_settings["control_type"] = "2";
860
- $form_settings["cb_label_value"] = "Your Message";
861
- $form_settings["cb_description"] = "";
862
- $form_settings["cb_control_required"] = "0";
863
- $form_settings["cb_tooltip_txt"] = "";
864
- $form_settings["cb_default_txt_val"] = "Your Message";
865
- $form_settings["cb_admin_label"] = "Your Message";
866
- $form_settings["cb_show_email"] = "0";
867
- $form_settings["cb_checkbox_alpha_filter"] = "0";
868
- $form_settings["cb_ux_checkbox_alpha_num_filter"] = "0";
869
- $form_settings["cb_checkbox_digit_filter"] = "0";
870
- $form_settings["cb_checkbox_strip_tag_filter"] = "0";
871
- $form_settings["cb_checkbox_trim_filter"] = "0";
872
-
873
-
874
- foreach($form_settings as $key => $value)
875
- {
876
- if($key == "dynamic_id" || $key == "control_type")
877
- {
878
- continue;
879
- }
880
- else
881
- {
882
- $sql_message[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
883
-
884
- }
885
- }
886
- $wpdb->query
887
- (
888
- "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_message),""
889
- );
890
-
891
- $settings = array();
892
- $settings["label_setting_font_family"] = "inherit";
893
- $settings["label_setting_font_color"] = "#000000";
894
- $settings["label_setting_font_style"] = "normal";
895
- $settings["label_setting_font_size"] = "16";
896
- $settings["label_setting_font_align_left"] = "0";
897
- $settings["label_setting_label_position"] = "top";
898
- $settings["label_setting_field_size"] = "11";
899
- $settings["label_setting_field_align"] = "left";
900
- $settings["label_setting_hide_label"] = "0";
901
- $settings["label_setting_text_direction"] = "inherit";
902
-
903
- $settings["input_field_font_family"] = "inherit";
904
- $settings["input_field_font_color"] = "#000000";
905
- $settings["input_field_font_style"] = "normal";
906
- $settings["input_field_font_size"] = "14";
907
- $settings["input_field_border_radius"] = "0";
908
- $settings["input_field_border_color"] = "#e5e5e5";
909
- $settings["input_field_border_size"] = "1";
910
- $settings["input_field_border_style"] = "solid";
911
- $settings["input_field_clr_bg_color"] = "#ffffff";
912
- $settings["input_field_rdl_multiple_row"] = "1";
913
- $settings["input_field_rdl_text_align"] = "0";
914
- $settings["input_field_text_direction"] = "inherit";
915
- $settings["input_field_input_size"] = "layout-span10";
916
-
917
- $settings["submit_button_font_family"] = "inherit";
918
- $settings["submit_button_text"] = "Submit";
919
- $settings["submit_button_font_style"] = "normal";
920
- $settings["submit_button_font_size"] = "12";
921
- $settings["submit_button_button_width"] = "100";
922
- $settings["submit_button_bg_color"] = "#24890d";
923
- $settings["submit_button_hover_bg_color"] = "#3dd41a";
924
- $settings["submit_button_text_color"] = "#ffffff";
925
- $settings["submit_button_border_color"] = "#000000";
926
- $settings["submit_button_border_size"] = "0";
927
- $settings["submit_button_border_radius"] = "0";
928
- $settings["submit_button_rdl_text_align"] = "0";
929
- $settings["submit_button_text_direction"] = "inherit";
930
-
931
- $settings["success_msg_font_family"] = "inherit";
932
- $settings["success_msg_font_size"] = "12";
933
- $settings["success_msg_bg_color"] = "#e5ffd5";
934
- $settings["success_msg_border_color"] = "#e5ffd5";
935
- $settings["success_msg_text_color"] = "#6aa500";
936
- $settings["success_msg_rdl_text_align"] = "0";
937
- $settings["success_msg_text_direction"] = "inherit";
938
-
939
- $settings["error_msg_font_family"] = "inherit";
940
- $settings["error_msg_font_size"] = "12";
941
- $settings["error_msg_bg_color"] = "#ffcaca";
942
- $settings["error_msg_border_color"] = "#ffcaca";
943
- $settings["error_msg_text_color"] = "#ff2c38";
944
- $settings["error_msg_rdl_text_align"] = "0";
945
- $settings["error_msg_text_direction"] = "inherit";
946
-
947
- $contact_forms_for_settings = $wpdb->get_results
948
- (
949
- "SELECT * FROM ".contact_bank_contact_form()
950
- );
951
- for($flag = 0; $flag < count($contact_forms_for_settings); $flag++)
952
- {
953
- $sql = "";
954
- foreach($settings as $key => $value)
955
- {
956
- $sql[] = '('.$contact_forms_for_settings[$flag]->form_id.',"'.$key.'", "'.$value.'")';
957
- }
958
- $wpdb->query
959
- (
960
- "INSERT INTO " . contact_bank_layout_settings_Table() . "(form_id,form_settings_key,form_settings_value) VALUES ".implode(',', $sql),""
961
- );
962
- }
963
- $fields_created = $wpdb->get_results
964
- (
965
  $wpdb->prepare
966
  (
967
- "SELECT dynamicId, dynamic_settings_value,field_id FROM ". contact_bank_dynamic_settings_form(). " JOIN " . create_control_Table(). " ON " . contact_bank_dynamic_settings_form().". dynamicId = ". create_control_Table(). ".control_id WHERE `dynamic_settings_key` = 'cb_admin_label' and form_id = %d Order By ".create_control_Table().".sorting_order",
968
- 1
 
 
 
 
 
 
 
969
  )
970
- );
971
- $controls = "";
972
- $email_dynamicId = "";
973
- for($flag=0;$flag<count($fields_created);$flag++)
974
- {
975
- $show_in_email = $wpdb->get_var
976
- (
977
- $wpdb->prepare
978
- (
979
- "SELECT dynamic_settings_value FROM ". contact_bank_dynamic_settings_form(). " WHERE `dynamic_settings_key` = 'cb_show_email' and dynamicId = %d",
980
- $fields_created[$flag]->dynamicId
981
- )
982
  );
983
- if($show_in_email == "0")
 
 
 
 
984
  {
985
- $controls .= "<strong>".$fields_created[$flag]->dynamic_settings_value ."</strong>: ". "[control_".$fields_created[$flag]->dynamicId."] <br>";
986
  }
987
- if($fields_created[$flag]->field_id == 3)
988
  {
989
- $email_dynamicId = $fields_created[$flag]->dynamicId;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
990
  }
991
- }
992
- $email_name = "Admin Notification";
993
- $send_to = get_option('admin_email');
994
- $email_address = get_option('admin_email');
995
- $email_from_name = "Site Administration";
996
- $email_from_email = get_option('admin_email');
997
- $email_subject = "New Contact recieved from Website";
998
- $uxDescription_email = "Hello Admin,<br><br>
999
- A new user has visited your website.<br><br>
1000
- Here are the details :<br><br>
1001
- ".$controls."
1002
- <br>Thanks,<br><br>
1003
- <strong>Technical Support Team</strong>";
1004
- $wpdb->query
1005
- (
1006
- $wpdb->prepare
1007
- (
1008
- "INSERT INTO " . contact_bank_email_template_admin(). " (email_to,email_from,body_content,subject,form_id,from_name,name,send_to) VALUES(%s,%s,%s,%s,%d,%s,%s,%d)",
1009
- $email_address,
1010
- $email_from_email,
1011
- $uxDescription_email,
1012
- $email_subject,
1013
- 1,
1014
- $email_from_name,
1015
- $email_name,
1016
- $send_to
1017
- )
1018
- );
1019
-
1020
- $email_name_client = "Client Notification";
1021
- $email_subject_client = "Thanks for visiting our website";
1022
- $email_from_name = "Site Administration";
1023
- $email_from_email = get_option('admin_email');
1024
- $uxDescription_email_client = "Hi,<br><br>
1025
- Thanks for visiting our website. We will Contact you within next 24 hours.<br><br>
1026
- <br>Thanks,<br><br>
1027
- <strong>Support Team</strong>";
1028
- $wpdb->query
1029
- (
1030
- $wpdb->prepare
1031
- (
1032
- "INSERT INTO " . contact_bank_email_template_admin(). " (email_to,email_from,body_content,subject,form_id,from_name,name,send_to) VALUES(%s,%s,%s,%s,%d,%s,%s,%d)",
1033
- "",
1034
- $email_from_email,
1035
- $uxDescription_email_client,
1036
- $email_subject_client,
1037
- 1,
1038
- $email_from_name,
1039
- $email_name_client,
1040
- ""
1041
- )
1042
- );
1043
-
1044
- }
1045
- else if($version == "2.0")
1046
- {
1047
- if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_licensing() . "'")) == 0)
1048
- {
1049
- create_cb_table_licensing();
1050
- }
1051
- if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_roles_capability() . "'")) == 0)
1052
- {
1053
- create_table_roles_capability();
1054
- $settings_roles = array();
1055
- $settings_roles["admin_full_control"] = "1";
1056
- $settings_roles["admin_read_control"] = "0";
1057
- $settings_roles["admin_write_control"] = "0";
1058
- $settings_roles["editor_full_control"] = "0";
1059
- $settings_roles["editor_read_control"] = "1";
1060
- $settings_roles["editor_write_control"] = "0";
1061
- $settings_roles["author_full_control"] = "0";
1062
- $settings_roles["author_read_control"] = "1";
1063
- $settings_roles["author_write_control"] = "0";
1064
- $settings_roles["contributor_full_control"] = "0";
1065
- $settings_roles["contributor_read_control"] = "1";
1066
- $settings_roles["contributor_write_control"] = "0";
1067
- $settings_roles["subscriber_full_control"] = "0";
1068
- $settings_roles["subscriber_read_control"] = "1";
1069
- $settings_roles["subscriber_write_control"] = "0";
1070
- foreach($settings_roles as $key => $value)
1071
  {
1072
- $sql1[] = '("'.$key.'", "'.$value.'")';
1073
  }
1074
- $wpdb->query
1075
- (
1076
- "INSERT INTO " . contact_bank_roles_capability() . "(roles_capability_key,roles_capability_value) VALUES ".implode(',', $sql1),""
1077
- );
1078
- }
1079
- if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_form_settings_Table() . '"')) == 0)
1080
- {
1081
- create_contact_bank_form_settings();
1082
- }
1083
- else
1084
- {
1085
- $contact_forms_settings_table = $wpdb->get_results
1086
- (
1087
- "SELECT * FROM ".contact_bank_form_settings_Table()
1088
- );
1089
 
1090
- $sql = "DROP TABLE " . contact_bank_form_settings_Table();
1091
- $wpdb->query($sql);
1092
- $contact_forms_count = $wpdb->get_results
1093
- (
1094
- "SELECT * FROM ".contact_bank_contact_form()
1095
- );
1096
 
1097
- create_contact_bank_form_settings();
1098
 
1099
- if(count($contact_forms_settings_table) > 0)
1100
- {
1101
- for($flag = 0; $flag < count($contact_forms_settings_table); $flag++)
1102
  {
1103
- $wpdb->query
1104
- (
1105
- $wpdb->prepare
1106
  (
1107
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
1108
- $contact_forms_settings_table[$flag]->form_id,
1109
- $contact_forms_settings_table[$flag]->form_message_key,
1110
- $contact_forms_settings_table[$flag]->form_message_value
1111
- )
1112
- );
1113
- }
1114
- for($flag = 0; $flag < count($contact_forms_count); $flag++)
1115
- {
1116
- $wpdb->query
1117
- (
1118
- $wpdb->prepare
1119
  (
1120
- "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
1121
- $contact_forms_count[$flag]->form_id,
1122
- "form_description",
1123
- ""
1124
- )
1125
- );
 
 
 
1126
  }
1127
  }
1128
  }
1129
- }
1130
- else if($version == "2.1")
1131
- {
1132
- if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_licensing() . "'")) == 0)
1133
  {
1134
- create_cb_table_licensing();
1135
- }
1136
- if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_roles_capability() . "'")) == 0)
1137
- {
1138
- create_table_roles_capability();
1139
- $settings_roles = array();
1140
- $settings_roles["admin_full_control"] = "1";
1141
- $settings_roles["admin_read_control"] = "0";
1142
- $settings_roles["admin_write_control"] = "0";
1143
- $settings_roles["editor_full_control"] = "0";
1144
- $settings_roles["editor_read_control"] = "1";
1145
- $settings_roles["editor_write_control"] = "0";
1146
- $settings_roles["author_full_control"] = "0";
1147
- $settings_roles["author_read_control"] = "1";
1148
- $settings_roles["author_write_control"] = "0";
1149
- $settings_roles["contributor_full_control"] = "0";
1150
- $settings_roles["contributor_read_control"] = "1";
1151
- $settings_roles["contributor_write_control"] = "0";
1152
- $settings_roles["subscriber_full_control"] = "0";
1153
- $settings_roles["subscriber_read_control"] = "1";
1154
- $settings_roles["subscriber_write_control"] = "0";
1155
- foreach($settings_roles as $key => $value)
1156
  {
1157
- $sql1[] = '("'.$key.'", "'.$value.'")';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1158
  }
1159
- $wpdb->query
1160
- (
1161
- "INSERT INTO " . contact_bank_roles_capability() . "(roles_capability_key,roles_capability_value) VALUES ".implode(',', $sql1),""
1162
- );
1163
  }
1164
- }
1165
- update_option("contact-bank-version-number","2.1");
1166
- $option_auto_update_contact = get_option("contact-bank-automatic_update");
1167
- if($option_auto_update_contact == "")
1168
- {
1169
- update_option("contact-bank-automatic_update", "1");
1170
  }
1171
  ?>
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
4
  {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
 
14
  }
15
+ if (!current_user_can($cb_user_role_permission))
16
  {
17
+ return;
 
 
 
 
 
 
 
 
 
 
18
  }
19
+ else
20
  {
21
+ if(!function_exists("create_table_contact_bank_forms"))
22
  {
23
+ function create_table_contact_bank_forms()
24
+ {
25
+ $sql = 'CREATE TABLE ' . contact_bank_contact_form() . '(
26
+ form_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
27
+ form_name VARCHAR(200) NOT NULL,
28
+ PRIMARY KEY (form_id)
29
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
30
+ dbDelta($sql);
 
 
 
31
 
32
+ }
33
+ }
34
+ if(!function_exists("create_table_contact_bank_dynamic_settings"))
35
  {
36
+ function create_table_contact_bank_dynamic_settings()
37
+ {
38
+ $sql = 'CREATE TABLE ' . contact_bank_dynamic_settings_form() . '(
39
+ dynamic_settings_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
40
+ dynamicId INTEGER(10) NOT NULL,
41
+ dynamic_settings_key VARCHAR(100) NOT NULL,
42
+ dynamic_settings_value TEXT NOT NULL,
43
+ PRIMARY KEY (dynamic_settings_id)
44
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
45
+ dbDelta($sql);
46
+ }
47
  }
48
+ if(!function_exists("create_table_contact_bank_controls"))
 
 
 
49
  {
50
+ function create_table_contact_bank_controls()
51
+ {
52
+ $sql = 'CREATE TABLE '.create_control_Table(). '(
53
+ control_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
54
+ field_id INTEGER(50) NOT NULL,
55
+ form_id INTEGER(10) NOT NULL,
56
+ column_dynamicId INTEGER(10) NOT NULL,
57
+ sorting_order INTEGER(10) NOT NULL,
58
+ PRIMARY KEY(control_id)
59
+ )ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
60
+ dbDelta($sql);
61
+ }
 
 
 
 
62
  }
63
+
64
+ if(!function_exists("create_table_front_end_data"))
 
 
65
  {
66
+ function create_table_front_end_data()
67
+ {
68
+ $sql = 'CREATE TABLE ' . frontend_controls_data_Table() . '(
69
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
70
+ form_id INTEGER(10) NOT NULL,
71
+ field_Id INTEGER(10) NOT NULL,
72
+ dynamic_control_id INTEGER(10) NOT NULL,
73
+ dynamic_frontend_value TEXT NOT NULL,
74
+ form_submit_id INTEGER(10) NOT NULL,
75
+ PRIMARY KEY (id)
76
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
77
+ dbDelta($sql);
78
+ }
79
  }
80
+ if(!function_exists("create_table_contact_bank_email_templates"))
 
 
 
81
  {
82
+ function create_table_contact_bank_email_templates()
83
+ {
84
+ $sql = 'CREATE TABLE ' . contact_bank_email_template_admin() . '(
85
+ email_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
86
+ email_to VARCHAR(100) NOT NULL,
87
+ email_from VARCHAR(100) NOT NULL,
88
+ body_content TEXT NOT NULL,
89
+ subject VARCHAR(400) NOT NULL,
90
+ send_to INTEGER(1) NOT NULL,
91
+ form_id INTEGER(10) NOT NULL,
92
+ from_name VARCHAR(200) NOT NULL,
93
+ reply_to VARCHAR(200) NOT NULL,
94
+ cc VARCHAR(200) NOT NULL,
95
+ bcc VARCHAR(200) NOT NULL,
96
+ name VARCHAR(100) NOT NULL,
97
+ PRIMARY KEY (email_id)
98
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
99
+ dbDelta($sql);
100
+ }
101
  }
102
+ if(!function_exists("create_table_contact_bank_front_end_forms"))
 
 
 
103
  {
104
+ function create_table_contact_bank_front_end_forms()
105
+ {
106
+ $sql = 'CREATE TABLE ' . contact_bank_frontend_forms_Table() . '(
107
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
108
+ form_id INTEGER(10) NOT NULL,
109
+ submit_id INTEGER(10) NOT NULL,
110
+ PRIMARY KEY (id)
111
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
112
+ dbDelta($sql);
113
+ }
114
  }
115
+ if(!function_exists("create_contact_bank_layout_settings"))
 
 
 
116
  {
117
+ function create_contact_bank_layout_settings()
118
+ {
119
+ $sql = 'CREATE TABLE ' . contact_bank_layout_settings_Table() . '(
120
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
121
+ form_id INTEGER(10) NOT NULL,
122
+ form_settings_key VARCHAR(200) NOT NULL,
123
+ form_settings_value VARCHAR(200) NOT NULL,
124
+ PRIMARY KEY (id)
125
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
126
+ dbDelta($sql);
127
+ }
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
+ if(!function_exists("create_contact_bank_form_settings"))
 
 
 
130
  {
131
+ function create_contact_bank_form_settings()
132
+ {
133
+ $sql = 'CREATE TABLE ' . contact_bank_form_settings_Table() . '(
134
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
135
+ form_id INTEGER(10) NOT NULL,
136
+ form_message_key VARCHAR(200) NOT NULL,
137
+ form_message_value TEXT NOT NULL,
138
+ PRIMARY KEY (id)
139
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
140
+ dbDelta($sql);
141
+ }
142
  }
143
+ if(!function_exists("create_cb_table_licensing"))
 
 
 
 
 
 
 
144
  {
145
+ function create_cb_table_licensing()
146
+ {
147
+ global $wpdb;
148
+ $sql = "CREATE TABLE " . contact_bank_licensing() . "(
149
+ licensing_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
150
+ version VARCHAR(10) NOT NULL,
151
+ type VARCHAR(100) NOT NULL,
152
+ url TEXT NOT NULL,
153
+ api_key TEXT NOT NULL,
154
+ order_id VARCHAR(100) NOT NULL,
155
+ PRIMARY KEY (licensing_id)
156
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci";
157
+ dbDelta($sql);
158
+
159
+ $wpdb->query
160
+ (
161
+ $wpdb->prepare
162
+ (
163
+ "INSERT INTO " . contact_bank_licensing() . "(version, type, url) VALUES(%s, %s, %s)",
164
+ "2.1.0",
165
+ "Contact Bank",
166
+ "" . site_url() . ""
167
+ )
168
+ );
169
+ }
170
  }
171
+ if(!function_exists("create_table_roles_capability"))
172
  {
173
+ function create_table_roles_capability()
174
+ {
175
+ $sql = 'CREATE TABLE ' . contact_bank_roles_capability() . '(
176
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
177
+ roles_capability_key VARCHAR(200) NOT NULL,
178
+ roles_capability_value VARCHAR(200) NOT NULL,
179
+ PRIMARY KEY (id)
180
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci';
181
+ dbDelta($sql);
182
+ }
183
  }
184
+ global $wpdb;
185
+ require_once(ABSPATH . "wp-admin/includes/upgrade.php");
186
+ update_option("contact-bank-updation-check-url","http://tech-banker.com/wp-admin/admin-ajax.php");
187
+ $version = get_option("contact-bank-version-number");
188
+ if($version == "" || $version == "1.0")
189
  {
190
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_form_settings_Table() . '"')) == 0)
191
+ {
192
+ create_contact_bank_form_settings();
193
+ }
194
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_contact_form() . '"')) == 0)
195
+ {
196
+ create_table_contact_bank_forms();
197
+ }
198
+ else
199
  {
200
+ $contact_forms = $wpdb->get_results
201
+ (
202
+ "SELECT * FROM ".contact_bank_contact_form()
203
+ );
204
+ $sql = "DROP TABLE " . contact_bank_contact_form();
205
+ $wpdb->query($sql);
206
+ create_table_contact_bank_forms();
207
+
208
+ if(count($contact_forms) > 0)
209
  {
210
+ for($flag = 0; $flag < count($contact_forms); $flag++)
211
+ {
212
+ $wpdb->query
213
  (
214
+ $wpdb->prepare
215
+ (
216
+ "INSERT INTO " . contact_bank_contact_form() . "(form_id, form_name) VALUES(%d, %s)",
217
+ $contact_forms[$flag]->form_id,
218
+ $contact_forms[$flag]->form_name
219
+ )
220
+ );
221
+ $wpdb->query
222
  (
223
+ $wpdb->prepare
224
+ (
225
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
226
+ $contact_forms[$flag]->form_id,
227
+ "redirect",
228
+ $contact_forms[$flag]->chk_url
229
+ )
230
+ );
231
+ $wpdb->query
232
  (
233
+ $wpdb->prepare
234
+ (
235
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
236
+ $contact_forms[$flag]->form_id,
237
+ "redirect_url",
238
+ $contact_forms[$flag]->redirect_url
239
+ )
240
+ );
241
+ $wpdb->query
242
  (
243
+ $wpdb->prepare
244
+ (
245
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
246
+ $contact_forms[$flag]->form_id,
247
+ "success_message",
248
+ $contact_forms[$flag]->success_message
249
+ )
250
+ );
251
+ $wpdb->query
252
  (
253
+ $wpdb->prepare
254
+ (
255
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
256
+ $contact_forms[$flag]->form_id,
257
+ "blank_field_message",
258
+ "Required field must not be blank"
259
+ )
260
+ );
261
+ $wpdb->query
262
  (
263
+ $wpdb->prepare
264
+ (
265
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
266
+ $contact_forms[$flag]->form_id,
267
+ "incorrect_email_message",
268
+ "Please enter a valid email address"
269
+ )
270
+ );
271
+ $wpdb->query
272
+ (
273
+ $wpdb->prepare
274
+ (
275
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
276
+ $contact_forms[$flag]->form_id,
277
+ "form_description",
278
+ ""
279
+ )
280
+ );
281
+ }
282
+ }
283
+ }
284
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . create_control_Table() . '"')) == 0)
285
+ {
286
+ create_table_contact_bank_controls();
287
+ }
288
+ else
289
+ {
290
+ $contact_forms_controls = $wpdb->get_results
291
+ (
292
+ "SELECT * FROM ".create_control_Table()." where field_id not in (9,12,13,14,15)"
293
+ );
294
+ $sql = "DROP TABLE " . create_control_Table();
295
+ $wpdb->query($sql);
296
+
297
+ create_table_contact_bank_controls();
298
+
299
+ if(count($contact_forms_controls) > 0)
300
+ {
301
+ for($flag = 0; $flag < count($contact_forms_controls); $flag++)
302
+ {
303
+ $wpdb->query
304
+ (
305
+ $wpdb->prepare
306
+ (
307
+ "INSERT INTO " . create_control_Table() . "(field_id,form_id,
308
+ column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d)",
309
+ $contact_forms_controls[$flag]->field_id,
310
+ $contact_forms_controls[$flag]->form_id,
311
+ $contact_forms_controls[$flag]->column_dynamicId,
312
+ $contact_forms_controls[$flag]->sorting_order
313
+ )
314
+ );
315
+ }
316
+ }
317
+ }
318
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_dynamic_settings_form() . '"')) == 0)
319
+ {
320
+ create_table_contact_bank_dynamic_settings();
321
+ }
322
+ else
323
+ {
324
+ $contact_forms_dynamic_settings = $wpdb->get_results
325
+ (
326
+ "SELECT * FROM ". contact_bank_dynamic_settings_form(). " JOIN " . create_control_Table(). " ON " . contact_bank_dynamic_settings_form().".dynamicId = ". create_control_Table(). ".column_dynamicId"
327
+ );
328
+ $contact_forms_email_dynamic_settings = $wpdb->get_results
329
+ (
330
+ $wpdb->prepare
331
+ (
332
+ "SELECT control_id,column_dynamicId FROM ".create_control_Table()." where field_id = 3 ",""
333
+ )
334
+ );
335
+
336
+ $sql = "DROP TABLE " . contact_bank_dynamic_settings_form();
337
+ $wpdb->query($sql);
338
+
339
+ create_table_contact_bank_dynamic_settings();
340
+
341
+ $column_dynamicId = Array();
342
+ for($flag = 0; $flag < count($contact_forms_email_dynamic_settings);$flag++)
343
+ {
344
+ array_push($column_dynamicId,$contact_forms_email_dynamic_settings[$flag]->column_dynamicId);
345
  $wpdb->query
346
  (
347
  $wpdb->prepare
348
  (
349
+ "INSERT INTO ". contact_bank_dynamic_settings_form() ."(dynamicId,dynamic_settings_key,
350
+ dynamic_settings_value)VALUES(%d, %s, %s)",
351
+ $contact_forms_email_dynamic_settings[$flag]->control_id,
352
+ "cb_default_txt_val",
353
  ""
354
  )
355
  );
356
  }
357
+
358
+ if(count($contact_forms_dynamic_settings) > 0)
359
+ {
360
+ $settings_keys = array();
361
+ array_push($settings_keys, "");
362
+ array_push($settings_keys, "cb_button_set_outer_label");
363
+ array_push($settings_keys, "cb_button_set_description");
364
+ array_push($settings_keys, "cb_button_set_options_outer_wrapper");
365
+ array_push($settings_keys, "cb_button_set_options_wrapper");
366
+ array_push($settings_keys, "cb_button_set_options_label");
367
+ array_push($settings_keys, "cb_button_set_txt_input");
368
+ array_push($settings_keys, "cb_date_day_dropdown");
369
+ array_push($settings_keys, "cb_date_month_dropdown");
370
+ array_push($settings_keys, "cb_date_year_dropdown");
371
+ array_push($settings_keys, "cb_button_set_dropdown_menu");
372
+ array_push($settings_keys, "cb_button_set_txt_description");
373
+ array_push($settings_keys, "cb_uploaded_file_email_db");
374
+ array_push($settings_keys, "cb_button_set_outer_label_file");
375
+ array_push($settings_keys, "cb_button_set_outer_description_fileuplod");
376
+ array_push($settings_keys, "cb_button_set_time_hour_dropdown");
377
+ array_push($settings_keys, "cb_button_set_time_minute_dropdown");
378
+ array_push($settings_keys, "cb_button_set_time_am_pm_dropdown");
379
+ array_push($settings_keys, "cb_error_invalid");
380
+
381
+ $settings_keys_email = array();
382
+
383
+ array_push($settings_keys_email, "");
384
+ array_push($settings_keys_email, "cb_checkbox_alpha_filter");
385
+ array_push($settings_keys_email, "cb_ux_checkbox_alpha_num_filter");
386
+ array_push($settings_keys_email, "cb_checkbox_digit_filter");
387
+ array_push($settings_keys_email, "cb_checkbox_strip_tag_filter");
388
+ array_push($settings_keys_email, "cb_checkbox_trim_filter");
389
+ $settings_keys_multiple_options = array();
390
+ array_push($settings_keys_multiple_options, "");
391
+ array_push($settings_keys_multiple_options, "cb_dropdown_option_id");
392
+ array_push($settings_keys_multiple_options, "cb_checkbox_option_id");
393
+ array_push($settings_keys_multiple_options, "cb_radio_option_id");
394
+ array_push($settings_keys_multiple_options, "cb_dropdown_option_val");
395
+ array_push($settings_keys_multiple_options, "cb_checkbox_option_val");
396
+ array_push($settings_keys_multiple_options, "cb_radio_option_val");
397
+ for($flag = 0; $flag < count($contact_forms_dynamic_settings); $flag++)
398
+ {
399
+ $position_keys = array_search($contact_forms_dynamic_settings[$flag]->dynamic_settings_key,$settings_keys);
400
+ $position_email_keys = array_search($contact_forms_dynamic_settings[$flag]->dynamic_settings_key,$settings_keys_email);
401
+ if($position_keys == false && !($position_email_keys != false && in_array($contact_forms_dynamic_settings[$flag]->dynamicId,$column_dynamicId)))
402
+ {
403
+ $wpdb->query
404
+ (
405
+ $wpdb->prepare
406
+ (
407
+ "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,
408
+ dynamic_settings_key,dynamic_settings_value) VALUES(%d, %s, %s)",
409
+ $contact_forms_dynamic_settings[$flag]->control_id,
410
+ $contact_forms_dynamic_settings[$flag]->dynamic_settings_key,
411
+ array_search($contact_forms_dynamic_settings[$flag]->dynamic_settings_key,$settings_keys_multiple_options)
412
+ ? serialize(explode(";",$contact_forms_dynamic_settings[$flag]->dynamic_settings_value)) : $contact_forms_dynamic_settings[$flag]->dynamic_settings_value
413
+ )
414
+ );
415
+ }
416
+ }
417
  }
418
  }
419
+
420
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_email_template_admin() . '"')) == 0)
421
  {
422
+ create_table_contact_bank_email_templates();
423
  }
424
  else
425
  {
426
+ $contact_forms_emails = $wpdb->get_results
427
  (
428
+ "SELECT * FROM ".contact_bank_email_template_admin()
429
  );
430
+
431
+ $sql = "DROP TABLE " . contact_bank_email_template_admin();
432
  $wpdb->query($sql);
433
 
434
+ create_table_contact_bank_email_templates();
435
 
436
+ if(count($contact_forms_emails) > 0)
437
  {
438
+ for($flag = 0; $flag < count($contact_forms_emails); $flag++)
439
  {
440
  $wpdb->query
441
  (
442
  $wpdb->prepare
443
  (
444
+ "INSERT INTO " . contact_bank_email_template_admin() . "(email_id, email_to, email_from,
445
+ body_content, subject, send_to, form_id, from_name, reply_to, cc, bcc, name) VALUES(%d, %s,
446
+ %s, %s, %s, %d, %d, %s, %s, %s, %s, %s)",
447
+ $contact_forms_emails[$flag]->email_id,
448
+ $contact_forms_emails[$flag]->email_to,
449
+ $contact_forms_emails[$flag]->email_from,
450
+ $contact_forms_emails[$flag]->body_content,
451
+ $contact_forms_emails[$flag]->subject,
452
+ isset($contact_forms_emails[$flag]->send_to) ? $contact_forms_emails[$flag]->send_to : "",
453
+ $contact_forms_emails[$flag]->form_id,
454
+ isset($contact_forms_emails[$flag]->from_name) ? $contact_forms_emails[$flag]->from_name : "",
455
+ isset($contact_forms_emails[$flag]->reply_to) ? $contact_forms_emails[$flag]->reply_to : "",
456
+ isset($contact_forms_emails[$flag]->cc) ? $contact_forms_emails[$flag]->cc : "",
457
+ isset($contact_forms_emails[$flag]->bcc) ? $contact_forms_emails[$flag]->bcc : "",
458
+ isset($contact_forms_emails[$flag]->name) ? $contact_forms_emails[$flag]->name : ""
459
  )
460
  );
461
  }
462
  }
463
+
464
  }
465
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_frontend_forms_Table() . '"')) == 0)
466
  {
467
+ create_table_contact_bank_front_end_forms();
468
  }
469
  else
470
  {
471
+ $contact_front_end_forms = $wpdb->get_results
 
 
 
 
472
  (
473
+ "SELECT * FROM ".contact_bank_frontend_forms_Table()
 
 
 
474
  );
475
 
476
+ $sql = "DROP TABLE " . contact_bank_frontend_forms_Table();
477
  $wpdb->query($sql);
478
 
479
+ create_table_contact_bank_front_end_forms();
480
 
481
+ for($flag = 0; $flag < count($contact_front_end_forms);$flag++)
 
482
  {
 
483
  $wpdb->query
484
  (
485
  $wpdb->prepare
486
  (
487
+ "INSERT INTO ". contact_bank_frontend_forms_Table() ."(form_id,submit_id)VALUES(%d, %d)",
488
+ $contact_front_end_forms[$flag]->form_id,
489
+ $contact_front_end_forms[$flag]->submit_id
 
 
490
  )
491
  );
492
  }
493
 
494
+ }
495
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . frontend_controls_data_Table() . '"')) == 0)
496
+ {
497
+ create_table_front_end_data();
498
+ }
499
+ else
500
  {
501
+ $contact_front_end_forms_data = $wpdb->get_results
502
+ (
503
+ "SELECT * FROM ".frontend_controls_data_Table() . " JOIN " . create_control_Table(). " ON " . frontend_controls_data_Table().".dynamic_control_id = ". create_control_Table(). ".column_dynamicId"
504
+ );
505
+
506
+ $sql = "DROP TABLE " . frontend_controls_data_Table();
507
+ $wpdb->query($sql);
 
 
 
 
 
 
 
 
 
 
 
 
 
508
 
509
+ create_table_front_end_data();
510
 
511
+ for($flag = 0; $flag < count($contact_front_end_forms_data);$flag++)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  {
513
+ $wpdb->query
514
+ (
515
+ $wpdb->prepare
 
 
516
  (
517
+ "INSERT INTO ". frontend_controls_data_Table() ."(form_id,field_Id,dynamic_control_id,
518
+ dynamic_frontend_value,form_submit_id)VALUES(%d, %d, %d, %s, %d)",
519
+ $contact_front_end_forms_data[$flag]->form_id,
520
+ $contact_front_end_forms_data[$flag]->field_Id,
521
+ $contact_front_end_forms_data[$flag]->control_id,
522
+ $contact_front_end_forms_data[$flag]->dynamic_frontend_value,
523
+ $contact_front_end_forms_data[$flag]->form_submit_id
524
+ )
525
+ );
 
 
526
  }
527
  }
528
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_layout_settings_Table() . '"')) == 0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  {
530
+ create_contact_bank_layout_settings();
531
+ $settings = array();
532
+ $settings["label_setting_font_family"] = "inherit";
533
+ $settings["label_setting_font_color"] = "#000000";
534
+ $settings["label_setting_font_style"] = "normal";
535
+ $settings["label_setting_font_size"] = "16";
536
+ $settings["label_setting_font_align_left"] = "0";
537
+ $settings["label_setting_label_position"] = "top";
538
+ $settings["label_setting_field_size"] = "11";
539
+ $settings["label_setting_field_align"] = "left";
540
+ $settings["label_setting_hide_label"] = "0";
541
+ $settings["label_setting_text_direction"] = "inherit";
542
+
543
+ $settings["input_field_font_family"] = "inherit";
544
+ $settings["input_field_font_color"] = "#000000";
545
+ $settings["input_field_font_style"] = "normal";
546
+ $settings["input_field_font_size"] = "14";
547
+ $settings["input_field_border_radius"] = "0";
548
+ $settings["input_field_border_color"] = "#e5e5e5";
549
+ $settings["input_field_border_size"] = "1";
550
+ $settings["input_field_border_style"] = "solid";
551
+ $settings["input_field_clr_bg_color"] = "#ffffff";
552
+ $settings["input_field_rdl_multiple_row"] = "1";
553
+ $settings["input_field_rdl_text_align"] = "0";
554
+ $settings["input_field_text_direction"] = "inherit";
555
+ $settings["input_field_input_size"] = "layout-span10";
556
+
557
+ $settings["submit_button_font_family"] = "inherit";
558
+ $settings["submit_button_text"] = "Submit";
559
+ $settings["submit_button_font_style"] = "normal";
560
+ $settings["submit_button_font_size"] = "12";
561
+ $settings["submit_button_button_width"] = "100";
562
+ $settings["submit_button_bg_color"] = "#24890d";
563
+ $settings["submit_button_hover_bg_color"] = "#3dd41a";
564
+ $settings["submit_button_text_color"] = "#ffffff";
565
+ $settings["submit_button_border_color"] = "#000000";
566
+ $settings["submit_button_border_size"] = "0";
567
+ $settings["submit_button_border_radius"] = "0";
568
+ $settings["submit_button_rdl_text_align"] = "0";
569
+ $settings["submit_button_text_direction"] = "inherit";
570
+
571
+ $settings["success_msg_font_family"] = "inherit";
572
+ $settings["success_msg_font_size"] = "12";
573
+ $settings["success_msg_bg_color"] = "#e5ffd5";
574
+ $settings["success_msg_border_color"] = "#e5ffd5";
575
+ $settings["success_msg_text_color"] = "#6aa500";
576
+ $settings["success_msg_rdl_text_align"] = "0";
577
+ $settings["success_msg_text_direction"] = "inherit";
578
+
579
+ $settings["error_msg_font_family"] = "inherit";
580
+ $settings["error_msg_font_size"] = "12";
581
+ $settings["error_msg_bg_color"] = "#ffcaca";
582
+ $settings["error_msg_border_color"] = "#ffcaca";
583
+ $settings["error_msg_text_color"] = "#ff2c38";
584
+ $settings["error_msg_rdl_text_align"] = "0";
585
+ $settings["error_msg_text_direction"] = "inherit";
586
+
587
+ $contact_forms_for_settings = $wpdb->get_results
588
+ (
589
+ "SELECT * FROM ".contact_bank_contact_form()
590
+ );
591
+ for($flag = 0; $flag < count($contact_forms_for_settings); $flag++)
592
  {
593
+ $sql = "";
594
+ foreach($settings as $key => $value)
595
+ {
596
+ $sql[] = '('.$contact_forms_for_settings[$flag]->form_id.',"'.$key.'", "'.$value.'")';
597
+ }
598
  $wpdb->query
599
  (
600
  $wpdb->prepare
601
  (
602
+ "INSERT INTO " . contact_bank_layout_settings_Table() . "(form_id,form_settings_key,form_settings_value) VALUES ".implode(',', $sql),""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  )
604
  );
605
  }
606
  }
607
+ if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_licensing() . "'")) == 0)
608
+ {
609
+ create_cb_table_licensing();
610
+ }
611
+ if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_roles_capability() . "'")) == 0)
612
+ {
613
+ create_table_roles_capability();
614
+ $settings_roles = array();
615
+ $settings_roles["admin_full_control"] = "1";
616
+ $settings_roles["admin_read_control"] = "0";
617
+ $settings_roles["admin_write_control"] = "0";
618
+ $settings_roles["editor_full_control"] = "0";
619
+ $settings_roles["editor_read_control"] = "1";
620
+ $settings_roles["editor_write_control"] = "0";
621
+ $settings_roles["author_full_control"] = "0";
622
+ $settings_roles["author_read_control"] = "1";
623
+ $settings_roles["author_write_control"] = "0";
624
+ $settings_roles["contributor_full_control"] = "0";
625
+ $settings_roles["contributor_read_control"] = "1";
626
+ $settings_roles["contributor_write_control"] = "0";
627
+ $settings_roles["subscriber_full_control"] = "0";
628
+ $settings_roles["subscriber_read_control"] = "1";
629
+ $settings_roles["subscriber_write_control"] = "0";
630
+ foreach($settings_roles as $key => $value)
631
+ {
632
+ $sql1[] = '("'.$key.'", "'.$value.'")';
633
+ }
634
+ $wpdb->query
635
+ (
636
+ "INSERT INTO " . contact_bank_roles_capability() . "(roles_capability_key,roles_capability_value) VALUES ".implode(',', $sql1),""
637
+ );
638
+ }
639
+ $wpdb->query
640
  (
641
+ $wpdb->prepare
642
+ (
643
+ "INSERT INTO " . contact_bank_contact_form() . "(form_id, form_name) VALUES(%d, %s)",
644
+ 1,
645
+ "Contact Form Demo"
646
+ )
647
  );
648
+ $wpdb->query
649
+ (
650
+ $wpdb->prepare
651
+ (
652
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
653
+ 1,
654
+ "redirect",
655
+ "0"
656
+ )
657
+ );
658
+ $wpdb->query
659
+ (
660
+ $wpdb->prepare
661
+ (
662
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
663
+ 1,
664
+ "redirect_url",
665
+ ""
666
+ )
667
+ );
668
+ $wpdb->query
669
+ (
670
+ $wpdb->prepare
671
  (
672
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
673
+ 1,
674
+ "success_message",
675
+ "Your message was sent successfully. Thanks."
676
+ )
677
+ );
678
+ $wpdb->query
679
+ (
680
  $wpdb->prepare
681
  (
682
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
683
+ 1,
684
+ "blank_field_message",
685
+ "Required field must not be blank"
686
  )
687
+ );
688
+ $wpdb->query
 
 
 
 
 
 
 
 
 
689
  (
690
+ $wpdb->prepare
691
+ (
692
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
693
+ 1,
694
+ "incorrect_email_message",
695
+ "Please enter a valid email address"
696
+ )
697
  );
698
+ $wpdb->query
699
+ (
 
 
 
 
 
 
 
 
700
  $wpdb->prepare
701
  (
702
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
703
+ 1,
704
+ "form_description",
705
+ ""
 
 
 
706
  )
707
+ );
708
+
709
+ $wpdb->query
710
+ (
711
+ $wpdb->prepare
712
+ (
713
+ "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
714
+ column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
715
+ 1,
716
+ 1,
717
+ 1,
718
+ 1,
719
+ 1
720
+ )
721
+ );
722
+
723
+ $dynamic_Id = 1;
724
+ $form_id = 1;
725
+ $form_settings = array();
726
+ $form_settings["dynamic_id"] = $dynamic_Id;
727
+ $form_settings["control_type"] = "1";
728
+ $form_settings["cb_label_value"] = "Your Name";
729
+ $form_settings["cb_description"] = "";
730
+ $form_settings["cb_control_required"] = "1";
731
+ $form_settings["cb_tooltip_txt"] = "";
732
+ $form_settings["cb_default_txt_val"] = "Your Name";
733
+ $form_settings["cb_admin_label"] = "Your Name";
734
+ $form_settings["cb_show_email"] = "0";
735
+ $form_settings["cb_checkbox_alpha_filter"] = "0";
736
+ $form_settings["cb_ux_checkbox_alpha_num_filter"] = "0";
737
+ $form_settings["cb_checkbox_digit_filter"] = "0";
738
+ $form_settings["cb_checkbox_strip_tag_filter"] = "0";
739
+ $form_settings["cb_checkbox_trim_filter"] = "0";
740
+
741
+
742
+ foreach($form_settings as $key => $value)
743
+ {
744
+ if($key == "dynamic_id" || $key == "control_type")
745
+ {
746
+ continue;
747
+ }
748
+ else
749
+ {
750
+ $sql_name[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
751
+
752
+ }
753
  }
754
+ $wpdb->query
755
+ (
756
+ "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_name),""
757
+ );
758
+
759
+ $wpdb->query
760
+ (
761
+ $wpdb->prepare
762
+ (
763
+ "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
764
+ column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
765
+ 2,
766
+ 3,
767
+ 1,
768
+ 2,
769
+ 2
770
+ )
771
+ );
772
+
773
+ $dynamic_Id = 2;
774
+ $form_id = 1;
775
+ $form_settings = array();
776
+ $form_settings["dynamic_id"] = $dynamic_Id;
777
+ $form_settings["control_type"] = "1";
778
+ $form_settings["cb_label_value"] = "Your Email";
779
+ $form_settings["cb_description"] = "";
780
+ $form_settings["cb_control_required"] = "1";
781
+ $form_settings["cb_tooltip_txt"] = "";
782
+ $form_settings["cb_default_txt_val"] = "Your Email";
783
+ $form_settings["cb_admin_label"] = "Your Email";
784
+ $form_settings["cb_show_email"] = "0";
785
+
786
+ foreach($form_settings as $key => $value)
787
+ {
788
+ if($key == "dynamic_id" || $key == "control_type")
789
+ {
790
+ continue;
791
+ }
792
+ else
793
+ {
794
+ $sql_email[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
795
+
796
+ }
797
+ }
798
+ $wpdb->query
799
+ (
800
+ "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_email),""
801
+ );
802
+
803
+
804
+ $wpdb->query
805
+ (
806
+ $wpdb->prepare
807
+ (
808
+ "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
809
+ column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
810
+ 3,
811
+ 1,
812
+ 1,
813
+ 3,
814
+ 3
815
+ )
816
+ );
817
+
818
+ $dynamic_Id = 3;
819
+ $form_id = 1;
820
+ $form_settings = array();
821
+ $form_settings["dynamic_id"] = $dynamic_Id;
822
+ $form_settings["control_type"] = "1";
823
+ $form_settings["cb_label_value"] = "Subject";
824
+ $form_settings["cb_description"] = "";
825
+ $form_settings["cb_control_required"] = "0";
826
+ $form_settings["cb_tooltip_txt"] = "";
827
+ $form_settings["cb_default_txt_val"] = "Subject";
828
+ $form_settings["cb_admin_label"] = "Subject";
829
+ $form_settings["cb_show_email"] = "0";
830
+ $form_settings["cb_checkbox_alpha_filter"] = "0";
831
+ $form_settings["cb_ux_checkbox_alpha_num_filter"] = "0";
832
+ $form_settings["cb_checkbox_digit_filter"] = "0";
833
+ $form_settings["cb_checkbox_strip_tag_filter"] = "0";
834
+ $form_settings["cb_checkbox_trim_filter"] = "0";
835
+
836
+
837
+ foreach($form_settings as $key => $value)
838
+ {
839
+ if($key == "dynamic_id" || $key == "control_type")
840
+ {
841
+ continue;
842
+ }
843
+ else
844
+ {
845
+ $sql_subject[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
846
+
847
+ }
848
+ }
849
+ $wpdb->query
850
+ (
851
+ "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_subject),""
852
+ );
853
+ $wpdb->query
854
+ (
855
+ $wpdb->prepare
856
+ (
857
+ "INSERT INTO " . create_control_Table() . "(control_id, field_id,form_id,
858
+ column_dynamicId, sorting_order) VALUES(%d, %d, %d, %d, %d)",
859
+ 4,
860
+ 2,
861
+ 1,
862
+ 4,
863
+ 4
864
+ )
865
+ );
866
+
867
+
868
+ $dynamic_Id = 4;
869
+ $form_id = 1;
870
+ $form_settings = array();
871
+ $form_settings["dynamic_id"] = $dynamic_Id;
872
+ $form_settings["control_type"] = "2";
873
+ $form_settings["cb_label_value"] = "Your Message";
874
+ $form_settings["cb_description"] = "";
875
+ $form_settings["cb_control_required"] = "0";
876
+ $form_settings["cb_tooltip_txt"] = "";
877
+ $form_settings["cb_default_txt_val"] = "Your Message";
878
+ $form_settings["cb_admin_label"] = "Your Message";
879
+ $form_settings["cb_show_email"] = "0";
880
+ $form_settings["cb_checkbox_alpha_filter"] = "0";
881
+ $form_settings["cb_ux_checkbox_alpha_num_filter"] = "0";
882
+ $form_settings["cb_checkbox_digit_filter"] = "0";
883
+ $form_settings["cb_checkbox_strip_tag_filter"] = "0";
884
+ $form_settings["cb_checkbox_trim_filter"] = "0";
885
+
886
+
887
+ foreach($form_settings as $key => $value)
888
+ {
889
+ if($key == "dynamic_id" || $key == "control_type")
890
+ {
891
+ continue;
892
+ }
893
+ else
894
+ {
895
+ $sql_message[] = '('.$dynamic_Id.',"'.$key.'", "'.$value.'")';
896
+
897
+ }
898
+ }
899
+ $wpdb->query
900
+ (
901
+ "INSERT INTO " . contact_bank_dynamic_settings_form() . "(dynamicId,dynamic_settings_key,dynamic_settings_value) VALUES ".implode(',', $sql_message),""
902
+ );
903
+
904
  $settings = array();
905
  $settings["label_setting_font_family"] = "inherit";
906
  $settings["label_setting_font_color"] = "#000000";
959
 
960
  $contact_forms_for_settings = $wpdb->get_results
961
  (
962
+ "SELECT * FROM ".contact_bank_contact_form()
963
  );
964
  for($flag = 0; $flag < count($contact_forms_for_settings); $flag++)
965
  {
970
  }
971
  $wpdb->query
972
  (
973
+ "INSERT INTO " . contact_bank_layout_settings_Table() . "(form_id,form_settings_key,form_settings_value) VALUES ".implode(',', $sql),""
 
 
 
974
  );
975
  }
976
+ $fields_created = $wpdb->get_results
977
+ (
978
+ $wpdb->prepare
979
+ (
980
+ "SELECT dynamicId, dynamic_settings_value,field_id FROM ". contact_bank_dynamic_settings_form(). " JOIN " . create_control_Table(). " ON " . contact_bank_dynamic_settings_form().". dynamicId = ". create_control_Table(). ".control_id WHERE `dynamic_settings_key` = 'cb_admin_label' and form_id = %d Order By ".create_control_Table().".sorting_order",
981
+ 1
982
+ )
983
+ );
984
+ $controls = "";
985
+ $email_dynamicId = "";
986
+ for($flag = 0;$flag <count($fields_created) ; $flag++)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
987
  {
988
+ $show_in_email = $wpdb->get_var
989
+ (
990
+ $wpdb->prepare
991
+ (
992
+ "SELECT dynamic_settings_value FROM ". contact_bank_dynamic_settings_form(). " WHERE `dynamic_settings_key` = 'cb_show_email' and dynamicId = %d",
993
+ $fields_created[$flag]->dynamicId
994
+ )
995
+ );
996
+ if($show_in_email == "0")
997
+ {
998
+ $controls .= "<strong>".$fields_created[$flag]->dynamic_settings_value ."</strong>: ". "[control_".$fields_created[$flag]->dynamicId."] <br>";
999
+ }
1000
+ if($fields_created[$flag]->field_id == 3)
1001
+ {
1002
+ $email_dynamicId = $fields_created[$flag]->dynamicId;
1003
+ }
1004
  }
1005
+ $email_name = "Admin Notification";
1006
+ $send_to = get_option('admin_email');
1007
+ $email_address = get_option('admin_email');
1008
+ $email_from_name = "Site Administration";
1009
+ $email_from_email = get_option('admin_email');
1010
+ $email_subject = "New Contact recieved from Website";
1011
+ $uxDescription_email = "Hello Admin,<br><br>
1012
+ A new user has visited your website.<br><br>
1013
+ Here are the details :<br><br>
1014
+ ".$controls."
1015
+ <br>Thanks,<br><br>
1016
+ <strong>Technical Support Team</strong>";
1017
  $wpdb->query
1018
  (
1019
+ $wpdb->prepare
1020
+ (
1021
+ "INSERT INTO " . contact_bank_email_template_admin(). " (email_to,email_from,body_content,subject,form_id,from_name,name,send_to) VALUES(%s,%s,%s,%s,%d,%s,%s,%d)",
1022
+ $email_address,
1023
+ $email_from_email,
1024
+ $uxDescription_email,
1025
+ $email_subject,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1026
  1,
1027
+ $email_from_name,
1028
+ $email_name,
1029
+ $send_to
1030
+ )
1031
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1032
 
1033
+ $email_name_client = "Client Notification";
1034
+ $email_subject_client = "Thanks for visiting our website";
1035
+ $email_from_name = "Site Administration";
1036
+ $email_from_email = get_option('admin_email');
1037
+ $uxDescription_email_client = "Hi,<br><br>
1038
+ Thanks for visiting our website. We will Contact you within next 24 hours.<br><br>
1039
+ <br>Thanks,<br><br>
1040
+ <strong>Support Team</strong>";
1041
+ $wpdb->query
1042
  (
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1043
  $wpdb->prepare
1044
  (
1045
+ "INSERT INTO " . contact_bank_email_template_admin(). " (email_to,email_from,body_content,subject,form_id,from_name,name,send_to) VALUES(%s,%s,%s,%s,%d,%s,%s,%d)",
1046
+ "",
1047
+ $email_from_email,
1048
+ $uxDescription_email_client,
1049
+ $email_subject_client,
1050
+ 1,
1051
+ $email_from_name,
1052
+ $email_name_client,
1053
+ ""
1054
  )
 
 
 
 
 
 
 
 
 
 
 
 
1055
  );
1056
+
1057
+ }
1058
+ else if($version == "2.0")
1059
+ {
1060
+ if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_licensing() . "'")) == 0)
1061
  {
1062
+ create_cb_table_licensing();
1063
  }
1064
+ if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_roles_capability() . "'")) == 0)
1065
  {
1066
+ create_table_roles_capability();
1067
+ $settings_roles = array();
1068
+ $settings_roles["admin_full_control"] = "1";
1069
+ $settings_roles["admin_read_control"] = "0";
1070
+ $settings_roles["admin_write_control"] = "0";
1071
+ $settings_roles["editor_full_control"] = "0";
1072
+ $settings_roles["editor_read_control"] = "1";
1073
+ $settings_roles["editor_write_control"] = "0";
1074
+ $settings_roles["author_full_control"] = "0";
1075
+ $settings_roles["author_read_control"] = "1";
1076
+ $settings_roles["author_write_control"] = "0";
1077
+ $settings_roles["contributor_full_control"] = "0";
1078
+ $settings_roles["contributor_read_control"] = "1";
1079
+ $settings_roles["contributor_write_control"] = "0";
1080
+ $settings_roles["subscriber_full_control"] = "0";
1081
+ $settings_roles["subscriber_read_control"] = "1";
1082
+ $settings_roles["subscriber_write_control"] = "0";
1083
+ foreach($settings_roles as $key => $value)
1084
+ {
1085
+ $sql1[] = '("'.$key.'", "'.$value.'")';
1086
+ }
1087
+ $wpdb->query
1088
+ (
1089
+ "INSERT INTO " . contact_bank_roles_capability() . "(roles_capability_key,roles_capability_value) VALUES ".implode(',', $sql1),""
1090
+ );
1091
  }
1092
+ if (count($wpdb->get_var('SHOW TABLES LIKE "' . contact_bank_form_settings_Table() . '"')) == 0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1093
  {
1094
+ create_contact_bank_form_settings();
1095
  }
1096
+ else
1097
+ {
1098
+ $contact_forms_settings_table = $wpdb->get_results
1099
+ (
1100
+ "SELECT * FROM ".contact_bank_form_settings_Table()
1101
+ );
 
 
 
 
 
 
 
 
 
1102
 
1103
+ $sql = "DROP TABLE " . contact_bank_form_settings_Table();
1104
+ $wpdb->query($sql);
1105
+ $contact_forms_count = $wpdb->get_results
1106
+ (
1107
+ "SELECT * FROM ".contact_bank_contact_form()
1108
+ );
1109
 
1110
+ create_contact_bank_form_settings();
1111
 
1112
+ if(count($contact_forms_settings_table) > 0)
 
 
1113
  {
1114
+ for($flag = 0; $flag < count($contact_forms_settings_table); $flag++)
1115
+ {
1116
+ $wpdb->query
1117
  (
1118
+ $wpdb->prepare
1119
+ (
1120
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
1121
+ $contact_forms_settings_table[$flag]->form_id,
1122
+ $contact_forms_settings_table[$flag]->form_message_key,
1123
+ $contact_forms_settings_table[$flag]->form_message_value
1124
+ )
1125
+ );
1126
+ }
1127
+ for($flag = 0; $flag < count($contact_forms_count); $flag++)
1128
+ {
1129
+ $wpdb->query
1130
  (
1131
+ $wpdb->prepare
1132
+ (
1133
+ "INSERT INTO ". contact_bank_form_settings_Table() ."(form_id,form_message_key,form_message_value)VALUES(%d, %s, %s)",
1134
+ $contact_forms_count[$flag]->form_id,
1135
+ "form_description",
1136
+ ""
1137
+ )
1138
+ );
1139
+ }
1140
  }
1141
  }
1142
  }
1143
+ else if($version == "2.1")
 
 
 
1144
  {
1145
+ if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_licensing() . "'")) == 0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1146
  {
1147
+ create_cb_table_licensing();
1148
+ }
1149
+ if (count($wpdb->get_var("SHOW TABLES LIKE '" . contact_bank_roles_capability() . "'")) == 0)
1150
+ {
1151
+ create_table_roles_capability();
1152
+ $settings_roles = array();
1153
+ $settings_roles["admin_full_control"] = "1";
1154
+ $settings_roles["admin_read_control"] = "0";
1155
+ $settings_roles["admin_write_control"] = "0";
1156
+ $settings_roles["editor_full_control"] = "0";
1157
+ $settings_roles["editor_read_control"] = "1";
1158
+ $settings_roles["editor_write_control"] = "0";
1159
+ $settings_roles["author_full_control"] = "0";
1160
+ $settings_roles["author_read_control"] = "1";
1161
+ $settings_roles["author_write_control"] = "0";
1162
+ $settings_roles["contributor_full_control"] = "0";
1163
+ $settings_roles["contributor_read_control"] = "1";
1164
+ $settings_roles["contributor_write_control"] = "0";
1165
+ $settings_roles["subscriber_full_control"] = "0";
1166
+ $settings_roles["subscriber_read_control"] = "1";
1167
+ $settings_roles["subscriber_write_control"] = "0";
1168
+ foreach($settings_roles as $key => $value)
1169
+ {
1170
+ $sql1[] = '("'.$key.'", "'.$value.'")';
1171
+ }
1172
+ $wpdb->query
1173
+ (
1174
+ "INSERT INTO " . contact_bank_roles_capability() . "(roles_capability_key,roles_capability_value) VALUES ".implode(',', $sql1),""
1175
+ );
1176
  }
 
 
 
 
1177
  }
1178
+ update_option("contact-bank-version-number","2.1");
1179
+ $option_auto_update_contact = get_option("contact-bank-automatic_update");
1180
+ if($option_auto_update_contact == "")
1181
+ {
1182
+ update_option("contact-bank-automatic_update", "1");
1183
+ }
1184
  }
1185
  ?>
lib/uninstall-script.php CHANGED
@@ -1,36 +1,37 @@
1
  <?php
2
- global $wpdb;
3
- $sql = "DROP TABLE " .contact_bank_contact_form();
4
- $wpdb->query($sql);
5
-
6
- $sql = "DROP TABLE " .create_control_Table();
7
- $wpdb->query($sql);
8
-
9
- $sql = "DROP TABLE " .contact_bank_dynamic_settings_form();
10
- $wpdb->query($sql);
11
-
12
- $sql = "DROP TABLE " .contact_bank_email_template_admin();
13
- $wpdb->query($sql);
14
-
15
- $sql = "DROP TABLE " .frontend_controls_data_Table();
16
- $wpdb->query($sql);
17
-
18
- $sql = "DROP TABLE " .contact_bank_frontend_forms_Table();
19
- $wpdb->query($sql);
20
-
21
- $sql = "DROP TABLE " .contact_bank_form_settings_Table();
22
- $wpdb->query($sql);
23
-
24
- $sql = "DROP TABLE " .contact_bank_layout_settings_Table();
25
- $wpdb->query($sql);
26
-
27
- $sql = "DROP TABLE " .contact_bank_licensing();
28
- $wpdb->query($sql);
29
-
30
- $sql = "DROP TABLE " .contact_bank_roles_capability();
31
- $wpdb->query($sql);
32
-
33
- delete_option("contact-bank-info-popup");
34
- delete_option("contact-bank-version-number");
35
- delete_option("contact-bank-automatic_update");
36
- ?>
 
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ global $wpdb;
4
+ $sql = "DROP TABLE " .contact_bank_contact_form();
5
+ $wpdb->query($sql);
6
+
7
+ $sql = "DROP TABLE " .create_control_Table();
8
+ $wpdb->query($sql);
9
+
10
+ $sql = "DROP TABLE " .contact_bank_dynamic_settings_form();
11
+ $wpdb->query($sql);
12
+
13
+ $sql = "DROP TABLE " .contact_bank_email_template_admin();
14
+ $wpdb->query($sql);
15
+
16
+ $sql = "DROP TABLE " .frontend_controls_data_Table();
17
+ $wpdb->query($sql);
18
+
19
+ $sql = "DROP TABLE " .contact_bank_frontend_forms_Table();
20
+ $wpdb->query($sql);
21
+
22
+ $sql = "DROP TABLE " .contact_bank_form_settings_Table();
23
+ $wpdb->query($sql);
24
+
25
+ $sql = "DROP TABLE " .contact_bank_layout_settings_Table();
26
+ $wpdb->query($sql);
27
+
28
+ $sql = "DROP TABLE " .contact_bank_licensing();
29
+ $wpdb->query($sql);
30
+
31
+ $sql = "DROP TABLE " .contact_bank_roles_capability();
32
+ $wpdb->query($sql);
33
+
34
+ delete_option("contact-bank-info-popup");
35
+ delete_option("contact-bank-version-number");
36
+ delete_option("contact-bank-automatic_update");
37
+ ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: contact-banker, Gallery-Bank
3
  Tags: advanced form, best contact form plugin, contact form builder, contact manager, contact us form, custom form, feedback form, web form, contact us, contact bank, contact form, forms
4
  Requires at least: 3.1
5
  Tested up to: 4.6
6
- Stable tag: 2.1.26
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -549,6 +549,11 @@ In order to set Shortcode for a Form, you need to follow these steps :
549
 
550
  == Changelog ==
551
 
 
 
 
 
 
552
  = 2.1.26 =
553
 
554
  * Compatiblity with 4.6
3
  Tags: advanced form, best contact form plugin, contact form builder, contact manager, contact us form, custom form, feedback form, web form, contact us, contact bank, contact form, forms
4
  Requires at least: 3.1
5
  Tested up to: 4.6
6
+ Stable tag: 2.1.27
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
549
 
550
  == Changelog ==
551
 
552
+ = 2.1.27 =
553
+
554
+ * Security Patch
555
+ * Code Optimized
556
+
557
  = 2.1.26 =
558
 
559
  * Compatiblity with 4.6
views/add_contact_email.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/automatic-plugin-update.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/contact-bank-system-report.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/contact-feedback.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/contact_bank_form_preview.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/contact_bank_layout_settings.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/contact_bank_pro_version.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
@@ -17,10 +17,10 @@ if (!current_user_can($cb_user_role_permission))
17
  return;
18
  }
19
  else
20
- {
21
  if(isset($_REQUEST["msg"]))
22
  {
23
- if(esc_attr($_REQUEST["msg"]) == "no")
24
  {
25
  update_option("contact-bank-banner", "no");
26
  ?>
@@ -359,9 +359,9 @@ else
359
  </ul>
360
  </div>
361
  </div>
362
- </div>
363
- </div>
364
- </div>
365
  </div>
366
  </div>
367
  </div>
@@ -377,9 +377,9 @@ else
377
  <div id="uxdownload" class="contact_bank_getting_started">
378
  <p>
379
  We’re interested in hearing from you.</p>
380
-
381
  <p>We will help you through the process and try to provide the answers.</p>
382
-
383
  <p>If you need to know more about our services or have something to share, please feel free to contact us.
384
  </p>
385
  <p>We commit to responses within 24 hours on weekdays – generally within hours during week day work hours.</p>
@@ -398,6 +398,6 @@ else
398
  </div>
399
  </div>
400
  </form>
401
- <?php
402
  }
403
  ?>
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
17
  return;
18
  }
19
  else
20
+ {
21
  if(isset($_REQUEST["msg"]))
22
  {
23
+ if(esc_attr($_REQUEST["msg"]) == "no")
24
  {
25
  update_option("contact-bank-banner", "no");
26
  ?>
359
  </ul>
360
  </div>
361
  </div>
362
+ </div>
363
+ </div>
364
+ </div>
365
  </div>
366
  </div>
367
  </div>
377
  <div id="uxdownload" class="contact_bank_getting_started">
378
  <p>
379
  We’re interested in hearing from you.</p>
380
+
381
  <p>We will help you through the process and try to provide the answers.</p>
382
+
383
  <p>If you need to know more about our services or have something to share, please feel free to contact us.
384
  </p>
385
  <p>We commit to responses within 24 hours on weekdays – generally within hours during week day work hours.</p>
398
  </div>
399
  </div>
400
  </form>
401
+ <?php
402
  }
403
  ?>
views/contact_controls_files.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  global $wpdb,$current_user,$cb_user_role_permission;
3
  if (is_super_admin())
4
  {
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  global $wpdb,$current_user,$cb_user_role_permission;
4
  if (is_super_admin())
5
  {
views/contact_documentation.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
@@ -17,7 +17,7 @@ if (!current_user_can($cb_user_role_permission))
17
  return;
18
  }
19
  else
20
- {
21
  ?>
22
  <div class="fluid-layout" >
23
  <div class="layout-span12">
@@ -31,6 +31,6 @@ else
31
  </div>
32
  </div>
33
  </div>
34
- <?php
35
  }
36
- ?>
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
17
  return;
18
  }
19
  else
20
+ {
21
  ?>
22
  <div class="fluid-layout" >
23
  <div class="layout-span12">
31
  </div>
32
  </div>
33
  </div>
34
+ <?php
35
  }
36
+ ?>
views/contact_email_settings.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/contact_frontend_data.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/contact_view.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  switch($cb_role)
4
  {
5
  case "administrator":
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
views/dashboard.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
@@ -155,10 +156,8 @@ else
155
  </div>
156
  </form>
157
  <script type="text/javascript">
158
-
159
  jQuery(document).ready(function()
160
  {
161
-
162
  jQuery("a[rel^=\"prettyPhoto\"]").prettyPhoto
163
  ({
164
  animation_speed: 1000,
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
156
  </div>
157
  </form>
158
  <script type="text/javascript">
 
159
  jQuery(document).ready(function()
160
  {
 
161
  jQuery("a[rel^=\"prettyPhoto\"]").prettyPhoto
162
  ({
163
  animation_speed: 1000,
views/footer.php CHANGED
@@ -1 +1,25 @@
1
- <div style="margin: 10px;text-align: center;"><img src="<?php echo plugins_url("/assets/images/footer.png" , dirname(__FILE__));?>"/></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
4
+ {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
+ }
15
+ if (!current_user_can($cb_user_role_permission))
16
+ {
17
+ return;
18
+ }
19
+ else
20
+ {
21
+ ?>
22
+ <div style="margin: 10px;text-align: center;"><img src="<?php echo plugins_url("/assets/images/footer.png" , dirname(__FILE__));?>"/></div>
23
+ <?php
24
+ }
25
+ ?>
views/header.php CHANGED
@@ -1,201 +1,223 @@
1
  <?php
2
- $cb_lang = array();
3
- $cb_lang_translated_languages = array();
4
- array_push($cb_lang_translated_languages,"fr_BE","fr_BE","fr_CA","fr_CH","fr_FR","ru_RU","ru_UA","en_US","en_GB","es_ES","es_CL","es_PE","es_PR","es_VE","es_CO","nl_NL","nl_BE",
5
- "hu_HU","de_DE", "pt_BR","pt_PT","he_IL", "tr_TR","it_IT", "da_DK", "pl_PL", "sv_SE", "zh_CN","zh_HK","zh_sg","zh_TW","zh","cs_CZ","sk_SK","el","hr","fi");
6
-
7
- array_push($cb_lang, "ar", "et", "bg_BG", "id_ID", "ja", "ko_KR", "ms_MY", "ro_RO", "sl_SL", "sq", "sr_RS", "th", "et");
8
- $cb_language = get_locale();
9
- if(isset($_GET["page"]))
10
  {
11
- ?>
12
- <script>
13
- jQuery(document).ready(function()
 
 
 
 
 
 
 
 
14
  {
15
- jQuery(".nav-tab-wrapper > a#<?php echo esc_attr($_GET["page"]);?>").addClass("nav-tab-active");
16
- });
17
- </script>
18
- <?php
19
  }
20
- ?>
21
- <div id="welcome-panel" class="welcome-panel" style="padding:0px !important;background-color: #f9f9f9 !important">
22
- <div class="welcome-panel-content">
23
- <img src="<?php echo plugins_url("/assets/images/contact-bank.png" , dirname(__FILE__)); ?>" />
24
- <div class="welcome-panel-column-container">
25
- <div class="welcome-panel-column" style="width:240px !important;">
26
- <h4 class="welcome-screen-margin">
27
- <?php _e("Get Started", contact_bank); ?>
28
- </h4>
29
- <a class="button button-primary button-hero" target="_blank" href="http://vimeo.com/92488992">
30
- <?php _e("Watch Contact Video!", contact_bank); ?>
31
- </a>
32
- <p>or,
33
- <a target="_blank" href="http://tech-banker.com/products/wp-contact-bank/knowledge-base/">
34
- <?php _e("read documentation here", contact_bank); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  </a>
36
- </p>
37
- </div>
38
- <div class="welcome-panel-column" style="width:250px !important;">
39
- <h4 class="welcome-screen-margin"><?php _e("Go Premium", contact_bank); ?></h4>
40
- <ul>
41
- <li>
42
- <a href="http://tech-banker.com/products/wp-contact-bank/" target="_blank" class="welcome-icon">
43
- <?php _e("Feature", contact_bank); ?>
44
- </a>
45
- </li>
46
- <li>
47
- <a href="http://tech-banker.com/products/wp-contact-bank/demo/" target="_blank" class="welcome-icon">
48
- <?php _e("Online Demos", contact_bank); ?>
49
- </a>
50
- </li>
51
- <li>
52
- <a href="http://tech-banker.com/products/wp-contact-bank/pricing/" target="_blank" class="welcome-icon">
53
- <?php _e("Pricing Plans", contact_bank); ?>
54
- </a>
55
- </li>
56
- </ul>
57
- </div>
58
- <div class="welcome-panel-column" style="width:240px !important;">
59
- <h4 class="welcome-screen-margin">
60
- <?php _e("Knowledge Base", contact_bank); ?>
61
- </h4>
62
- <ul>
63
- <li>
64
- <a href="http://tech-banker.com/forums/forum/contact-bank-support/" target="_blank" class="welcome-icon">
65
- <?php _e("Support Forum", contact_bank); ?>
66
  </a>
67
- </li>
68
- <li>
69
- <a href="http://tech-banker.com/products/wp-contact-bank/knowledge-base/" target="_blank" class="welcome-icon">
70
- <?php _e("FAQ's", contact_bank); ?>
71
- </a>
72
- </li>
73
- <li>
74
- <a href="http://tech-banker.com/products/renew-premium-support-wp-contact-bank/" target="_blank" class="welcome-icon">
75
- <?php _e("Renew Premium Support", contact_bank); ?>
76
- </a>
77
- </li>
78
- </ul>
79
- </div>
80
- <div class="welcome-panel-column welcome-panel-last" style="width:250px !important;">
81
- <h4 class="welcome-screen-margin"><?php _e("More Actions", contact_bank); ?></h4>
82
- <ul>
83
- <li>
84
- <a href="http://tech-banker.com/shop/plugin-customization/order-customization-wp-contact-bank/" target="_blank" class="welcome-icon">
85
- <?php _e("Plugin Customization", contact_bank); ?>
86
- </a>
87
- </li>
88
- <li>
89
- <a href="admin.php?page=contact_bank_recommended_plugins" class="welcome-icon">
90
- <?php _e("Recommendations", contact_bank); ?>
91
- </a>
92
- </li>
93
- <li>
94
- <a href="admin.php?page=contact_bank_other_services" class="welcome-icon">
95
- <?php _e("Our Other Services", contact_bank); ?>
96
- </a>
97
- </li>
98
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  </div>
100
  </div>
101
  </div>
102
- </div>
103
- <?php
104
- global $wpdb,$current_user;
105
- if (is_super_admin())
106
- {
107
- $cb_role = "administrator";
108
- }
109
- else
110
- {
111
- $cb_role = $wpdb->prefix . "capabilities";
112
- $current_user->role = array_keys($current_user->$cb_role);
113
- $cb_role = $current_user->role[0];
114
- }
115
 
116
- switch ($cb_role) {
117
- case "administrator":
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ?>
119
- <h2 class="nav-tab-wrapper">
120
- <a class="nav-tab custom-nav-tab" id="contact_dashboard" href="admin.php?page=contact_dashboard"><?php _e("Dashboard",contact_bank) ;?></a>
121
- <a class="nav-tab custom-nav-tab" id="contact_short_code" href="admin.php?page=contact_short_code"><?php _e("Short-Codes",contact_bank) ;?></a>
122
- <a class="nav-tab custom-nav-tab" id="contact_frontend_data" href="admin.php?page=contact_frontend_data"><?php _e("Form Entries",contact_bank) ;?></a>
123
- <a class="nav-tab custom-nav-tab" id="contact_email" href="admin.php?page=contact_email"><?php _e("Email Settings",contact_bank) ;?></a>
124
- <a class="nav-tab custom-nav-tab" id="contact_layout_settings" href="admin.php?page=contact_layout_settings"><?php _e("Global Settings",contact_bank) ;?></a>
125
- <a class="nav-tab custom-nav-tab" id="contact_bank_recommended_plugins" href="admin.php?page=contact_bank_recommended_plugins"><?php _e("Recommendations",contact_bank) ;?></a>
126
- <a class="nav-tab custom-nav-tab" id="contact_pro_version" href="admin.php?page=contact_pro_version"><?php _e("Premium Editions",contact_bank) ;?></a>
127
- <a class="nav-tab custom-nav-tab" id="contact_bank_other_services" href="admin.php?page=contact_bank_other_services"><?php _e("Our Other Services",contact_bank) ;?></a>
128
- </h2>
129
  <?php
130
- break;
131
- case "editor":
 
132
  ?>
133
- <h2 class="nav-tab-wrapper">
134
- <a class="nav-tab custom-nav-tab" id="contact_dashboard" href="admin.php?page=contact_dashboard"><?php _e("Dashboard",contact_bank) ;?></a>
135
- <a class="nav-tab custom-nav-tab" id="contact_short_code" href="admin.php?page=contact_short_code"><?php _e("Short-Codes",contact_bank) ;?></a>
136
- <a class="nav-tab custom-nav-tab" id="contact_frontend_data" href="admin.php?page=contact_frontend_data"><?php _e("Form Entries",contact_bank) ;?></a>
137
- <a class="nav-tab custom-nav-tab" id="contact_email" href="admin.php?page=contact_email"><?php _e("Email Settings",contact_bank) ;?></a>
138
- <a class="nav-tab custom-nav-tab" id="contact_layout_settings" href="admin.php?page=contact_layout_settings"><?php _e("Global Settings",contact_bank) ;?></a>
139
- <a class="nav-tab custom-nav-tab" id="contact_bank_recommended_plugins" href="admin.php?page=contact_bank_recommended_plugins"><?php _e("Recommendations",contact_bank) ;?></a>
140
- <a class="nav-tab custom-nav-tab" id="contact_pro_version" href="admin.php?page=contact_pro_version"><?php _e("Premium Editions",contact_bank) ;?></a>
141
- <a class="nav-tab custom-nav-tab" id="contact_bank_other_services" href="admin.php?page=contact_bank_other_services"><?php _e("Our Other Services",contact_bank) ;?></a>
142
- </h2>
143
  <?php
144
- break;
145
- case "author":
 
146
  ?>
147
- <h2 class="nav-tab-wrapper">
148
- <a class="nav-tab custom-nav-tab" id="contact_dashboard" href="admin.php?page=contact_dashboard"><?php _e("Dashboard",contact_bank) ;?></a>
149
- <a class="nav-tab custom-nav-tab" id="contact_short_code" href="admin.php?page=contact_short_code"><?php _e("Short-Codes",contact_bank) ;?></a>
150
- <a class="nav-tab custom-nav-tab" id="contact_frontend_data" href="admin.php?page=contact_frontend_data"><?php _e("Form Entries",contact_bank) ;?></a>
151
- <a class="nav-tab custom-nav-tab" id="contact_email" href="admin.php?page=contact_email"><?php _e("Email Settings",contact_bank) ;?></a>
152
- <a class="nav-tab custom-nav-tab" id="contact_layout_settings" href="admin.php?page=contact_layout_settings"><?php _e("Global Settings",contact_bank) ;?></a>
153
- <a class="nav-tab custom-nav-tab" id="contact_bank_recommended_plugins" href="admin.php?page=contact_bank_recommended_plugins"><?php _e("Recommendations",contact_bank) ;?></a>
154
- <a class="nav-tab custom-nav-tab" id="contact_pro_version" href="admin.php?page=contact_pro_version"><?php _e("Premium Editions",contact_bank) ;?></a>
155
- <a class="nav-tab custom-nav-tab" id="contact_bank_other_services" href="admin.php?page=contact_bank_other_services"><?php _e("Our Other Services",contact_bank) ;?></a>
156
- </h2>
157
- <?php
158
- break;
159
- }
160
- if(isset($_GET["page"]) ? esc_attr($_GET["page"]) : "" != "contact_feature_request")
161
- {
162
- ?>
163
- <div class="custom-message green" style="display: block;margin-top:30px">
164
- <div style="padding: 4px 0;">
165
- <p style="font:12px/1.0em Arial !important;font-weight:bold;">If you don't find any features you were looking for in this Plugin,
166
- please write us <a target="_self" href="admin.php?page=contact_feature_request">here</a> and we shall try to implement this for you as soon as possible! We are looking forward for your valuable <a target="_self" href="admin.php?page=contact_feature_request">Feedback</a></p>
167
  </div>
168
- </div>
169
- <?php
170
- }
171
- if(in_array($cb_language, $cb_lang))
172
- {
173
- ?>
174
- <div class="custom-message red" style="display: block;margin-top:10px">
175
- <span style="padding: 4px 0;">
176
- <strong><p style="font:12px/1.0em Arial !important;">This plugin language is translated with the help of Google Translator.</p>
177
- <p style="font:12px/1.0em Arial !important;">If you would like to translate & help us, we will reward you with a free Eco Edition License of Contact Bank.</p>
178
- <p style="font:12px/1.0em Arial !important;">Contact Us at <a target="_blank" href="http://tech-banker.com">http://tech-banker.com</a> or email us at <a href="mailto:support@tech-banker.com">support@tech-banker.com</a></p>
179
- </strong>
180
- </span>
181
- </div>
182
- <?php
183
- }
184
- elseif(!(in_array($cb_language, $cb_lang_translated_languages)) && !(in_array($cb_language, $cb_lang)) && $cb_language != "")
185
- {
186
  ?>
187
- <div class="custom-message red" style="display: block;margin-top:10px">
188
- <span style="padding: 4px 0;">
189
- <strong><p style="font:12px/1.0em Arial !important;">If you would like to translate Contact Bank in your native language, we will reward you with a free Eco Edition License of Contact Bank.</p>
190
- <p style="font:12px/1.0em Arial !important;">Contact Us at <a target="_blank" href="http://tech-banker.com">http://tech-banker.com</a> or email us at <a href="mailto:support@tech-banker.com">support@tech-banker.com</a></p>
191
- </strong>
192
- </span>
193
  </div>
194
  <?php
195
  }
196
  ?>
197
- <div class="custom-message red" style="display: block;margin-top:10px;">
198
- <span>
199
- <strong>You are only allowed to add 2 Forms. Kindly purchase Premium Editions for full access.</strong>
200
- </span>
201
- </div>
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
 
 
 
 
 
 
4
  {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
+ }
15
+ if (!current_user_can($cb_user_role_permission))
16
  {
17
+ return;
 
 
 
18
  }
19
+ else
20
+ {
21
+ $cb_lang = array();
22
+ $cb_lang_translated_languages = array();
23
+ array_push($cb_lang_translated_languages,"fr_BE","fr_BE","fr_CA","fr_CH","fr_FR","ru_RU","ru_UA","en_US","en_GB","es_ES","es_CL","es_PE","es_PR","es_VE","es_CO","nl_NL","nl_BE",
24
+ "hu_HU","de_DE", "pt_BR","pt_PT","he_IL", "tr_TR","it_IT", "da_DK", "pl_PL", "sv_SE", "zh_CN","zh_HK","zh_sg","zh_TW","zh","cs_CZ","sk_SK","el","hr","fi");
25
+
26
+ array_push($cb_lang, "ar", "et", "bg_BG", "id_ID", "ja", "ko_KR", "ms_MY", "ro_RO", "sl_SL", "sq", "sr_RS", "th", "et");
27
+ $cb_language = get_locale();
28
+ if(isset($_GET["page"]))
29
+ {
30
+ ?>
31
+ <script>
32
+ jQuery(document).ready(function()
33
+ {
34
+ jQuery(".nav-tab-wrapper > a#<?php echo esc_attr($_GET["page"]);?>").addClass("nav-tab-active");
35
+ });
36
+ </script>
37
+ <?php
38
+ }
39
+ ?>
40
+ <div id="welcome-panel" class="welcome-panel" style="padding:0px !important;background-color: #f9f9f9 !important">
41
+ <div class="welcome-panel-content">
42
+ <img src="<?php echo plugins_url("/assets/images/contact-bank.png" , dirname(__FILE__)); ?>" />
43
+ <div class="welcome-panel-column-container">
44
+ <div class="welcome-panel-column" style="width:240px !important;">
45
+ <h4 class="welcome-screen-margin">
46
+ <?php _e("Get Started", contact_bank); ?>
47
+ </h4>
48
+ <a class="button button-primary button-hero" target="_blank" href="http://vimeo.com/92488992">
49
+ <?php _e("Watch Contact Video!", contact_bank); ?>
50
  </a>
51
+ <p>or,
52
+ <a target="_blank" href="http://tech-banker.com/products/wp-contact-bank/knowledge-base/">
53
+ <?php _e("read documentation here", contact_bank); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  </a>
55
+ </p>
56
+ </div>
57
+ <div class="welcome-panel-column" style="width:250px !important;">
58
+ <h4 class="welcome-screen-margin"><?php _e("Go Premium", contact_bank); ?></h4>
59
+ <ul>
60
+ <li>
61
+ <a href="http://tech-banker.com/products/wp-contact-bank/" target="_blank" class="welcome-icon">
62
+ <?php _e("Feature", contact_bank); ?>
63
+ </a>
64
+ </li>
65
+ <li>
66
+ <a href="http://tech-banker.com/products/wp-contact-bank/demo/" target="_blank" class="welcome-icon">
67
+ <?php _e("Online Demos", contact_bank); ?>
68
+ </a>
69
+ </li>
70
+ <li>
71
+ <a href="http://tech-banker.com/products/wp-contact-bank/pricing/" target="_blank" class="welcome-icon">
72
+ <?php _e("Pricing Plans", contact_bank); ?>
73
+ </a>
74
+ </li>
75
+ </ul>
76
+ </div>
77
+ <div class="welcome-panel-column" style="width:240px !important;">
78
+ <h4 class="welcome-screen-margin">
79
+ <?php _e("Knowledge Base", contact_bank); ?>
80
+ </h4>
81
+ <ul>
82
+ <li>
83
+ <a href="http://tech-banker.com/forums/forum/contact-bank-support/" target="_blank" class="welcome-icon">
84
+ <?php _e("Support Forum", contact_bank); ?>
85
+ </a>
86
+ </li>
87
+ <li>
88
+ <a href="http://tech-banker.com/products/wp-contact-bank/knowledge-base/" target="_blank" class="welcome-icon">
89
+ <?php _e("FAQ's", contact_bank); ?>
90
+ </a>
91
+ </li>
92
+ <li>
93
+ <a href="http://tech-banker.com/products/renew-premium-support-wp-contact-bank/" target="_blank" class="welcome-icon">
94
+ <?php _e("Renew Premium Support", contact_bank); ?>
95
+ </a>
96
+ </li>
97
+ </ul>
98
+ </div>
99
+ <div class="welcome-panel-column welcome-panel-last" style="width:250px !important;">
100
+ <h4 class="welcome-screen-margin"><?php _e("More Actions", contact_bank); ?></h4>
101
+ <ul>
102
+ <li>
103
+ <a href="http://tech-banker.com/shop/plugin-customization/order-customization-wp-contact-bank/" target="_blank" class="welcome-icon">
104
+ <?php _e("Plugin Customization", contact_bank); ?>
105
+ </a>
106
+ </li>
107
+ <li>
108
+ <a href="admin.php?page=contact_bank_recommended_plugins" class="welcome-icon">
109
+ <?php _e("Recommendations", contact_bank); ?>
110
+ </a>
111
+ </li>
112
+ <li>
113
+ <a href="admin.php?page=contact_bank_other_services" class="welcome-icon">
114
+ <?php _e("Our Other Services", contact_bank); ?>
115
+ </a>
116
+ </li>
117
+ </ul>
118
+ </div>
119
  </div>
120
  </div>
121
  </div>
122
+ <?php
123
+ global $wpdb,$current_user;
124
+ if (is_super_admin())
125
+ {
126
+ $cb_role = "administrator";
127
+ }
128
+ else
129
+ {
130
+ $cb_role = $wpdb->prefix . "capabilities";
131
+ $current_user->role = array_keys($current_user->$cb_role);
132
+ $cb_role = $current_user->role[0];
133
+ }
 
134
 
135
+ switch ($cb_role) {
136
+ case "administrator":
137
+ ?>
138
+ <h2 class="nav-tab-wrapper">
139
+ <a class="nav-tab custom-nav-tab" id="contact_dashboard" href="admin.php?page=contact_dashboard"><?php _e("Dashboard",contact_bank) ;?></a>
140
+ <a class="nav-tab custom-nav-tab" id="contact_short_code" href="admin.php?page=contact_short_code"><?php _e("Short-Codes",contact_bank) ;?></a>
141
+ <a class="nav-tab custom-nav-tab" id="contact_frontend_data" href="admin.php?page=contact_frontend_data"><?php _e("Form Entries",contact_bank) ;?></a>
142
+ <a class="nav-tab custom-nav-tab" id="contact_email" href="admin.php?page=contact_email"><?php _e("Email Settings",contact_bank) ;?></a>
143
+ <a class="nav-tab custom-nav-tab" id="contact_layout_settings" href="admin.php?page=contact_layout_settings"><?php _e("Global Settings",contact_bank) ;?></a>
144
+ <a class="nav-tab custom-nav-tab" id="contact_bank_recommended_plugins" href="admin.php?page=contact_bank_recommended_plugins"><?php _e("Recommendations",contact_bank) ;?></a>
145
+ <a class="nav-tab custom-nav-tab" id="contact_pro_version" href="admin.php?page=contact_pro_version"><?php _e("Premium Editions",contact_bank) ;?></a>
146
+ <a class="nav-tab custom-nav-tab" id="contact_bank_other_services" href="admin.php?page=contact_bank_other_services"><?php _e("Our Other Services",contact_bank) ;?></a>
147
+ </h2>
148
+ <?php
149
+ break;
150
+ case "editor":
151
+ ?>
152
+ <h2 class="nav-tab-wrapper">
153
+ <a class="nav-tab custom-nav-tab" id="contact_dashboard" href="admin.php?page=contact_dashboard"><?php _e("Dashboard",contact_bank) ;?></a>
154
+ <a class="nav-tab custom-nav-tab" id="contact_short_code" href="admin.php?page=contact_short_code"><?php _e("Short-Codes",contact_bank) ;?></a>
155
+ <a class="nav-tab custom-nav-tab" id="contact_frontend_data" href="admin.php?page=contact_frontend_data"><?php _e("Form Entries",contact_bank) ;?></a>
156
+ <a class="nav-tab custom-nav-tab" id="contact_email" href="admin.php?page=contact_email"><?php _e("Email Settings",contact_bank) ;?></a>
157
+ <a class="nav-tab custom-nav-tab" id="contact_layout_settings" href="admin.php?page=contact_layout_settings"><?php _e("Global Settings",contact_bank) ;?></a>
158
+ <a class="nav-tab custom-nav-tab" id="contact_bank_recommended_plugins" href="admin.php?page=contact_bank_recommended_plugins"><?php _e("Recommendations",contact_bank) ;?></a>
159
+ <a class="nav-tab custom-nav-tab" id="contact_pro_version" href="admin.php?page=contact_pro_version"><?php _e("Premium Editions",contact_bank) ;?></a>
160
+ <a class="nav-tab custom-nav-tab" id="contact_bank_other_services" href="admin.php?page=contact_bank_other_services"><?php _e("Our Other Services",contact_bank) ;?></a>
161
+ </h2>
162
+ <?php
163
+ break;
164
+ case "author":
165
+ ?>
166
+ <h2 class="nav-tab-wrapper">
167
+ <a class="nav-tab custom-nav-tab" id="contact_dashboard" href="admin.php?page=contact_dashboard"><?php _e("Dashboard",contact_bank) ;?></a>
168
+ <a class="nav-tab custom-nav-tab" id="contact_short_code" href="admin.php?page=contact_short_code"><?php _e("Short-Codes",contact_bank) ;?></a>
169
+ <a class="nav-tab custom-nav-tab" id="contact_frontend_data" href="admin.php?page=contact_frontend_data"><?php _e("Form Entries",contact_bank) ;?></a>
170
+ <a class="nav-tab custom-nav-tab" id="contact_email" href="admin.php?page=contact_email"><?php _e("Email Settings",contact_bank) ;?></a>
171
+ <a class="nav-tab custom-nav-tab" id="contact_layout_settings" href="admin.php?page=contact_layout_settings"><?php _e("Global Settings",contact_bank) ;?></a>
172
+ <a class="nav-tab custom-nav-tab" id="contact_bank_recommended_plugins" href="admin.php?page=contact_bank_recommended_plugins"><?php _e("Recommendations",contact_bank) ;?></a>
173
+ <a class="nav-tab custom-nav-tab" id="contact_pro_version" href="admin.php?page=contact_pro_version"><?php _e("Premium Editions",contact_bank) ;?></a>
174
+ <a class="nav-tab custom-nav-tab" id="contact_bank_other_services" href="admin.php?page=contact_bank_other_services"><?php _e("Our Other Services",contact_bank) ;?></a>
175
+ </h2>
176
+ <?php
177
+ break;
178
+ }
179
+ if(isset($_GET["page"]) ? esc_attr($_GET["page"]) : "" != "contact_feature_request")
180
+ {
181
  ?>
182
+ <div class="custom-message green" style="display: block;margin-top:30px">
183
+ <div style="padding: 4px 0;">
184
+ <p style="font:12px/1.0em Arial !important;font-weight:bold;">If you don't find any features you were looking for in this Plugin,
185
+ please write us <a target="_self" href="admin.php?page=contact_feature_request">here</a> and we shall try to implement this for you as soon as possible! We are looking forward for your valuable <a target="_self" href="admin.php?page=contact_feature_request">Feedback</a></p>
186
+ </div>
187
+ </div>
 
 
 
 
188
  <?php
189
+ }
190
+ if(in_array($cb_language, $cb_lang))
191
+ {
192
  ?>
193
+ <div class="custom-message red" style="display: block;margin-top:10px">
194
+ <span style="padding: 4px 0;">
195
+ <strong><p style="font:12px/1.0em Arial !important;">This plugin language is translated with the help of Google Translator.</p>
196
+ <p style="font:12px/1.0em Arial !important;">If you would like to translate & help us, we will reward you with a free Eco Edition License of Contact Bank.</p>
197
+ <p style="font:12px/1.0em Arial !important;">Contact Us at <a target="_blank" href="http://tech-banker.com">http://tech-banker.com</a> or email us at <a href="mailto:support@tech-banker.com">support@tech-banker.com</a></p>
198
+ </strong>
199
+ </span>
200
+ </div>
 
 
201
  <?php
202
+ }
203
+ elseif(!(in_array($cb_language, $cb_lang_translated_languages)) && !(in_array($cb_language, $cb_lang)) && $cb_language != "")
204
+ {
205
  ?>
206
+ <div class="custom-message red" style="display: block;margin-top:10px">
207
+ <span style="padding: 4px 0;">
208
+ <strong><p style="font:12px/1.0em Arial !important;">If you would like to translate Contact Bank in your native language, we will reward you with a free Eco Edition License of Contact Bank.</p>
209
+ <p style="font:12px/1.0em Arial !important;">Contact Us at <a target="_blank" href="http://tech-banker.com">http://tech-banker.com</a> or email us at <a href="mailto:support@tech-banker.com">support@tech-banker.com</a></p>
210
+ </strong>
211
+ </span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  </div>
213
+ <?php
214
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  ?>
216
+ <div class="custom-message red" style="display: block;margin-top:10px;">
217
+ <span>
218
+ <strong>You are only allowed to add 2 Forms. Kindly purchase Premium Editions for full access.</strong>
219
+ </span>
 
 
220
  </div>
221
  <?php
222
  }
223
  ?>
 
 
 
 
 
views/includes_common_after.php CHANGED
@@ -1,497 +1,522 @@
1
-
2
- <div class="white_content" id="setting_controls_postback">
3
- </div>
4
- <div class="black_overlay"></div>
5
- <script type="text/javascript">
6
- var array_form_settings = [];
7
- var field_dynamic_id = [];
8
- var array_delete_form_controls = [];
9
- var form_id = "<?php echo $form_id;?>";
10
- jQuery(document).ready(function()
11
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- jQuery(window).resize(function()
14
- {
15
- var windowHeight = window.innerHeight - 200;
16
- var windowWidth = window.innerWidth - 200;
17
- var lightboxHeight = jQuery("#setting_controls_postback").height();
18
- var lightboxWidth = jQuery("#setting_controls_postback").width();
19
- var proposedTop = (window.innerHeight - lightboxHeight - 40) / 2 ;
20
- var proposedLeft = (window.innerWidth - lightboxWidth - 40) / 2 ;
21
- jQuery("#setting_controls_postback").css("top",proposedTop + "px");
22
- jQuery("#setting_controls_postback").css("left",proposedLeft + "px");
23
- });
24
 
25
- jQuery("#left_block").sortable
26
- ({
27
- opacity: 0.6,
28
- cursor: "move",
29
- update: function()
30
- {
31
 
32
- var field_dynamic_id = [];
33
- var order = jQuery("#left_block").sortable("toArray");
34
- for(var flag=0;flag<order.length;flag++)
35
- {
36
- var field_order_str = order[flag].split("div_");
37
- field_dynamic_id.push(field_order_str[1].split("_")[0]);
38
- }
39
- jQuery.post(ajaxurl,"form_id="+form_id+"&field_dynamic_id="+JSON.stringify(field_dynamic_id)+"&param=form_fields_sorting_order&action=add_contact_form_library", function(data)
40
- {
41
- });
42
- }
43
- });
44
- show_url_control();
45
- });
46
- if (typeof(enter_admin_label) != "function")
47
- {
48
- function enter_admin_label(dynamicId)
49
  {
50
- var ux_label = jQuery("#ux_label_text_"+dynamicId).val();
51
- jQuery("#ux_admin_label_"+dynamicId).val(ux_label);
 
 
 
52
  }
53
- }
54
- if (typeof(delete_textbox) != "function")
55
- {
56
- function delete_textbox(dynamicId,control_type,control_id)
57
  {
58
- array_delete_form_controls.push(control_id);
59
- jQuery("#div_"+dynamicId+"_"+control_type).remove();
 
 
 
 
60
  }
61
- }
62
- if (typeof(add_settings) != "function")
63
- {
64
- function add_settings(dynamicId,field_type)
65
  {
66
- jQuery.post(ajaxurl, "form_id="+form_id+"&dynamicId="+dynamicId+"&field_type="+field_type+"&param=add_settings_div&action=add_contact_form_library", function(data)
67
- {
68
- jQuery("#setting_controls_postback").html(data);
69
- show_Popup();
70
- });
 
 
 
71
  }
72
- }
73
- if (typeof(show_Popup) != "function")
74
- {
75
- function show_Popup()
76
  {
77
- jQuery(".black_overlay").css("display","block");
78
- jQuery(".white_content").css("display","block");
79
- var windowHeight = window.innerHeight - 200;
80
- var windowWidth = window.innerWidth - 200;
81
- var anchor = jQuery("<a class=\"closeButtonLightbox\" onclick=\"CloseLightbox();\"></a>");
82
- jQuery("#setting_controls_postback").append(anchor);
83
- var lightboxHeight = jQuery("#setting_controls_postback").height();
84
- var lightboxWidth = jQuery("#setting_controls_postback").width();
85
- var proposedTop = (window.innerHeight - lightboxHeight - 40) / 2 ;
86
- var proposedLeft = (window.innerWidth - lightboxWidth - 40) / 2 ;
87
- jQuery("#setting_controls_postback").css("top",proposedTop + "px");
88
- jQuery("#setting_controls_postback").css("left",proposedLeft + "px");
89
- jQuery("#setting_controls_postback").fadeIn(200);
 
 
 
90
  }
91
- }
92
- if (typeof(CloseLightbox) != "function")
93
- {
94
- function CloseLightbox()
95
  {
96
- jQuery("#setting_controls_postback").css("display","none");
97
- jQuery(".black_overlay").css("display","none");
98
- jQuery("#fade").fadeOut(200);
 
 
 
99
  }
100
- }
101
- if (typeof(show_url_control) != "function")
102
- {
103
- function show_url_control()
104
  {
105
- if(jQuery("#ux_rdl_page").prop("checked") == true)
106
- {
107
- jQuery("#div_url").hide();
108
- jQuery("#div_page").show();
109
- }
110
- else
111
- {
112
- jQuery("#div_page").hide();
113
- jQuery("#div_url").show();
114
- }
 
 
 
115
  }
116
- }
117
- if (typeof(create_control) != "function")
118
- {
119
- function create_control(control_type,dynamicId,type)
120
  {
 
 
121
 
122
- dynamicId = typeof dynamicId !== "undefined" ? dynamicId : Math.floor((Math.random()*100000)+1);
123
- switch(parseInt(control_type))
124
- {
125
- case 1:
126
- jQuery("#div_1_1").clone(false).attr("id","div_"+dynamicId+"_1").appendTo("#left_block");
127
- jQuery("#div_"+dynamicId+"_1").children("label").attr("id","control_label_"+dynamicId);
128
- jQuery("#div_"+dynamicId+"_1").children("div").attr("id","show_tooltip"+dynamicId);
129
- jQuery("#show_tooltip"+dynamicId ).children("input[type=\"text\"]").attr("id","ux_txt_textbox_control_"+dynamicId);
130
- jQuery("#show_tooltip"+dynamicId ).children("input[type=\"text\"]").attr("name","ux_txt_textbox_control_"+dynamicId);
131
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
132
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",1)");
133
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
134
- jQuery("#show_tooltip"+dynamicId).children("span").attr("id","txt_description_"+dynamicId);
135
- jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_text_control_tooltip_"+dynamicId).css("display","none");
136
- jQuery("#show_tooltip"+dynamicId).children("div:eq(1)").attr("id","ux_text_control_placeholder_"+dynamicId).css("display","none");
137
 
138
- jQuery("#div_"+dynamicId+"_1").attr("style","display:block");
139
- jQuery(".hovertip").tooltip_tip({placement: "left"});
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
- if(typeof type == "undefined")
142
- {
143
- jQuery.post(ajaxurl,
144
- {
145
- ux_hd_textbox_dynamic_id: dynamicId,
146
- form_id: form_id,
147
- events: "add",
148
- param: "save_text_control",
149
- action: "add_contact_form_library",
150
- },
151
- function(data)
152
- {
153
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",1,"+data+");");
154
- });
155
- }
156
- else
157
- {
158
 
159
- jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
160
- {
161
- var bind_data = JSON.parse(data);
162
- jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
163
- jQuery("#txt_description_"+dynamicId).html(bind_data[dynamicId].cb_description);
164
 
165
- jQuery("#ux_text_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
166
- jQuery("#ux_text_control_placeholder_"+dynamicId).html(bind_data[dynamicId].cb_default_txt_val);
167
- jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_text_control_tooltip_"+dynamicId).text());
168
- jQuery("#ux_txt_textbox_control_"+dynamicId).attr("placeholder",jQuery("#ux_text_control_placeholder_"+dynamicId).text());
169
- if(bind_data[dynamicId].cb_control_required == "1")
170
- {
171
- jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
172
- }
173
- var control_id = bind_data[dynamicId].control_id;
174
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
175
- });
176
- }
177
- break;
178
- case 2:
179
- jQuery("#div_2_2").clone(false).attr("id","div_"+dynamicId+"_2").appendTo("#left_block");
180
- jQuery("#div_"+dynamicId+"_2").children("label").attr("id","control_label_"+dynamicId);
181
- jQuery("#div_"+dynamicId+"_2").children("div").attr("id","show_tooltip"+dynamicId);
182
- jQuery("#show_tooltip"+dynamicId ).children("textarea[type=\"textarea\"]").attr("id","ux_textarea_control_"+dynamicId);
183
- jQuery("#show_tooltip"+dynamicId ).children("textarea[type=\"textarea\"]").attr("name","ux_textarea_control_"+dynamicId);
184
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
185
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",2)");
186
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
187
- jQuery("#show_tooltip"+dynamicId).children("span").attr("id","txt_description_"+dynamicId);
188
- jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_txtarea_control_tooltip_"+dynamicId).css("display","none");
189
- jQuery("#show_tooltip"+dynamicId).children("div:eq(1)").attr("id","ux_txtarea_control_placeholder_"+dynamicId).css("display","none");
190
 
191
- jQuery("#div_"+dynamicId+"_2").attr("style","display:block");
192
- jQuery(".hovertip").tooltip_tip({placement: "left"});
193
- if(typeof type == "undefined")
194
- {
195
- jQuery.post(ajaxurl,
196
- {
197
- ux_hd_textbox_dynamic_id: dynamicId,
198
- form_id: form_id,
199
- events: "add",
200
- param: "save_textarea_control",
201
- action: "add_contact_form_library",
202
- },
203
- function(data)
204
- {
205
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",2,"+data+");");
206
- });
207
- }
208
- else
209
- {
210
- jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
211
- {
212
- var bind_data = JSON.parse(data);
213
- jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
214
- jQuery("#txt_description_"+dynamicId).html(bind_data[dynamicId].cb_description);
215
 
216
- jQuery("#ux_txtarea_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
217
- jQuery("#ux_txtarea_control_placeholder_"+dynamicId).html(bind_data[dynamicId].cb_default_txt_val);
218
 
219
- jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_txtarea_control_tooltip_"+dynamicId).text());
220
- jQuery("#ux_textarea_control_"+dynamicId).attr("placeholder",jQuery("#ux_txtarea_control_placeholder_"+dynamicId).text());
221
 
222
- if(bind_data[dynamicId].cb_control_required == "1")
223
- {
224
- jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
225
- }
226
- var control_id = bind_data[dynamicId].control_id;
227
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
228
- });
229
- }
230
- break;
231
- case 3:
232
- jQuery("#div_3_3").clone(false).attr("id","div_"+dynamicId+"_3").appendTo("#left_block");
233
- jQuery("#div_"+dynamicId+"_3").children("label").attr("id","control_label_"+dynamicId);
234
- jQuery("#div_"+dynamicId+"_3").children("div").attr("id","show_tooltip"+dynamicId);
235
- jQuery("#show_tooltip"+dynamicId).children("input[type=\"text\"]").attr("id","ux_txt_email_"+dynamicId);
236
- jQuery("#show_tooltip"+dynamicId).children("input[type=\"text\"]").attr("name","ux_txt_email_"+dynamicId);
237
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
238
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",3)");
239
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
240
- jQuery("#show_tooltip"+dynamicId).children("span").attr("id","txt_description_"+dynamicId);
241
- jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_email_control_tooltip_"+dynamicId).css("display","none");
242
- jQuery("#show_tooltip"+dynamicId).children("div:eq(1)").attr("id","ux_email_control_placeholder_"+dynamicId).css("display","none");
243
- jQuery("#div_"+dynamicId+"_3").attr("style","display:block");
244
- jQuery(".hovertip").tooltip_tip({placement: "left"});
245
- if(typeof type == "undefined")
246
- {
247
- jQuery.post(ajaxurl,
248
- {
249
- ux_hd_textbox_dynamic_id: dynamicId,
250
- form_id: form_id,
251
- events: "add",
252
- param: "save_email_control",
253
- action: "add_contact_form_library",
254
- },
255
- function(data)
256
- {
257
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",3,"+data+");");
258
- });
259
- }
260
- else
261
- {
262
- jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
263
- {
264
- var bind_data = JSON.parse(data);
265
- jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
266
- jQuery("#txt_description_"+dynamicId).html(bind_data[dynamicId].cb_description);
267
 
268
- jQuery("#ux_email_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
269
- jQuery("#ux_email_control_placeholder_"+dynamicId).html(bind_data[dynamicId].cb_default_txt_val);
270
- jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_email_control_tooltip_"+dynamicId).text());
271
- jQuery("#ux_txt_email_"+dynamicId).attr("placeholder",jQuery("#ux_email_control_placeholder_"+dynamicId).text());
272
 
273
- if(bind_data[dynamicId].cb_control_required == "1")
274
- {
275
- jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
276
- }
277
- var control_id = bind_data[dynamicId].control_id;
278
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
279
- });
280
- }
281
- break;
282
- case 4:
283
- jQuery("#div_4_4").clone(false).attr("id","div_"+dynamicId+"_4").appendTo("#left_block");
284
- jQuery("#div_"+dynamicId+"_4").children("label").attr("id","control_label_"+dynamicId);
285
- jQuery("#div_"+dynamicId+"_4").children("div").attr("id","show_tooltip"+dynamicId);
286
- jQuery("#show_tooltip"+dynamicId ).children("select[type=\"select\"]").attr("id","ux_ddl_select_control"+dynamicId);
287
- jQuery("#show_tooltip"+dynamicId ).children("select[type=\"select\"]").attr("name","ux_ddl_select_control"+dynamicId);
288
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
289
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",4)");
290
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
291
- jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_ddl_control_tooltip_"+dynamicId).css("display","none");
292
- jQuery("#div_"+dynamicId+"_4").attr("style","display:block");
293
- jQuery(".hovertip").tooltip_tip({placement: "left"});
294
- if(typeof type == "undefined")
295
- {
296
- jQuery.post(ajaxurl,
297
- {
298
- ux_hd_textbox_dynamic_id: dynamicId,
299
- form_id: form_id,
300
- events: "add",
301
- param: "save_drop_down_control",
302
- action: "add_contact_form_library",
303
- },
304
- function(data)
305
- {
306
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",4,"+data+");");
307
- });
308
- }
309
- else
310
- {
311
- jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
312
- {
313
- var bind_data = JSON.parse(data);
314
- jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
315
- jQuery("#ux_ddl_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
316
- jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_ddl_control_tooltip_"+dynamicId).text());
317
- if(bind_data[dynamicId].cb_control_required == "1")
318
- {
319
- jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
320
- }
321
- var bind_data_list = bind_data[dynamicId].cb_dropdown_option_id;
322
- for(var flag = 0; flag<bind_data_list.length;flag++)
323
- {
324
- jQuery("#ux_ddl_select_control"+dynamicId).append("<option value=\""+bind_data_list[flag]+"\">"+bind_data[dynamicId].cb_dropdown_option_val[flag]+"</option>");
325
- }
326
- var control_id = bind_data[dynamicId].control_id;
327
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
328
- });
329
- }
330
- break;
331
- case 5:
332
- jQuery("#div_5_5").clone(false).attr("id","div_"+dynamicId+"_5").appendTo("#left_block");
333
- jQuery("#div_"+dynamicId+"_5").children("label").attr("id","control_label_"+dynamicId);
334
- jQuery("#div_"+dynamicId+"_5").children("div").attr("id","post_back_checkbox_"+dynamicId);
335
- jQuery("#post_back_checkbox_"+dynamicId).children("div").attr("id","show_tooltip"+dynamicId);
336
- jQuery("#show_tooltip"+dynamicId ).children("input[type=\"checkbox\"]").attr("id","ux_chk_checkbox_control_"+dynamicId);
337
- jQuery("#show_tooltip"+dynamicId ).children("input[type=\"checkbox\"]").attr("name","ux_chk_checkbox_control_"+dynamicId);
338
- jQuery("#show_tooltip"+dynamicId ).children("span").attr("id","add_chk_options_here_"+dynamicId);
339
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
340
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",5)");
341
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
342
- jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_chk_control_tooltip_"+dynamicId).css("display","none");
343
- jQuery("#div_"+dynamicId+"_5").attr("style","display:block");
344
- jQuery(".hovertip").tooltip_tip({placement: "left"});
345
- if(typeof type == "undefined")
346
- {
347
- jQuery.post(ajaxurl,
348
- {
349
- ux_hd_textbox_dynamic_id: dynamicId,
350
- form_id: form_id,
351
- events: "add",
352
- param: "save_check_box_control",
353
- action: "add_contact_form_library",
354
- },
355
- function(data)
356
- {
357
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",5,"+data+");");
358
- });
359
- }
360
- else
361
- {
362
- jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
363
- {
364
- var bind_data = JSON.parse(data);
365
- jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
366
- jQuery("#ux_chk_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
367
- jQuery("#post_back_checkbox_"+dynamicId).attr("data-original-title",jQuery("#ux_chk_control_tooltip_"+dynamicId).text());
368
- if(bind_data[dynamicId].cb_control_required == "1")
369
- {
370
- jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
371
- }
372
- var bind_chk_list = bind_data[dynamicId].cb_checkbox_option_id;
373
- for(var flag = 0; flag<bind_chk_list.length;flag++)
374
- {
375
- jQuery("#ux_chk_checkbox_control_"+dynamicId).hide();
376
- jQuery("#add_chk_options_here_"+dynamicId).append("<span id=\"input_id_"+bind_chk_list[flag]+"\"><input id=\"ux_chk_checkbox_control_"+bind_chk_list[flag]+"\" name=\"ux_chk_checkbox_control_"+bind_chk_list[flag]+"\" type=\"checkbox\"/><label class=\"rdl\">"+bind_data[dynamicId].cb_checkbox_option_val[flag]+"</label></span>");
377
- }
378
- var control_id = bind_data[dynamicId].control_id;
379
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
380
- });
381
- }
382
- break;
383
- case 6:
384
- jQuery("#div_6_6").clone(false).attr("id","div_"+dynamicId+"_6").appendTo("#left_block");
385
- jQuery("#div_"+dynamicId+"_6").children("label").attr("id","control_label_"+dynamicId);
386
- jQuery("#div_"+dynamicId+"_6").children("div").attr("id","post_back_radio_button_"+dynamicId);
387
- jQuery("#post_back_radio_button_"+dynamicId).children("div").attr("id","show_tooltip"+dynamicId);
388
- jQuery("#show_tooltip"+dynamicId ).children("input[type=\"radio\"]").attr("id","ux_radio_button_control_"+dynamicId);
389
- jQuery("#show_tooltip"+dynamicId ).children("input[type=\"radio\"]").attr("name","ux_radio_button_control_"+dynamicId);
390
- jQuery("#show_tooltip"+dynamicId ).children("span").attr("id","add_radio_options_here_"+dynamicId);
391
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
392
- jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",6)");
393
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
394
- jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_rdl_control_tooltip_"+dynamicId).css("display","none");
395
- jQuery("#div_"+dynamicId+"_6").attr("style","display:block");
396
- jQuery(".hovertip").tooltip_tip({placement: "left"});
397
- if(typeof type == "undefined")
398
- {
399
- jQuery.post(ajaxurl,
400
- {
401
- ux_hd_textbox_dynamic_id: dynamicId,
402
- form_id: form_id,
403
- events: "add",
404
- param: "save_multiple_control",
405
- action: "add_contact_form_library",
406
- },
407
- function(data)
408
- {
409
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",6,"+data+");");
410
- });
411
- }
412
- else
413
- {
414
- jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
415
- {
416
 
417
- var bind_data = JSON.parse(data);
418
- jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
419
- jQuery("#ux_rdl_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
420
- jQuery("#post_back_radio_button_"+dynamicId).attr("data-original-title",jQuery("#ux_rdl_control_tooltip_"+dynamicId).text());
421
 
422
- if(bind_data[dynamicId].cb_control_required == "1")
423
- {
424
- jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
425
- }
426
- var bind_rdl_list = bind_data[dynamicId].cb_radio_option_id;
427
- for(var flag = 0; flag<bind_rdl_list.length;flag++)
428
- {
429
- jQuery("#ux_radio_button_control_"+dynamicId).hide();
430
- jQuery("#add_radio_options_here_"+dynamicId).append("<span id=\"input_id_"+bind_rdl_list[flag]+"\"><input id=\"ux_radio_button_control_"+bind_rdl_list[flag]+"\" name=\"ux_radio"+dynamicId+"\" type=\"radio\"/><label class=\"rdl\">"+bind_data[dynamicId].cb_radio_option_val[flag]+"</label></span>");
431
- if(flag == 0)
432
- {
433
- jQuery("#ux_radio_button_control_"+bind_rdl_list[flag]).attr("checked","checked");
434
- }
435
- }
436
- var control_id = bind_data[dynamicId].control_id;
437
- jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
438
- });
439
- }
440
- break;
441
- case 7:
442
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
443
- break;
444
- case 8:
445
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
446
- break;
447
- case 9:
448
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
449
- break;
450
- case 10:
451
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
452
- break;
453
- case 11:
454
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
455
- break;
456
- case 12:
457
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
458
- break;
459
- case 13:
460
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
461
- break;
462
- case 15:
463
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
464
- break;
465
- case 16:
466
- alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
467
- break;
468
- }
 
469
  }
470
- }
471
- <?php
472
- $form_data = $wpdb->get_results
473
- (
474
- $wpdb->prepare
475
- (
476
- "SELECT * FROM " .create_control_Table(). " where form_id= %d order by sorting_order asc",
477
- $form_id
478
- )
479
- );
480
- for($flag = 0; $flag < count($form_data);$flag++)
481
- {
482
- ?>
483
- create_control(<?php echo $form_data[$flag]->field_id;?>,<?php echo $form_data[$flag]->column_dynamicId;?>,"edit");
484
- <?php
485
- }
486
- ?>
487
- if (typeof(prevent_paste) != "function")
488
- {
489
- function prevent_paste(control_id)
490
  {
491
- jQuery("#"+control_id).live("paste",function(e)
492
- {
493
- e.preventDefault();
494
- });
495
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  }
497
- </script>
1
+ <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
+ switch($cb_role)
 
 
 
 
 
 
 
4
  {
5
+ case "administrator":
6
+ $cb_user_role_permission = "manage_options";
7
+ break;
8
+ case "editor":
9
+ $cb_user_role_permission = "publish_pages";
10
+ break;
11
+ case "author":
12
+ $cb_user_role_permission = "publish_posts";
13
+ break;
14
+ }
15
+ if (!current_user_can($cb_user_role_permission))
16
+ {
17
+ return;
18
+ }
19
+ else
20
+ {
21
+ ?>
22
+ <div class="white_content" id="setting_controls_postback">
23
+ </div>
24
+ <div class="black_overlay"></div>
25
+ <script type="text/javascript">
26
+ var array_form_settings = [];
27
+ var field_dynamic_id = [];
28
+ var array_delete_form_controls = [];
29
+ var form_id = "<?php echo $form_id;?>";
30
+ jQuery(document).ready(function()
31
+ {
32
 
33
+ jQuery(window).resize(function()
34
+ {
35
+ var windowHeight = window.innerHeight - 200;
36
+ var windowWidth = window.innerWidth - 200;
37
+ var lightboxHeight = jQuery("#setting_controls_postback").height();
38
+ var lightboxWidth = jQuery("#setting_controls_postback").width();
39
+ var proposedTop = (window.innerHeight - lightboxHeight - 40) / 2 ;
40
+ var proposedLeft = (window.innerWidth - lightboxWidth - 40) / 2 ;
41
+ jQuery("#setting_controls_postback").css("top",proposedTop + "px");
42
+ jQuery("#setting_controls_postback").css("left",proposedLeft + "px");
43
+ });
44
 
45
+ jQuery("#left_block").sortable
46
+ ({
47
+ opacity: 0.6,
48
+ cursor: "move",
49
+ update: function()
50
+ {
51
 
52
+ var field_dynamic_id = [];
53
+ var order = jQuery("#left_block").sortable("toArray");
54
+ for(var flag=0;flag<order.length;flag++)
55
+ {
56
+ var field_order_str = order[flag].split("div_");
57
+ field_dynamic_id.push(field_order_str[1].split("_")[0]);
58
+ }
59
+ jQuery.post(ajaxurl,"form_id="+form_id+"&field_dynamic_id="+JSON.stringify(field_dynamic_id)+"&param=form_fields_sorting_order&action=add_contact_form_library", function(data)
60
+ {
61
+ });
62
+ }
63
+ });
64
+ show_url_control();
65
+ });
66
+ if (typeof(enter_admin_label) != "function")
 
 
67
  {
68
+ function enter_admin_label(dynamicId)
69
+ {
70
+ var ux_label = jQuery("#ux_label_text_"+dynamicId).val();
71
+ jQuery("#ux_admin_label_"+dynamicId).val(ux_label);
72
+ }
73
  }
74
+ if (typeof(delete_textbox) != "function")
 
 
 
75
  {
76
+ function delete_textbox(dynamicId,control_type,control_id)
77
+ {
78
+ array_delete_form_controls.push(control_id);
79
+ jQuery("#div_"+dynamicId+"_"+control_type).remove();
80
+
81
+ }
82
  }
83
+ if (typeof(add_settings) != "function")
 
 
 
84
  {
85
+ function add_settings(dynamicId,field_type)
86
+ {
87
+ jQuery.post(ajaxurl, "form_id="+form_id+"&dynamicId="+dynamicId+"&field_type="+field_type+"&param=add_settings_div&action=add_contact_form_library", function(data)
88
+ {
89
+ jQuery("#setting_controls_postback").html(data);
90
+ show_Popup();
91
+ });
92
+ }
93
  }
94
+ if (typeof(show_Popup) != "function")
 
 
 
95
  {
96
+ function show_Popup()
97
+ {
98
+ jQuery(".black_overlay").css("display","block");
99
+ jQuery(".white_content").css("display","block");
100
+ var windowHeight = window.innerHeight - 200;
101
+ var windowWidth = window.innerWidth - 200;
102
+ var anchor = jQuery("<a class=\"closeButtonLightbox\" onclick=\"CloseLightbox();\"></a>");
103
+ jQuery("#setting_controls_postback").append(anchor);
104
+ var lightboxHeight = jQuery("#setting_controls_postback").height();
105
+ var lightboxWidth = jQuery("#setting_controls_postback").width();
106
+ var proposedTop = (window.innerHeight - lightboxHeight - 40) / 2 ;
107
+ var proposedLeft = (window.innerWidth - lightboxWidth - 40) / 2 ;
108
+ jQuery("#setting_controls_postback").css("top",proposedTop + "px");
109
+ jQuery("#setting_controls_postback").css("left",proposedLeft + "px");
110
+ jQuery("#setting_controls_postback").fadeIn(200);
111
+ }
112
  }
113
+ if (typeof(CloseLightbox) != "function")
 
 
 
114
  {
115
+ function CloseLightbox()
116
+ {
117
+ jQuery("#setting_controls_postback").css("display","none");
118
+ jQuery(".black_overlay").css("display","none");
119
+ jQuery("#fade").fadeOut(200);
120
+ }
121
  }
122
+ if (typeof(show_url_control) != "function")
 
 
 
123
  {
124
+ function show_url_control()
125
+ {
126
+ if(jQuery("#ux_rdl_page").prop("checked") == true)
127
+ {
128
+ jQuery("#div_url").hide();
129
+ jQuery("#div_page").show();
130
+ }
131
+ else
132
+ {
133
+ jQuery("#div_page").hide();
134
+ jQuery("#div_url").show();
135
+ }
136
+ }
137
  }
138
+ if (typeof(create_control) != "function")
 
 
 
139
  {
140
+ function create_control(control_type,dynamicId,type)
141
+ {
142
 
143
+ dynamicId = typeof dynamicId !== "undefined" ? dynamicId : Math.floor((Math.random()*100000)+1);
144
+ switch(parseInt(control_type))
145
+ {
146
+ case 1:
147
+ jQuery("#div_1_1").clone(false).attr("id","div_"+dynamicId+"_1").appendTo("#left_block");
148
+ jQuery("#div_"+dynamicId+"_1").children("label").attr("id","control_label_"+dynamicId);
149
+ jQuery("#div_"+dynamicId+"_1").children("div").attr("id","show_tooltip"+dynamicId);
150
+ jQuery("#show_tooltip"+dynamicId ).children("input[type=\"text\"]").attr("id","ux_txt_textbox_control_"+dynamicId);
151
+ jQuery("#show_tooltip"+dynamicId ).children("input[type=\"text\"]").attr("name","ux_txt_textbox_control_"+dynamicId);
152
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
153
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",1)");
154
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
155
+ jQuery("#show_tooltip"+dynamicId).children("span").attr("id","txt_description_"+dynamicId);
156
+ jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_text_control_tooltip_"+dynamicId).css("display","none");
157
+ jQuery("#show_tooltip"+dynamicId).children("div:eq(1)").attr("id","ux_text_control_placeholder_"+dynamicId).css("display","none");
158
 
159
+ jQuery("#div_"+dynamicId+"_1").attr("style","display:block");
160
+ jQuery(".hovertip").tooltip_tip({placement: "left"});
161
+
162
+ if(typeof type == "undefined")
163
+ {
164
+ jQuery.post(ajaxurl,
165
+ {
166
+ ux_hd_textbox_dynamic_id: dynamicId,
167
+ form_id: form_id,
168
+ events: "add",
169
+ param: "save_text_control",
170
+ action: "add_contact_form_library",
171
+ },
172
+ function(data)
173
+ {
174
 
175
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",1,"+data+");");
176
+ });
177
+ }
178
+ else
179
+ {
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
+ jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
182
+ {
183
+ var bind_data = JSON.parse(data);
184
+ jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
185
+ jQuery("#txt_description_"+dynamicId).html(bind_data[dynamicId].cb_description);
186
 
187
+ jQuery("#ux_text_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
188
+ jQuery("#ux_text_control_placeholder_"+dynamicId).html(bind_data[dynamicId].cb_default_txt_val);
189
+ jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_text_control_tooltip_"+dynamicId).text());
190
+ jQuery("#ux_txt_textbox_control_"+dynamicId).attr("placeholder",jQuery("#ux_text_control_placeholder_"+dynamicId).text());
191
+ if(bind_data[dynamicId].cb_control_required == "1")
192
+ {
193
+ jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
194
+ }
195
+ var control_id = bind_data[dynamicId].control_id;
196
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
197
+ });
198
+ }
199
+ break;
200
+ case 2:
201
+ jQuery("#div_2_2").clone(false).attr("id","div_"+dynamicId+"_2").appendTo("#left_block");
202
+ jQuery("#div_"+dynamicId+"_2").children("label").attr("id","control_label_"+dynamicId);
203
+ jQuery("#div_"+dynamicId+"_2").children("div").attr("id","show_tooltip"+dynamicId);
204
+ jQuery("#show_tooltip"+dynamicId ).children("textarea[type=\"textarea\"]").attr("id","ux_textarea_control_"+dynamicId);
205
+ jQuery("#show_tooltip"+dynamicId ).children("textarea[type=\"textarea\"]").attr("name","ux_textarea_control_"+dynamicId);
206
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
207
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",2)");
208
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
209
+ jQuery("#show_tooltip"+dynamicId).children("span").attr("id","txt_description_"+dynamicId);
210
+ jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_txtarea_control_tooltip_"+dynamicId).css("display","none");
211
+ jQuery("#show_tooltip"+dynamicId).children("div:eq(1)").attr("id","ux_txtarea_control_placeholder_"+dynamicId).css("display","none");
212
 
213
+ jQuery("#div_"+dynamicId+"_2").attr("style","display:block");
214
+ jQuery(".hovertip").tooltip_tip({placement: "left"});
215
+ if(typeof type == "undefined")
216
+ {
217
+ jQuery.post(ajaxurl,
218
+ {
219
+ ux_hd_textbox_dynamic_id: dynamicId,
220
+ form_id: form_id,
221
+ events: "add",
222
+ param: "save_textarea_control",
223
+ action: "add_contact_form_library",
224
+ },
225
+ function(data)
226
+ {
227
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",2,"+data+");");
228
+ });
229
+ }
230
+ else
231
+ {
232
+ jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
233
+ {
234
+ var bind_data = JSON.parse(data);
235
+ jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
236
+ jQuery("#txt_description_"+dynamicId).html(bind_data[dynamicId].cb_description);
237
 
238
+ jQuery("#ux_txtarea_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
239
+ jQuery("#ux_txtarea_control_placeholder_"+dynamicId).html(bind_data[dynamicId].cb_default_txt_val);
240
 
241
+ jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_txtarea_control_tooltip_"+dynamicId).text());
242
+ jQuery("#ux_textarea_control_"+dynamicId).attr("placeholder",jQuery("#ux_txtarea_control_placeholder_"+dynamicId).text());
243
 
244
+ if(bind_data[dynamicId].cb_control_required == "1")
245
+ {
246
+ jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
247
+ }
248
+ var control_id = bind_data[dynamicId].control_id;
249
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
250
+ });
251
+ }
252
+ break;
253
+ case 3:
254
+ jQuery("#div_3_3").clone(false).attr("id","div_"+dynamicId+"_3").appendTo("#left_block");
255
+ jQuery("#div_"+dynamicId+"_3").children("label").attr("id","control_label_"+dynamicId);
256
+ jQuery("#div_"+dynamicId+"_3").children("div").attr("id","show_tooltip"+dynamicId);
257
+ jQuery("#show_tooltip"+dynamicId).children("input[type=\"text\"]").attr("id","ux_txt_email_"+dynamicId);
258
+ jQuery("#show_tooltip"+dynamicId).children("input[type=\"text\"]").attr("name","ux_txt_email_"+dynamicId);
259
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
260
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",3)");
261
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
262
+ jQuery("#show_tooltip"+dynamicId).children("span").attr("id","txt_description_"+dynamicId);
263
+ jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_email_control_tooltip_"+dynamicId).css("display","none");
264
+ jQuery("#show_tooltip"+dynamicId).children("div:eq(1)").attr("id","ux_email_control_placeholder_"+dynamicId).css("display","none");
265
+ jQuery("#div_"+dynamicId+"_3").attr("style","display:block");
266
+ jQuery(".hovertip").tooltip_tip({placement: "left"});
267
+ if(typeof type == "undefined")
268
+ {
269
+ jQuery.post(ajaxurl,
270
+ {
271
+ ux_hd_textbox_dynamic_id: dynamicId,
272
+ form_id: form_id,
273
+ events: "add",
274
+ param: "save_email_control",
275
+ action: "add_contact_form_library",
276
+ },
277
+ function(data)
278
+ {
279
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",3,"+data+");");
280
+ });
281
+ }
282
+ else
283
+ {
284
+ jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
285
+ {
286
+ var bind_data = JSON.parse(data);
287
+ jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
288
+ jQuery("#txt_description_"+dynamicId).html(bind_data[dynamicId].cb_description);
289
 
290
+ jQuery("#ux_email_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
291
+ jQuery("#ux_email_control_placeholder_"+dynamicId).html(bind_data[dynamicId].cb_default_txt_val);
292
+ jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_email_control_tooltip_"+dynamicId).text());
293
+ jQuery("#ux_txt_email_"+dynamicId).attr("placeholder",jQuery("#ux_email_control_placeholder_"+dynamicId).text());
294
 
295
+ if(bind_data[dynamicId].cb_control_required == "1")
296
+ {
297
+ jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
298
+ }
299
+ var control_id = bind_data[dynamicId].control_id;
300
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
301
+ });
302
+ }
303
+ break;
304
+ case 4:
305
+ jQuery("#div_4_4").clone(false).attr("id","div_"+dynamicId+"_4").appendTo("#left_block");
306
+ jQuery("#div_"+dynamicId+"_4").children("label").attr("id","control_label_"+dynamicId);
307
+ jQuery("#div_"+dynamicId+"_4").children("div").attr("id","show_tooltip"+dynamicId);
308
+ jQuery("#show_tooltip"+dynamicId ).children("select[type=\"select\"]").attr("id","ux_ddl_select_control"+dynamicId);
309
+ jQuery("#show_tooltip"+dynamicId ).children("select[type=\"select\"]").attr("name","ux_ddl_select_control"+dynamicId);
310
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
311
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",4)");
312
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
313
+ jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_ddl_control_tooltip_"+dynamicId).css("display","none");
314
+ jQuery("#div_"+dynamicId+"_4").attr("style","display:block");
315
+ jQuery(".hovertip").tooltip_tip({placement: "left"});
316
+ if(typeof type == "undefined")
317
+ {
318
+ jQuery.post(ajaxurl,
319
+ {
320
+ ux_hd_textbox_dynamic_id: dynamicId,
321
+ form_id: form_id,
322
+ events: "add",
323
+ param: "save_drop_down_control",
324
+ action: "add_contact_form_library",
325
+ },
326
+ function(data)
327
+ {
328
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",4,"+data+");");
329
+ });
330
+ }
331
+ else
332
+ {
333
+ jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
334
+ {
335
+ var bind_data = JSON.parse(data);
336
+ jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
337
+ jQuery("#ux_ddl_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
338
+ jQuery("#show_tooltip"+dynamicId).attr("data-original-title",jQuery("#ux_ddl_control_tooltip_"+dynamicId).text());
339
+ if(bind_data[dynamicId].cb_control_required == "1")
340
+ {
341
+ jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
342
+ }
343
+ var bind_data_list = bind_data[dynamicId].cb_dropdown_option_id;
344
+ for(var flag = 0; flag<bind_data_list.length;flag++)
345
+ {
346
+ jQuery("#ux_ddl_select_control"+dynamicId).append("<option value=\""+bind_data_list[flag]+"\">"+bind_data[dynamicId].cb_dropdown_option_val[flag]+"</option>");
347
+ }
348
+ var control_id = bind_data[dynamicId].control_id;
349
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
350
+ });
351
+ }
352
+ break;
353
+ case 5:
354
+ jQuery("#div_5_5").clone(false).attr("id","div_"+dynamicId+"_5").appendTo("#left_block");
355
+ jQuery("#div_"+dynamicId+"_5").children("label").attr("id","control_label_"+dynamicId);
356
+ jQuery("#div_"+dynamicId+"_5").children("div").attr("id","post_back_checkbox_"+dynamicId);
357
+ jQuery("#post_back_checkbox_"+dynamicId).children("div").attr("id","show_tooltip"+dynamicId);
358
+ jQuery("#show_tooltip"+dynamicId ).children("input[type=\"checkbox\"]").attr("id","ux_chk_checkbox_control_"+dynamicId);
359
+ jQuery("#show_tooltip"+dynamicId ).children("input[type=\"checkbox\"]").attr("name","ux_chk_checkbox_control_"+dynamicId);
360
+ jQuery("#show_tooltip"+dynamicId ).children("span").attr("id","add_chk_options_here_"+dynamicId);
361
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
362
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",5)");
363
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
364
+ jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_chk_control_tooltip_"+dynamicId).css("display","none");
365
+ jQuery("#div_"+dynamicId+"_5").attr("style","display:block");
366
+ jQuery(".hovertip").tooltip_tip({placement: "left"});
367
+ if(typeof type == "undefined")
368
+ {
369
+ jQuery.post(ajaxurl,
370
+ {
371
+ ux_hd_textbox_dynamic_id: dynamicId,
372
+ form_id: form_id,
373
+ events: "add",
374
+ param: "save_check_box_control",
375
+ action: "add_contact_form_library",
376
+ },
377
+ function(data)
378
+ {
379
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",5,"+data+");");
380
+ });
381
+ }
382
+ else
383
+ {
384
+ jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
385
+ {
386
+ var bind_data = JSON.parse(data);
387
+ jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
388
+ jQuery("#ux_chk_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
389
+ jQuery("#post_back_checkbox_"+dynamicId).attr("data-original-title",jQuery("#ux_chk_control_tooltip_"+dynamicId).text());
390
+ if(bind_data[dynamicId].cb_control_required == "1")
391
+ {
392
+ jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
393
+ }
394
+ var bind_chk_list = bind_data[dynamicId].cb_checkbox_option_id;
395
+ for(var flag = 0; flag<bind_chk_list.length;flag++)
396
+ {
397
+ jQuery("#ux_chk_checkbox_control_"+dynamicId).hide();
398
+ jQuery("#add_chk_options_here_"+dynamicId).append("<span id=\"input_id_"+bind_chk_list[flag]+"\"><input id=\"ux_chk_checkbox_control_"+bind_chk_list[flag]+"\" name=\"ux_chk_checkbox_control_"+bind_chk_list[flag]+"\" type=\"checkbox\"/><label class=\"rdl\">"+bind_data[dynamicId].cb_checkbox_option_val[flag]+"</label></span>");
399
+ }
400
+ var control_id = bind_data[dynamicId].control_id;
401
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
402
+ });
403
+ }
404
+ break;
405
+ case 6:
406
+ jQuery("#div_6_6").clone(false).attr("id","div_"+dynamicId+"_6").appendTo("#left_block");
407
+ jQuery("#div_"+dynamicId+"_6").children("label").attr("id","control_label_"+dynamicId);
408
+ jQuery("#div_"+dynamicId+"_6").children("div").attr("id","post_back_radio_button_"+dynamicId);
409
+ jQuery("#post_back_radio_button_"+dynamicId).children("div").attr("id","show_tooltip"+dynamicId);
410
+ jQuery("#show_tooltip"+dynamicId ).children("input[type=\"radio\"]").attr("id","ux_radio_button_control_"+dynamicId);
411
+ jQuery("#show_tooltip"+dynamicId ).children("input[type=\"radio\"]").attr("name","ux_radio_button_control_"+dynamicId);
412
+ jQuery("#show_tooltip"+dynamicId ).children("span").attr("id","add_radio_options_here_"+dynamicId);
413
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("id","add_setting_control_"+dynamicId);
414
+ jQuery("#show_tooltip"+dynamicId).children("a.btn").attr("onclick","add_settings("+dynamicId+",6)");
415
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_").attr("id","anchor_del_"+dynamicId);
416
+ jQuery("#show_tooltip"+dynamicId).children("div:first").attr("id","ux_rdl_control_tooltip_"+dynamicId).css("display","none");
417
+ jQuery("#div_"+dynamicId+"_6").attr("style","display:block");
418
+ jQuery(".hovertip").tooltip_tip({placement: "left"});
419
+ if(typeof type == "undefined")
420
+ {
421
+ jQuery.post(ajaxurl,
422
+ {
423
+ ux_hd_textbox_dynamic_id: dynamicId,
424
+ form_id: form_id,
425
+ events: "add",
426
+ param: "save_multiple_control",
427
+ action: "add_contact_form_library",
428
+ },
429
+ function(data)
430
+ {
431
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+",6,"+data+");");
432
+ });
433
+ }
434
+ else
435
+ {
436
+ jQuery.post(ajaxurl,"form_id="+form_id+"&dynamicId="+dynamicId+"&control_type="+control_type+"&param=bind_text_control&action=show_form_control_data_contact_library", function(data)
437
+ {
438
 
439
+ var bind_data = JSON.parse(data);
440
+ jQuery("#control_label_"+dynamicId).html(bind_data[dynamicId].cb_label_value+" :");
441
+ jQuery("#ux_rdl_control_tooltip_"+dynamicId).html(bind_data[dynamicId].cb_tooltip_txt);
442
+ jQuery("#post_back_radio_button_"+dynamicId).attr("data-original-title",jQuery("#ux_rdl_control_tooltip_"+dynamicId).text());
443
 
444
+ if(bind_data[dynamicId].cb_control_required == "1")
445
+ {
446
+ jQuery("#control_label_"+dynamicId).append("<span class=\"error_field\">*</span>");
447
+ }
448
+ var bind_rdl_list = bind_data[dynamicId].cb_radio_option_id;
449
+ for(var flag = 0; flag<bind_rdl_list.length;flag++)
450
+ {
451
+ jQuery("#ux_radio_button_control_"+dynamicId).hide();
452
+ jQuery("#add_radio_options_here_"+dynamicId).append("<span id=\"input_id_"+bind_rdl_list[flag]+"\"><input id=\"ux_radio_button_control_"+bind_rdl_list[flag]+"\" name=\"ux_radio"+dynamicId+"\" type=\"radio\"/><label class=\"rdl\">"+bind_data[dynamicId].cb_radio_option_val[flag]+"</label></span>");
453
+ if(flag == 0)
454
+ {
455
+ jQuery("#ux_radio_button_control_"+bind_rdl_list[flag]).attr("checked","checked");
456
+ }
457
+ }
458
+ var control_id = bind_data[dynamicId].control_id;
459
+ jQuery("#show_tooltip"+dynamicId).children("#anchor_del_"+dynamicId).attr("onclick","delete_textbox("+dynamicId+","+control_type+","+control_id+");");
460
+ });
461
+ }
462
+ break;
463
+ case 7:
464
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
465
+ break;
466
+ case 8:
467
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
468
+ break;
469
+ case 9:
470
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
471
+ break;
472
+ case 10:
473
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
474
+ break;
475
+ case 11:
476
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
477
+ break;
478
+ case 12:
479
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
480
+ break;
481
+ case 13:
482
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
483
+ break;
484
+ case 15:
485
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
486
+ break;
487
+ case 16:
488
+ alert("<?php _e( "This Feature is only available in Premium Editions!", contact_bank ); ?>");
489
+ break;
490
+ }
491
+ }
492
  }
493
+ <?php
494
+ $form_data = $wpdb->get_results
495
+ (
496
+ $wpdb->prepare
497
+ (
498
+ "SELECT * FROM " .create_control_Table(). " where form_id= %d order by sorting_order asc",
499
+ $form_id
500
+ )
501
+ );
502
+ for($flag = 0; $flag < count($form_data);$flag++)
 
 
 
 
 
 
 
 
 
 
503
  {
504
+ ?>
505
+ create_control(<?php echo $form_data[$flag]->field_id;?>,<?php echo $form_data[$flag]->column_dynamicId;?>,"edit");
506
+ <?php
 
507
  }
508
+ ?>
509
+ if (typeof(prevent_paste) != "function")
510
+ {
511
+ function prevent_paste(control_id)
512
+ {
513
+ jQuery("#"+control_id).live("paste",function(e)
514
+ {
515
+ e.preventDefault();
516
+ });
517
+ }
518
+ }
519
+ </script>
520
+ <?php
521
  }
522
+ ?>
views/other-services.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
@@ -19,7 +20,7 @@ if (!current_user_can($cb_user_role_permission))
19
  else
20
  {
21
  ?>
22
- <div class="fluid-layout" style="width:1000px;">
23
  <div class="layout-span12">
24
  <div class="widget-layout">
25
  <div class="widget-layout-title">
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
20
  else
21
  {
22
  ?>
23
+ <div class="fluid-layout">
24
  <div class="layout-span12">
25
  <div class="widget-layout">
26
  <div class="widget-layout-title">
views/purchase_pro_version.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
@@ -1274,10 +1275,8 @@ else
1274
  </div>
1275
  </div>
1276
  </div>
1277
- <div class="wpb_text_column wpb_content_element ">
1278
- <div class="wpb_wrapper">
1279
- <strong><span style="text-decoration: underline;">NOTE FOR MULTISITE*</span> :</strong> Allows you to use this Plugin with network of sites / Multisites WordPress. But you need to purchase separate license for each Installation / Instance.
1280
- </div>
1281
  </div>
1282
  </div>
1283
  </div>
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
1275
  </div>
1276
  </div>
1277
  </div>
1278
+ <div class="layout-control-group">
1279
+ <strong><span style="text-decoration: underline;">NOTE FOR MULTISITE*</span> :</strong> Allows you to use this Plugin with network of sites / Multisites WordPress. But you need to purchase separate license for each Installation / Instance.
 
 
1280
  </div>
1281
  </div>
1282
  </div>
views/recommended-plugins.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
@@ -80,13 +81,12 @@ else
80
  <div id="post-body" class="metabox-holder">
81
  <div id="postbox-container-2" class="postbox-container">
82
  <div id="advanced" class="meta-box-sortables">
83
- <div id="gallery_bank_get_started" class="postbox" >
84
  <div class="handlediv" data-target="ux_recommendation" title="Click to toggle" data-toggle="collapse"><br></div>
85
  <h3 class="hndle"><span><?php _e("Recommendations", tech_bank); ?></span></h3>
86
  <div class="inside">
87
- <div id="ux_recommendation" class="gallery_bank_layout">
88
- <a class="btn btn-inverse"
89
- href="admin.php?page=gallery_bank"><?php _e("Back to Albums", tech_bank); ?></a>
90
  <div class="separator-doubled"></div>
91
  <div class="fluid-layout">
92
  <div class="layout-span12">
1
  <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":
81
  <div id="post-body" class="metabox-holder">
82
  <div id="postbox-container-2" class="postbox-container">
83
  <div id="advanced" class="meta-box-sortables">
84
+ <div id="contact_bank_get_started" class="postbox" >
85
  <div class="handlediv" data-target="ux_recommendation" title="Click to toggle" data-toggle="collapse"><br></div>
86
  <h3 class="hndle"><span><?php _e("Recommendations", tech_bank); ?></span></h3>
87
  <div class="inside">
88
+ <div id="ux_recommendation" class="contact_bank_layout">
89
+ <a class="btn btn-info" href="admin.php?page=contact_dashboard"><?php _e("Back to Dashboard", contact_bank);?></a>
 
90
  <div class="separator-doubled"></div>
91
  <div class="fluid-layout">
92
  <div class="layout-span12">
views/shortcode.php CHANGED
@@ -1,4 +1,5 @@
1
- <?php
 
2
  switch($cb_role)
3
  {
4
  case "administrator":
1
+ <?php
2
+ if(!defined("ABSPATH")) exit; //exit if accessed directly
3
  switch($cb_role)
4
  {
5
  case "administrator":