Form Maker by WD – user-friendly drag & drop Form Builder plugin - Version 1.7.13

Version Description

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Form Maker by WD – user-friendly drag & drop Form Builder plugin
Version 1.7.13
Comparing to
See all releases

Code changes from version 1.7.12 to 1.7.13

admin/controllers/FMControllerFormMakerSQLMapping.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerFormMakerSQLMapping {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ ////////////////////////////////////////////////////////////////////////////////////////
14
+ // Constructor & Destructor //
15
+ ////////////////////////////////////////////////////////////////////////////////////////
16
+ public function __construct() {
17
+ }
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ // Public Methods //
20
+ ////////////////////////////////////////////////////////////////////////////////////////
21
+ public function execute() {
22
+ $task = ((isset($_GET['task'])) ? esc_html($_GET['task']) : 0);
23
+ $id = ((isset($_GET['id'])) ? esc_html($_GET['id']) : 0);
24
+ $form_id = ((isset($_GET['form_id'])) ? esc_html($_GET['form_id']) : 0);
25
+ if ($task && method_exists($this, $task)) {
26
+ $this->$task($form_id);
27
+ }
28
+ else {
29
+ if ($id) {
30
+ $this->edit_query($id, $form_id);
31
+ }
32
+ else {
33
+ $this->add_query($form_id);
34
+ }
35
+ }
36
+ }
37
+
38
+ public function add_query($form_id) {
39
+ require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
40
+ $model = new FMModelFormMakerSQLMapping();
41
+
42
+ require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
43
+ $view = new FMViewFormMakerSQLMapping($model);
44
+ $view->add_query($form_id);
45
+ }
46
+
47
+ public function edit_query($id, $form_id) {
48
+ require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
49
+ $model = new FMModelFormMakerSQLMapping();
50
+
51
+ require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
52
+ $view = new FMViewFormMakerSQLMapping($model);
53
+ $view->edit_query($id, $form_id);
54
+ }
55
+
56
+ public function db_tables($form_id) {
57
+ require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
58
+ $model = new FMModelFormMakerSQLMapping();
59
+
60
+ require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
61
+ $view = new FMViewFormMakerSQLMapping($model);
62
+ $view->db_tables($form_id);
63
+ }
64
+
65
+ public function db_table_struct($form_id) {
66
+ require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
67
+ $model = new FMModelFormMakerSQLMapping();
68
+
69
+ require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
70
+ $view = new FMViewFormMakerSQLMapping($model);
71
+ $view->db_table_struct($form_id);
72
+ }
73
+
74
+ public function save_query() {
75
+ global $wpdb;
76
+ $form_id = ((isset($_GET['form_id'])) ? esc_html($_GET['form_id']) : 0);
77
+ $query = ((isset($_POST['query'])) ? stripslashes(wp_specialchars_decode($_POST['query'])) : "");
78
+ $details = ((isset($_POST['details'])) ? esc_html($_POST['details']) : "");
79
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker_query', array(
80
+ 'form_id' => $form_id,
81
+ 'query' => $query,
82
+ 'details' => $details,
83
+ ), array(
84
+ '%d',
85
+ '%s',
86
+ '%s',
87
+ ));
88
+ }
89
+
90
+ public function update_query() {
91
+ global $wpdb;
92
+ $id = ((isset($_GET['id'])) ? esc_html($_GET['id']) : 0);
93
+ $form_id = ((isset($_GET['form_id'])) ? esc_html($_GET['form_id']) : 0);
94
+ $query = ((isset($_POST['query'])) ? stripslashes(wp_specialchars_decode($_POST['query'])) : "");
95
+ $details = ((isset($_POST['details'])) ? esc_html($_POST['details']) : "");
96
+ $save = $wpdb->update($wpdb->prefix . 'formmaker_query', array(
97
+ 'form_id' => $form_id,
98
+ 'query' => $query,
99
+ 'details' => $details,
100
+ ), array('id' => $id));
101
+ }
102
+
103
+ ////////////////////////////////////////////////////////////////////////////////////////
104
+ // Getters & Setters //
105
+ ////////////////////////////////////////////////////////////////////////////////////////
106
+ ////////////////////////////////////////////////////////////////////////////////////////
107
+ // Private Methods //
108
+ ////////////////////////////////////////////////////////////////////////////////////////
109
+ ////////////////////////////////////////////////////////////////////////////////////////
110
+ // Listeners //
111
+ ////////////////////////////////////////////////////////////////////////////////////////
112
+ }
admin/controllers/FMControllerManage_fm.php CHANGED
@@ -283,6 +283,25 @@ function before_reset() {
283
  WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'form_options', 'current_id' => $current_id, 'message' => $message, 'fieldset_id' => $fieldset_id), admin_url('admin.php')));
284
  }
285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  public function cancel_options() {
287
  $this->edit();
288
  }
283
  WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'form_options', 'current_id' => $current_id, 'message' => $message, 'fieldset_id' => $fieldset_id), admin_url('admin.php')));
284
  }
285
 
286
+ public function remove_query() {
287
+ global $wpdb;
288
+ $cid = ((isset($_POST['cid']) && $_POST['cid'] != '') ? $_POST['cid'] : NULL);
289
+ if (count($cid)) {
290
+ $cids = implode(',', $cid);
291
+ $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_query WHERE id IN ( ' . $cids . ' )';
292
+ if ($wpdb->query($query)) {
293
+ echo WDW_FM_Library::message('Items Succesfully Deleted.', 'updated');
294
+ }
295
+ else {
296
+ echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
297
+ }
298
+ }
299
+ else {
300
+ echo WDW_FM_Library::message('You must select at least one item.', 'error');
301
+ }
302
+ $this->apply_options();
303
+ }
304
+
305
  public function cancel_options() {
306
  $this->edit();
307
  }
admin/models/FMModelFormMakerSQLMapping.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMModelFormMakerSQLMapping {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ ////////////////////////////////////////////////////////////////////////////////////////
14
+ // Constructor & Destructor //
15
+ ////////////////////////////////////////////////////////////////////////////////////////
16
+ public function __construct() {
17
+ }
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ // Public Methods //
20
+ ////////////////////////////////////////////////////////////////////////////////////////
21
+
22
+ function get_query($id) {
23
+ global $wpdb;
24
+ $rows = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker_query where id=" . $id);
25
+ return $rows;
26
+ }
27
+
28
+ function get_labels($form_id) {
29
+ global $wpdb;
30
+ // $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
31
+ // wp_set_wpdb_vars();
32
+ $rows = $wpdb->get_var("SELECT label_order_current FROM " . $wpdb->prefix . "formmaker where id=" . $form_id);
33
+ return $rows;
34
+ }
35
+
36
+ function get_tables() {
37
+ global $wpdb;
38
+ $con_type = $_POST['con_type'];
39
+
40
+ if($con_type == 'local') {
41
+ $query = "SHOW TABLES";
42
+ $tables = $wpdb->get_col($query);
43
+ }
44
+ else if($con_type == 'remote') {
45
+ $username = isset($_POST['username']) ? $_POST['username'] : '';
46
+ $password = isset($_POST['password']) ? $_POST['password'] : '';
47
+ $database = isset($_POST['database']) ? $_POST['database'] : '';
48
+ $host = isset($_POST['host']) ? $_POST['host'] : '';
49
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
50
+ $query = "SHOW TABLES";
51
+ $tables = $wpdb_temp->get_col($query);
52
+ }
53
+ //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
54
+ return $tables;
55
+ }
56
+
57
+ function get_tables_saved($con_type, $username, $password, $database, $host) {
58
+ global $wpdb;
59
+
60
+ if($con_type == 'local') {
61
+ $query = "SHOW TABLES";
62
+ $tables = $wpdb->get_col($query);
63
+ }
64
+ else if($con_type == 'remote') {
65
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
66
+ $query = "SHOW TABLES";
67
+ $tables = $wpdb_temp->get_col($query);
68
+ }
69
+ //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
70
+ return $tables;
71
+ }
72
+
73
+ function get_table_struct() {
74
+ global $wpdb;
75
+ $name = isset($_POST['name']) ? $_POST['name'] : NULL;
76
+ if(!$name)
77
+ return array();
78
+ $con_method = $_POST['con_method'];
79
+ $con_type = $_POST['con_type'];
80
+ $query = "SHOW COLUMNS FROM " . $name;
81
+ if($con_type == 'remote') {
82
+ $username = isset($_POST['username']) ? $_POST['username'] : '';
83
+ $password = isset($_POST['password']) ? $_POST['password'] : '';
84
+ $database = isset($_POST['database']) ? $_POST['database'] : '';
85
+ $host = isset($_POST['host']) ? $_POST['host'] : '';
86
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
87
+ $table_struct = $wpdb_temp->get_results($query);
88
+ }
89
+ else {
90
+ $table_struct = $wpdb->get_results($query);
91
+ }
92
+ //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
93
+ return $table_struct;
94
+ }
95
+
96
+ function get_table_struct_saved($con_type, $username, $password, $database, $host, $name, $con_method) {
97
+ global $wpdb;
98
+ if(!$name)
99
+ return array();
100
+ $query = "SHOW COLUMNS FROM " . $name;
101
+ if($con_type == 'remote') {
102
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
103
+ $table_struct = $wpdb_temp->get_results($query);
104
+ }
105
+ else {
106
+ $table_struct = $wpdb->get_results($query);
107
+ }
108
+ //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
109
+ return $table_struct;
110
+ }
111
+
112
+ ////////////////////////////////////////////////////////////////////////////////////////
113
+ // Getters & Setters //
114
+ ////////////////////////////////////////////////////////////////////////////////////////
115
+ ////////////////////////////////////////////////////////////////////////////////////////
116
+ // Private Methods //
117
+ ////////////////////////////////////////////////////////////////////////////////////////
118
+ ////////////////////////////////////////////////////////////////////////////////////////
119
+ // Listeners //
120
+ ////////////////////////////////////////////////////////////////////////////////////////
121
+ }
admin/models/FMModelManage_fm.php CHANGED
@@ -1802,6 +1802,12 @@ class FMModelManage_fm {
1802
  $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_themes WHERE css " . ($old ? 'NOT' : '') . " LIKE '%.wdform_section%' ORDER BY title");
1803
  return $rows;
1804
  }
 
 
 
 
 
 
1805
 
1806
  public function page_nav() {
1807
  global $wpdb;
1802
  $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_themes WHERE css " . ($old ? 'NOT' : '') . " LIKE '%.wdform_section%' ORDER BY title");
1803
  return $rows;
1804
  }
1805
+
1806
+ public function get_queries_rows_data($id) {
1807
+ global $wpdb;
1808
+ $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=" . $id . " ORDER BY id ASC");
1809
+ return $rows;
1810
+ }
1811
 
1812
  public function page_nav() {
1813
  global $wpdb;
admin/models/FMModelThemes_fm.php CHANGED
@@ -53,6 +53,7 @@ class FMModelThemes_fm {
53
  }
54
  }
55
  else {
 
56
  $row->id = 0;
57
  $row->title = '';
58
  $row->css = '';
53
  }
54
  }
55
  else {
56
+ $row = new stdClass();
57
  $row->id = 0;
58
  $row->title = '';
59
  $row->css = '';
admin/models/FMModelUninstall_fm.php CHANGED
@@ -33,6 +33,7 @@ class FMModelUninstall_fm {
33
  $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_themes");
34
  $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_sessions");
35
  $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_blocked");
 
36
  delete_option('contact_form_forms');
37
  delete_option("wd_form_maker_version");
38
  delete_option('formmaker_cureent_version');
33
  $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_themes");
34
  $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_sessions");
35
  $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_blocked");
36
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_query");
37
  delete_option('contact_form_forms');
38
  delete_option("wd_form_maker_version");
39
  delete_option('formmaker_cureent_version');
admin/views/FMViewFormMakerEditCSS.php CHANGED
@@ -32,6 +32,24 @@ class FMViewFormMakerEditCSS {
32
  <link media="all" type="text/css" href="<?php echo get_admin_url(); ?>css/colors<?php echo ((get_bloginfo('version') < '3.8') ? '-fresh' : ''); ?>.min.css" id="colors-css" rel="stylesheet">
33
  <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/form_maker_tables.css'; ?>" rel="stylesheet">
34
  <script src="<?php echo WD_FM_URL . '/js/form_maker_admin.js'; ?>" type="text/javascript"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  <form id="fm_theme" class="wrap wp-core-ui" method="post" action="#" style="width: 99%; margin: 5px 0 0 5px;">
37
  <div style="float: right; margin: 0 5px 0 0;">
@@ -67,6 +85,18 @@ class FMViewFormMakerEditCSS {
67
  <input type="hidden" id="default" name="default" value="<?php echo $row->default; ?>" />
68
  <input type="hidden" name="form_id" id="form_id" value="<?php echo $form_id; ?>" />
69
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
70
  <?php
71
  die();
72
  }
32
  <link media="all" type="text/css" href="<?php echo get_admin_url(); ?>css/colors<?php echo ((get_bloginfo('version') < '3.8') ? '-fresh' : ''); ?>.min.css" id="colors-css" rel="stylesheet">
33
  <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/form_maker_tables.css'; ?>" rel="stylesheet">
34
  <script src="<?php echo WD_FM_URL . '/js/form_maker_admin.js'; ?>" type="text/javascript"></script>
35
+ <script src="<?php echo WD_FM_URL . '/js/layout/codemirror.js'; ?>" type="text/javascript"></script>
36
+ <script src="<?php echo WD_FM_URL . '/js/layout/formatting.js'; ?>" type="text/javascript"></script>
37
+ <script src="<?php echo WD_FM_URL . '/js/layout/css.js'; ?>" type="text/javascript"></script>
38
+ <script src="<?php echo WD_FM_URL . '/js/layout/clike.js'; ?>" type="text/javascript"></script>
39
+ <script src="<?php echo WD_FM_URL . '/js/layout/javascript.js'; ?>" type="text/javascript"></script>
40
+ <script src="<?php echo WD_FM_URL . '/js/layout/htmlmixed.js'; ?>" type="text/javascript"></script>
41
+ <script src="<?php echo WD_FM_URL . '/js/layout/xml.js'; ?>" type="text/javascript"></script>
42
+ <script src="<?php echo WD_FM_URL . '/js/layout/php.js'; ?>" type="text/javascript"></script>
43
+ <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/codemirror.css'; ?>" rel="stylesheet">
44
+
45
+ <style>
46
+ .CodeMirror {
47
+ border: 1px solid #ccc;
48
+ font-size: 12px;
49
+ margin-bottom: 6px;
50
+ background: white;
51
+ }
52
+ </style>
53
 
54
  <form id="fm_theme" class="wrap wp-core-ui" method="post" action="#" style="width: 99%; margin: 5px 0 0 5px;">
55
  <div style="float: right; margin: 0 5px 0 0;">
85
  <input type="hidden" id="default" name="default" value="<?php echo $row->default; ?>" />
86
  <input type="hidden" name="form_id" id="form_id" value="<?php echo $form_id; ?>" />
87
  </form>
88
+ <script>
89
+ var editor = CodeMirror.fromTextArea(
90
+ document.getElementById("css"), {
91
+ lineNumbers: true,
92
+ lineWrapping: true,
93
+ mode: "css"
94
+ });
95
+
96
+ CodeMirror.commands["selectAll"](editor);
97
+ editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
98
+ editor.scrollTo(0,0);
99
+ </script>
100
  <?php
101
  die();
102
  }
admin/views/FMViewFormMakerSQLMapping.php ADDED
@@ -0,0 +1,1273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMViewFormMakerSQLMapping {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ private $model;
14
+
15
+
16
+ ////////////////////////////////////////////////////////////////////////////////////////
17
+ // Constructor & Destructor //
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ public function __construct($model) {
20
+ $this->model = $model;
21
+ }
22
+ ////////////////////////////////////////////////////////////////////////////////////////
23
+ // Public Methods //
24
+ ////////////////////////////////////////////////////////////////////////////////////////
25
+
26
+ public function edit_query($id, $form_id) {
27
+ wp_print_scripts('jquery');
28
+ wp_print_scripts('jquery-ui-tooltip');
29
+ ?>
30
+ <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/style.css'; ?>" rel="stylesheet">
31
+ <link rel="stylesheet" href="<?php echo WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
32
+ <?php
33
+ $label = $this->model->get_labels($form_id);
34
+ $query_obj = $this->model->get_query($id);
35
+
36
+ $temp = explode('***wdfcon_typewdf***',$query_obj->details);
37
+ $con_type = $temp[0];
38
+ $temp = explode('***wdfcon_methodwdf***',$temp[1]);
39
+ $con_method = $temp[0];
40
+ $temp = explode('***wdftablewdf***',$temp[1]);
41
+ $table_cur = $temp[0];
42
+ $temp = explode('***wdfhostwdf***',$temp[1]);
43
+ $host = $temp[0];
44
+ $temp = explode('***wdfportwdf***',$temp[1]);
45
+ $port = $temp[0];
46
+ $temp = explode('***wdfusernamewdf***',$temp[1]);
47
+ $username = $temp[0];
48
+ $temp = explode('***wdfpasswordwdf***',$temp[1]);
49
+ $password = $temp[0];
50
+ $temp = explode('***wdfdatabasewdf***',$temp[1]);
51
+ $database = $temp[0];
52
+
53
+ $details = $temp[1];
54
+
55
+ $tables = $this->model->get_tables_saved($con_type, $username, $password, $database, $host);
56
+ $table_struct = $this->model->get_table_struct_saved($con_type, $username, $password, $database, $host, $table_cur, $con_method);
57
+
58
+ $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
59
+ $label_id= array();
60
+ $label_order= array();
61
+ $label_order_original= array();
62
+ $label_type= array();
63
+
64
+ ///stexic
65
+ $label_all = explode('#****#',$label);
66
+ $label_all = array_slice($label_all,0, count($label_all)-1);
67
+
68
+ foreach($label_all as $key => $label_each) {
69
+ $label_id_each=explode('#**id**#',$label_each);
70
+ $label_oder_each=explode('#**label**#', $label_id_each[1]);
71
+
72
+ if(in_array($label_oder_each[1],$filter_types))
73
+ continue;
74
+
75
+ array_push($label_id, $label_id_each[0]);
76
+ array_push($label_order_original, $label_oder_each[0]);
77
+ $ptn = "/[^a-zA-Z0-9_]/";
78
+ $rpltxt = "";
79
+ $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
80
+ array_push($label_order, $label_temp);
81
+ array_push($label_type, $label_oder_each[1]);
82
+ }
83
+
84
+ $form_fields='';
85
+ foreach($label_id as $key => $lid) {
86
+ $form_fields.='<a onclick="insert_field('.$lid.'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$label_order_original[$key].'</a>';
87
+ }
88
+ $cond='<div id="condid"><select id="sel_condid" style="width: 110px">';
89
+ foreach($table_struct as $col) {
90
+ $cond.='<option>'.$col->Field.'</option>';
91
+ }
92
+ $cond.='</select>';
93
+ $cond.='<select id="op_condid"><option value="=" selected="selected">=</option><option value="!=">!=</option><option value=">">&gt;</option><option value="<">&lt;</option><option value=">=">&gt;=</option><option value="<=">&lt;=</option><option value="%..%">Like</option><option value="%..">Starts with</option><option value="..%">Ends with</option></select><input id="val_condid" style="width:120px" type="text" /><select id="andor_condid" style="visibility: hidden;"><option value="AND">AND</option><option value="OR">OR</option></select><img src="' . WD_FM_URL . '/images/delete.png" onclick="delete_cond(&quot;condid&quot;)" style="vertical-align: middle;"></div>';
94
+ ?>
95
+ <script>
96
+ function connect() {
97
+ jQuery("input[type='radio']").attr('disabled','');
98
+ jQuery('#struct').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
99
+
100
+ jQuery("#struct").load('index.php?option=com_formmaker&task=db_tables&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&format=row');
101
+ }
102
+ jQuery(document).ready(function() {
103
+ jQuery("#tables").change(function (){
104
+ jQuery('#table_struct').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
105
+
106
+ jQuery("#table_struct").load('index.php?option=com_formmaker&task=db_table_struct&name='+jQuery(this).val()+'&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row&id='+jQuery("#form_id").val());
107
+ });
108
+ jQuery('html').click(function() {
109
+ if(jQuery("#fieldlist").css('display')=="block") {
110
+ jQuery("#fieldlist").hide();
111
+ }
112
+ });
113
+ jQuery('.cols input[type="text"]').live('click', function() {
114
+ event.stopPropagation();
115
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
116
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
117
+ jQuery("#fieldlist").slideDown('fast');
118
+ selected_field=this.id;
119
+ });
120
+ jQuery('#query_txt').click(function() {
121
+ event.stopPropagation();
122
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
123
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
124
+ jQuery("#fieldlist").slideDown('fast');
125
+ selected_field=this.id;
126
+ });
127
+ jQuery('#fieldlist').click(function(event){
128
+ event.stopPropagation();
129
+ });
130
+ jQuery('.add_cond').click( function() {
131
+ jQuery('.cols').append(conds.replace(/condid/g, cond_id++));
132
+ update_vis();
133
+ }
134
+ );
135
+ });
136
+ var selected_field ='';
137
+ var isvisible = 1;
138
+ var cond_id = 1;
139
+ conds='<?php echo $cond ?>';
140
+ fields=new Array(<?php
141
+ $fields = "";
142
+ if($table_struct) {
143
+ foreach($table_struct as $col) {
144
+ $fields.=' "'.$col->Field.'",';
145
+ }
146
+ echo substr($fields, 0, -1);
147
+ }
148
+ ?>);
149
+
150
+ function dis(id, x) {
151
+ if(x)
152
+ jQuery('#'+id).removeAttr('disabled');
153
+ else
154
+ jQuery('#'+id).attr('disabled','disabled');
155
+ }
156
+ function update_vis() {
157
+ previous=0;
158
+ for(i=1; i<cond_id; i++) {
159
+ if(jQuery('#'+i).html()) {
160
+ jQuery('#andor_'+i).css('visibility', 'hidden');
161
+ if(previous)
162
+ jQuery('#andor_'+previous).css('visibility', 'visible');
163
+ previous=i;
164
+ }
165
+ }
166
+ }
167
+ function delete_cond(id) {
168
+ jQuery('#'+id).remove();
169
+ update_vis();
170
+ }
171
+ function save_query() {
172
+ con_type =jQuery('input[name=con_type]:checked').val();
173
+ con_method =jQuery('input[name=con_method]:checked').val();
174
+ table =jQuery('#tables').val();
175
+ host =jQuery('#host_rem').val();
176
+ port =jQuery('#port_rem').val();
177
+ username =jQuery('#username_rem').val();
178
+ password =jQuery('#password_rem').val();
179
+ database =jQuery('#database_rem').val();
180
+
181
+ str=con_type+"***wdfcon_typewdf***"+con_method+"***wdfcon_methodwdf***"+table+"***wdftablewdf***"+host+"***wdfhostwdf***"+port+"***wdfportwdf***"+username+"***wdfusernamewdf***"+password+"***wdfpasswordwdf***"+database+"***wdfdatabasewdf***";
182
+
183
+ if(fields.length) {
184
+ for(i=0; i<fields.length; i++) {
185
+ str+=fields[i]+'***wdfnamewdf***'+jQuery('#'+fields[i]).val()+'***wdfvaluewdf***'+jQuery('#ch_'+fields[i]+":checked" ).length+'***wdffieldwdf***';
186
+ }
187
+ }
188
+
189
+ for(i=1; i<cond_id; i++) {
190
+ if(jQuery('#'+i).html()) {
191
+ str+=jQuery('#sel_'+i).val()+'***sel***'+jQuery('#op_'+i).val()+'***op***'+jQuery('#val_'+i).val()+'***val***'+jQuery('#andor_'+i).val()+'***where***';
192
+ }
193
+ }
194
+ if(!jQuery('#query_txt').val()) {
195
+ gen_query();
196
+ }
197
+ jQuery('#details').val(str);
198
+ var datatxt = jQuery("#query_form").serialize()+'&form_id='+jQuery("#form_id").val();
199
+
200
+ if(jQuery('#query_txt').val()) {
201
+ jQuery('.c1').html('<div id="saving"><div id="saving_text">Saving</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
202
+
203
+ jQuery.ajax({
204
+ type: "POST",
205
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $id, 'form_id' => $form_id, 'task' => 'update_query', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
206
+ data: datatxt,
207
+ success: function(data) {
208
+ window.parent.wd_fm_apply_options();
209
+ window.parent.tb_remove();
210
+ }
211
+ });
212
+ }
213
+ else {
214
+ alert('The query is empty.');
215
+ }
216
+ return false;
217
+ }
218
+
219
+ function gen_query() {
220
+ if(jQuery('#query_txt').val())
221
+ if(!confirm('Are you sure you want to replace the Query? All the modifications to the Query will be lost.'))
222
+ return;
223
+
224
+ query="";
225
+ fields=new Array(<?php
226
+ $fields = "";
227
+ if($table_struct) {
228
+ foreach($table_struct as $col) {
229
+ $fields.=' "'.$col->Field.'",';
230
+ }
231
+ echo substr($fields, 0, -1);
232
+ }
233
+ ?>);
234
+
235
+ con_type =jQuery('input[name=con_type]:checked').val();
236
+ con_method =jQuery('input[name=con_method]:checked').val();
237
+ table =jQuery('#tables').val();
238
+ fls='';
239
+ vals='';
240
+ valsA=new Array();
241
+ flsA=new Array();
242
+
243
+ if(fields.length) {
244
+ for(i=0; i<fields.length; i++) {
245
+ if(jQuery('#ch_'+fields[i]+":checked" ).length) {
246
+ flsA.push(fields[i]);
247
+ valsA.push(jQuery('#'+fields[i]).val());
248
+ }
249
+ }
250
+ }
251
+ if(con_method=="insert") {
252
+ if(flsA.length) {
253
+ for(i=0; i<flsA.length-1; i++) {
254
+ fls+= '`'+flsA[i]+'`, ';
255
+ vals+= '"'+valsA[i]+'", ';
256
+ }
257
+ fls+= '`'+flsA[i]+'`';
258
+ vals+= '"'+valsA[i]+'"';
259
+ }
260
+ if(fls)
261
+ query="INSERT INTO "+jQuery('#tables').val()+" (" +fls+") VALUES ("+vals+")";
262
+ }
263
+
264
+ if(con_method=="update") {
265
+ if(flsA.length) {
266
+ for(i=0; i<flsA.length-1; i++) {
267
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'", ';
268
+ }
269
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'"';
270
+ }
271
+ where="";
272
+ previous='';
273
+
274
+ for(i=1; i<cond_id; i++) {
275
+ if(jQuery('#'+i).html()) {
276
+ if(jQuery('#op_'+i).val()=="%..%")
277
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
278
+ else if(jQuery('#op_'+i).val()=="%..")
279
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
280
+ else if(jQuery('#op_'+i).val()=="..%")
281
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
282
+ else
283
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
284
+ where+=previous+' `'+jQuery('#sel_'+i).val()+'`'+op_val;
285
+ previous=' '+ jQuery('#andor_'+i).val();
286
+ }
287
+ }
288
+ if(vals)
289
+ query="UPDATE "+jQuery('#tables').val()+" SET " + vals+(where? ' WHERE'+where: '') ;
290
+ }
291
+ if(con_method=="delete") {
292
+ where="";
293
+ previous='';
294
+ for(i=1; i<cond_id; i++) {
295
+ if(jQuery('#'+i).html()) {
296
+ if(jQuery('#op_'+i).val()=="%..%")
297
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
298
+ else if(jQuery('#op_'+i).val()=="%..")
299
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
300
+ else if(jQuery('#op_'+i).val()=="..%")
301
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
302
+ else
303
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
304
+ where+=previous+' '+jQuery('#sel_'+i).val()+op_val;
305
+ previous=' '+ jQuery('#andor_'+i).val();
306
+ }
307
+ }
308
+ if(where)
309
+ query="DELETE FROM "+jQuery('#tables').val()+ ' WHERE'+where ;
310
+ }
311
+ jQuery('#query_txt').val(query);
312
+ }
313
+
314
+ jQuery(document).ready(function () {
315
+ jQuery(".hasTip").tooltip({
316
+ track: true,
317
+ content: function () {
318
+ return jQuery(this).prop('title');
319
+ }
320
+ });
321
+ });
322
+
323
+ function insert_field(myValue) {
324
+ if(!selected_field)
325
+ return;
326
+ myField=document.getElementById(selected_field);
327
+ if (document.selection) {
328
+ myField.focus();
329
+ sel = document.selection.createRange();
330
+ sel.text = myValue;
331
+ }
332
+ else {
333
+ if (myField.selectionStart || myField.selectionStart == '0') {
334
+ var startPos = myField.selectionStart;
335
+ var endPos = myField.selectionEnd;
336
+ myField.value = myField.value.substring(0, startPos)
337
+ + "{"+myValue+"}"
338
+ + myField.value.substring(endPos, myField.value.length);
339
+ }
340
+ else {
341
+ myField.value += "{"+myValue+"}";
342
+ }
343
+ }
344
+ }
345
+ </script>
346
+
347
+ <style>
348
+ .main_func {
349
+ font-size: 12px;
350
+ display:inline-block;
351
+ width:480px;
352
+ vertical-align:top;
353
+ }
354
+ .desc {
355
+ font-size: 12px;
356
+ display:inline-block;
357
+ width:250px;
358
+ position:fixed;
359
+ margin:15px;
360
+ padding-left:55px;
361
+ }
362
+ .desc button {
363
+ max-width: 200px;
364
+ overflow: hidden;
365
+ white-space: nowrap;
366
+ text-overflow: ellipsis;
367
+ }
368
+ .key label {
369
+ display:inline-block;
370
+ width:150px;
371
+ }
372
+ .cols {
373
+ border: 3px solid red;
374
+ padding: 4px;
375
+ }
376
+ .cols div:nth-child(even) {background: #FFF}
377
+ .cols div:nth-child(odd) {background: #F5F5F5}
378
+ .cols div {
379
+ height: 28px;
380
+ padding: 5px
381
+ }
382
+ .cols label {
383
+ display:inline-block;
384
+ width:200px;
385
+ font-size:15px;
386
+ overflow: hidden;
387
+ white-space: nowrap;
388
+ text-overflow: ellipsis;
389
+ vertical-align: middle;
390
+ }
391
+ .cols input[type="text"] {
392
+ width: 220px;
393
+ line-height: 18px;
394
+ height: 20px;
395
+ }
396
+ .cols input[type="text"]:disabled {
397
+ cursor: not-allowed;
398
+ background-color: #eee;
399
+ }
400
+ .cols input[type="checkbox"] {
401
+ width: 20px;
402
+ line-height: 18px;
403
+ height: 20px;
404
+ vertical-align: middle;
405
+ }
406
+ .cols select {
407
+ line-height: 18px;
408
+ height: 24px;
409
+ }
410
+ #fieldlist {
411
+ position: absolute;
412
+ width:225px;
413
+ background: #fff;
414
+ border: solid 1px #c7c7c7;
415
+ top: 0;
416
+ left: 0;
417
+ z-index: 1000;
418
+ }
419
+ #fieldlist a {
420
+ padding: 5px;
421
+ cursor:pointer;
422
+ overflow: hidden;
423
+ white-space: nowrap;
424
+ text-overflow: ellipsis;
425
+ }
426
+ #fieldlist a:hover {
427
+ background: #ccc;
428
+ }
429
+ .gen_query, .gen_query:focus {
430
+ width: 200px;
431
+ height: 38px;
432
+ background: #0E73D4;
433
+ color: white;
434
+ cursor: pointer;
435
+ border: 0px;
436
+ font-size: 16px;
437
+ font-weight: bold;
438
+ margin: 20px;
439
+ }
440
+ .gen_query:active {
441
+ background: #ccc;
442
+ }
443
+ </style>
444
+
445
+ <div class="c1">
446
+ <div class="main_func">
447
+ <table class="admintable">
448
+ <tr valign="top">
449
+ <td class="key">
450
+ <label title="asf">Connection type: </label>
451
+ </td>
452
+ <td >
453
+ <input type="radio" name="con_type" id="local" value="local" <?php if($con_type=='local') echo 'checked="checked"'?> disabled>
454
+ <label for="local">Local</label>
455
+ <input type="radio" name="con_type" id="remote" value="remote" <?php if($con_type=='remote') echo 'checked="checked"'?> disabled>
456
+ <label for="remote">Remote</label>
457
+ </td>
458
+ </tr>
459
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
460
+ <td class="key">Host</td>
461
+ <td>
462
+ <input type="text" name="host" id="host_rem" style="width:180px" value="<?php echo $host; ?>" disabled>
463
+ Port : <input type="text" name="port" id="port_rem" value="<?php echo $port; ?>" style="width:50px" disabled>
464
+ </td>
465
+ </tr>
466
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
467
+ <td class="key">Username</td>
468
+ <td>
469
+ <input type="text" name="username" id="username_rem" style="width:272px" value="<?php echo $username; ?>" disabled>
470
+ </td>
471
+ </tr>
472
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
473
+ <td class="key">Password</td>
474
+ <td>
475
+ <input type="password" name="password" id="password_rem" style="width:272px" value="<?php echo $password; ?>" disabled>
476
+ </td>
477
+ </tr>
478
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
479
+ <td class="key">Database</td>
480
+ <td>
481
+ <input type="text"name="database" id="database_rem" style="width:272px" value="<?php echo $database; ?>" disabled>
482
+ </td>
483
+ </tr>
484
+ <tr valign="top">
485
+ <td class="key">
486
+ <label>Method: </label>
487
+ </td>
488
+ <td >
489
+ <input type="radio" name="con_method" id="insert" value="insert" <?php if($con_method=='insert') echo 'checked="checked"'?> disabled>
490
+ <label for="insert">Insert</label>
491
+ <input type="radio" name="con_method" id="update" value="update" <?php if($con_method=='update') echo 'checked="checked"'?> disabled>
492
+ <label for="update">Update</label>
493
+ <input type="radio" name="con_method" id="delete" value="delete" <?php if($con_method=='delete') echo 'checked="checked"'?> disabled>
494
+ <label for="delete">Delete</label>
495
+ </td>
496
+ </tr>
497
+ <tr valign="top">
498
+ <td class="key">
499
+ </td>
500
+ <td >
501
+ <input type="button" value="Connect" onclick="connect()" disabled>
502
+ </td>
503
+ </tr>
504
+ </table>
505
+ <div id="struct">
506
+ <label for="tables" style="display:inline-block;width:157px;font-weight: bold;">Select a table</label>
507
+ <select name="tables" id="tables" disabled>
508
+ <option value="" ></option>
509
+ <?php
510
+
511
+ foreach($tables as $table)
512
+ echo '<option value="'.$table.'" '.($table_cur==$table ? 'selected' : '').' >'.$table.'</option>';
513
+ ?>
514
+ </select>
515
+ <br/><br/>
516
+
517
+
518
+ <div id="table_struct">
519
+
520
+ <?php
521
+ if($table_struct)
522
+ {
523
+ ?>
524
+
525
+ <div class="cols">
526
+ <?php
527
+
528
+ $temps=explode('***wdffieldwdf***',$details);
529
+ $wheres = $temps[count($temps)-1];
530
+ $temps = array_slice($temps,0, count($temps)-1);
531
+ $col_names= array();
532
+ $col_vals= array();
533
+ $col_checks= array();
534
+
535
+ foreach($temps as $temp)
536
+ {
537
+ $temp=explode('***wdfnamewdf***',$temp);
538
+ array_push($col_names, $temp[0]);
539
+ $temp=explode('***wdfvaluewdf***',$temp[1]);
540
+ array_push($col_vals, $temp[0]);
541
+ array_push($col_checks, $temp[1]);
542
+ }
543
+ if($con_method=='insert' or $con_method=='update')
544
+ {
545
+ echo '<div style="background: none;text-align: center;font-size: 20px;color: rgb(0, 164, 228);font-weight: bold;"> SET </div>';
546
+
547
+ foreach($table_struct as $key =>$col)
548
+ {
549
+
550
+ $title=' '.$col->Field;
551
+ $title.="<ul style='padding-left: 17px;'>";
552
+ $title.="<li>Type - ".$col->Type."</li>";
553
+ $title.="<li>Null - ".$col->Null."</li>";
554
+ $title.="<li>Key - ".$col->Key."</li>";
555
+ $title.="<li>Default - ".$col->Default."</li>";
556
+ $title.="<li>Extra - ".$col->Extra."</li>";
557
+ $title.="</ul>";
558
+
559
+ ?>
560
+ <div><label title="<?php echo $title; ?>" class="hasTip"><b><?php echo $col->Field; ?></b><img src="<?php echo WD_FM_URL . '/images/info.png'; ?>" style="width:20px; vertical-align:middle;padding-left: 10px;" /></label><input type="text" id="<?php echo $col->Field; ?>" <?php if(!$col_checks[$key]) echo 'disabled="disabled"'?> value="<?php echo $col_vals[$key]; ?>" /><input id="ch_<?php echo $col->Field; ?>" type="checkbox" onClick="dis('<?php echo $col->Field; ?>', this.checked)" <?php if($col_checks[$key]) echo 'checked="checked"'?> /></div>
561
+ <?php
562
+ }
563
+ }
564
+
565
+ if($con_method=='delete' or $con_method=='update')
566
+ {
567
+ echo '<div style="background: none;text-align: center;font-size: 20px;color: rgb(0, 164, 228);font-weight: bold;"> WHERE </div>
568
+ <img src="' . WD_FM_URL . '/images/add_condition.png" title="ADD" class="add_cond"/></br>';
569
+
570
+ if($wheres)
571
+ {
572
+ echo '<script>';
573
+
574
+ $wheres =explode('***where***',$wheres);
575
+ $wheres = array_slice($wheres,0, count($wheres)-1);
576
+ foreach($wheres as $where)
577
+ {
578
+ $temp=explode('***sel***',$where);
579
+ $sel = $temp[0];
580
+ $temp=explode('***op***',$temp[1]);
581
+ $op = $temp[0];
582
+ $temp=explode('***val***',$temp[1]);
583
+ $val = $temp[0];
584
+ $andor = $temp[1];
585
+ echo 'jQuery(".cols").append(conds.replace(/condid/g, cond_id++)); update_vis();
586
+ jQuery("#sel_"+(cond_id-1)).val("'.$sel.'");
587
+ jQuery("#op_"+(cond_id-1)).val("'.$op.'");
588
+ jQuery("#val_"+(cond_id-1)).val("'.$val.'");
589
+ jQuery("#andor_"+(cond_id-1)).val("'.$andor.'");
590
+ ';
591
+
592
+ }
593
+ echo '</script>';
594
+
595
+ }
596
+
597
+
598
+ }
599
+ ?>
600
+ <div style="color:red; background: none">The changes above will not affect the query until you click "Generate query".</div>
601
+ </div>
602
+ <br/>
603
+ <input type="button" value="Generate Query" class="gen_query" onclick="gen_query()">
604
+ <br/>
605
+ <form name="query_form" id="query_form" >
606
+ <label style="vertical-align: top;" for="query_txt" > Query: </label><textarea id="query_txt" name="query" rows=5 style="width:428px" ><?php echo $query_obj->query; ?></textarea>
607
+ <input type="hidden" name="details" id="details">
608
+ <input type="hidden" name="id" value="<?php echo $query_obj->id; ?>">
609
+ </form>
610
+ <input type="button" value="Save" style="float: right;width: 200px;height: 38px;background: #0E73D4;color: white;cursor: pointer;border: 0px;font-size: 16px;font-weight: bold;margin: 20px;" onclick="save_query()">
611
+
612
+
613
+ <div id="fieldlist" style="display: none;">
614
+ <?php echo $form_fields ?>
615
+ </div>
616
+
617
+
618
+ <?php
619
+ }
620
+ ?>
621
+ </div>
622
+ </div>
623
+ <input type="hidden" value="<?php echo $form_id ?>" id="form_id">
624
+
625
+ </div>
626
+
627
+ <div class="desc">
628
+ <?php
629
+ foreach($label_id as $key => $lid)
630
+ {
631
+ echo '<div>{'.$lid.'} - <button onclick="insert_field('.$lid.');">'.$label_order_original[$key].'</button></div>';
632
+
633
+ }
634
+
635
+ ?>
636
+ </div>
637
+ </div>
638
+ <?php
639
+ die();
640
+ }
641
+
642
+ public function add_query($form_id){
643
+ wp_print_scripts('jquery');
644
+ wp_print_scripts('jquery-ui-tooltip');
645
+ ?>
646
+ <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/style.css'; ?>" rel="stylesheet">
647
+ <link rel="stylesheet" href="<?php echo WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
648
+ <?php
649
+ $label = $this->model->get_labels($form_id);
650
+
651
+ $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
652
+ $label_id= array();
653
+ $label_order= array();
654
+ $label_order_original= array();
655
+ $label_type= array();
656
+
657
+ ///stexic
658
+ $label_all = explode('#****#',$label);
659
+ $label_all = array_slice($label_all,0, count($label_all)-1);
660
+
661
+ foreach($label_all as $key => $label_each) {
662
+ $label_id_each=explode('#**id**#',$label_each);
663
+ $label_oder_each=explode('#**label**#', $label_id_each[1]);
664
+
665
+ if(in_array($label_oder_each[1],$filter_types))
666
+ continue;
667
+
668
+ array_push($label_id, $label_id_each[0]);
669
+
670
+
671
+ array_push($label_order_original, $label_oder_each[0]);
672
+
673
+ $ptn = "/[^a-zA-Z0-9_]/";
674
+ $rpltxt = "";
675
+ $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
676
+ array_push($label_order, $label_temp);
677
+
678
+ array_push($label_type, $label_oder_each[1]);
679
+ }
680
+ ?>
681
+ <script>
682
+ function insert_field(){}
683
+
684
+ function connect() {
685
+ jQuery("input[type='radio']").attr('disabled','');
686
+ jQuery(".connect").attr('disabled','');
687
+ jQuery('#struct').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
688
+ jQuery.ajax({
689
+ type: "POST",
690
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'db_tables', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
691
+ data: 'con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row',
692
+ success: function(data) {
693
+ if(data==1) {
694
+ jQuery("#struct").html('<div style="font-size: 22px; text-align: center; padding-top: 15px;">Could not connect to MySQL.</div>')
695
+ jQuery(".connect").removeAttr('disabled');
696
+ jQuery("input[type='radio']").removeAttr('disabled','');
697
+ }
698
+ else {
699
+ jQuery("#struct").html(data);
700
+ }
701
+ }
702
+ });
703
+ }
704
+
705
+ function shh(x) {
706
+ if(x)
707
+ jQuery(".remote_info").show();
708
+ else
709
+ jQuery(".remote_info").hide();
710
+ }
711
+
712
+ </script>
713
+ <style>
714
+ .main_func {
715
+ font-size: 12px;
716
+ display:inline-block;
717
+ width:480px;
718
+ vertical-align:top;
719
+ }
720
+
721
+ .desc {
722
+ font-size: 12px;
723
+ display:inline-block;
724
+ width:250px;
725
+ position:fixed;
726
+ margin:15px;
727
+ margin-left:55px;
728
+ }
729
+
730
+ .desc button {
731
+ max-width: 200px;
732
+ overflow: hidden;
733
+ white-space: nowrap;
734
+ text-overflow: ellipsis;
735
+ }
736
+
737
+ .key label {
738
+ display:inline-block;
739
+ width:150px;
740
+ }
741
+ </style>
742
+
743
+ <div class="c1">
744
+ <div class="main_func">
745
+ <table class="admintable">
746
+ <tr valign="top">
747
+ <td class="key">
748
+ <label title="asf">Connection type: </label>
749
+ </td>
750
+ <td >
751
+ <input type="radio" name="con_type" id="local" value="local" checked="checked" onclick="shh(false)">
752
+ <label for="local">Local</label>
753
+ <input type="radio" name="con_type" id="remote" value="remote" onclick="shh(true)">
754
+ <label for="remote">Remote</label>
755
+ </td>
756
+ </tr>
757
+ <tr class="remote_info" style="display:none">
758
+ <td class="key">Host</td>
759
+ <td>
760
+ <input type="text" name="host" id="host_rem" style="width:180px">
761
+ Port : <input type="text" name="port" id="port_rem" value="3306" style="width:50px">
762
+ </td>
763
+ </tr>
764
+ <tr class="remote_info" style="display:none">
765
+ <td class="key">Username</td>
766
+ <td>
767
+ <input type="text" name="username" id="username_rem" style="width:272px">
768
+ </td>
769
+ </tr>
770
+ <tr class="remote_info" style="display:none">
771
+ <td class="key">Password</td>
772
+ <td>
773
+ <input type="password" name="password" id="password_rem" style="width:272px">
774
+ </td>
775
+ </tr>
776
+ <tr class="remote_info" style="display:none">
777
+ <td class="key">Database</td>
778
+ <td>
779
+ <input type="text"name="database" id="database_rem" style="width:272px">
780
+ </td>
781
+ </tr>
782
+ <tr valign="top">
783
+ <td class="key">
784
+ <label>Method: </label>
785
+ </td>
786
+ <td >
787
+ <input type="radio" name="con_method" id="insert" value="insert" checked="checked">
788
+ <label for="insert">Insert</label>
789
+ <input type="radio" name="con_method" id="update" value="update">
790
+ <label for="update">Update</label>
791
+ <input type="radio" name="con_method" id="delete" value="delete">
792
+ <label for="delete">Delete</label>
793
+ </td>
794
+ </tr>
795
+ <tr valign="top">
796
+ <td class="key">
797
+ </td>
798
+ <td >
799
+ <input type="button" value="Connect" onclick="connect()" class="connect">
800
+ </td>
801
+ </tr>
802
+ </table>
803
+ <div id="struct">
804
+ </div>
805
+ <input type="hidden" value="<?php echo $form_id ?>" id="form_id">
806
+ </div>
807
+ <div class="desc">
808
+ <?php
809
+ foreach($label_id as $key => $lid) {
810
+ echo '<div>{'.$lid.'} - <button onclick="insert_field('.$lid.');">'.$label_order_original[$key].'</button></div>';
811
+ }
812
+ ?>
813
+ </div>
814
+ </div>
815
+ <?php
816
+ die();
817
+ }
818
+
819
+ public function db_tables($form_id){
820
+ $tables = $this->model->get_tables();
821
+ ?>
822
+ <label for="tables" style="display:inline-block;width:157px;font-weight: bold;">Select a table</label>
823
+ <select name="tables" id="tables">
824
+ <option value="" ></option>
825
+ <?php
826
+ foreach($tables as $table) {
827
+ echo '<option value="' . $table . '" >' . $table . '</option>';
828
+ }
829
+ ?>
830
+ </select>
831
+ <br/><br/>
832
+ <div id="table_struct">
833
+ </div>
834
+ <script>
835
+ jQuery("#tables").change(function (){
836
+ jQuery('#table_struct').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
837
+
838
+ jQuery.ajax({
839
+ type: "POST",
840
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'db_table_struct', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
841
+ data: 'name='+jQuery(this).val()+'&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row',
842
+ success: function(data) {
843
+ jQuery("#table_struct").html(data);
844
+ }
845
+ });
846
+ })
847
+ </script>
848
+ <?php
849
+ die();
850
+ }
851
+
852
+ public function db_table_struct ($form_id) {
853
+ $table_struct = $this->model->get_table_struct();
854
+ $label = $this->model->get_labels($form_id);
855
+ $con_method = isset($_POST['con_method']) ? $_POST['con_method'] : '';
856
+ $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
857
+ $label_id= array();
858
+ $label_order= array();
859
+ $label_order_original= array();
860
+ $label_type= array();
861
+
862
+ ///stexic
863
+ $label_all = explode('#****#',$label);
864
+ $label_all = array_slice($label_all,0, count($label_all)-1);
865
+
866
+ foreach($label_all as $key => $label_each) {
867
+ $label_id_each=explode('#**id**#',$label_each);
868
+ $label_oder_each=explode('#**label**#', $label_id_each[1]);
869
+
870
+ if(in_array($label_oder_each[1],$filter_types)) {
871
+ continue;
872
+ }
873
+ array_push($label_id, $label_id_each[0]);
874
+ array_push($label_order_original, $label_oder_each[0]);
875
+ $ptn = "/[^a-zA-Z0-9_]/";
876
+ $rpltxt = "";
877
+ $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
878
+ array_push($label_order, $label_temp);
879
+ array_push($label_type, $label_oder_each[1]);
880
+ }
881
+ $form_fields='';
882
+ foreach($label_id as $key => $id) {
883
+ $form_fields.='<a onclick="insert_field('.$id.'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$label_order_original[$key].'</a>';
884
+ }
885
+ $cond='<div id="condid"><select id="sel_condid" style="width: 110px">';
886
+ foreach($table_struct as $col) {
887
+ $cond.='<option>'.$col->Field.'</option>';
888
+ }
889
+ $cond.='</select>';
890
+
891
+ $cond.='<select id="op_condid"><option value="=" selected="selected">=</option><option value="!=">!=</option><option value=">">&gt;</option><option value="<">&lt;</option><option value=">=">&gt;=</option><option value="<=">&lt;=</option><option value="%..%">Like</option><option value="%..">Starts with</option><option value="..%">Ends with</option></select><input id="val_condid" style="width:120px" type="text" /><select id="andor_condid" style="visibility: hidden;"><option value="AND">AND</option><option value="OR">OR</option></select><img src="' . WD_FM_URL . '/images/delete.png" onclick="delete_cond(&quot;condid&quot;)" style="vertical-align: middle;"></div>';
892
+ ?>
893
+ <script>
894
+ var selected_field ='';
895
+ var isvisible = 1;
896
+ var cond_id = 1;
897
+ //onclick="gen_query()"
898
+ conds='<?php echo $cond ?>';
899
+ fields=new Array(<?php
900
+ $fields = "";
901
+ if($table_struct) {
902
+ foreach($table_struct as $col) {
903
+ $fields.=' "'.$col->Field.'",';
904
+ }
905
+ echo substr($fields, 0, -1);
906
+ }
907
+ ?>);
908
+ function dis(id, x) {
909
+ if(x)
910
+ jQuery('#'+id).removeAttr('disabled');
911
+ else
912
+ jQuery('#'+id).attr('disabled','disabled');
913
+ }
914
+
915
+ function update_vis() {
916
+ previous=0;
917
+ for(i=1; i<cond_id; i++) {
918
+ if(jQuery('#'+i).html()) {
919
+ jQuery('#andor_'+i).css('visibility', 'hidden');
920
+ if(previous) {
921
+ jQuery('#andor_'+previous).css('visibility', 'visible');
922
+ }
923
+ previous=i;
924
+ }
925
+ }
926
+ }
927
+
928
+ function delete_cond(id) {
929
+ jQuery('#'+id).remove();
930
+ update_vis();
931
+ }
932
+
933
+ jQuery('.add_cond').click( function() {
934
+ jQuery('.cols').append(conds.replace(/condid/g, cond_id++));
935
+ update_vis();
936
+ }
937
+ );
938
+
939
+ jQuery('html').click(function() {
940
+ if(jQuery("#fieldlist").css('display')=="block") {
941
+ jQuery("#fieldlist").hide();
942
+ }
943
+ });
944
+
945
+ jQuery('.cols input[type="text"]').live('click', function() {
946
+ event.stopPropagation();
947
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
948
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
949
+ jQuery("#fieldlist").slideDown('fast');
950
+ selected_field=this.id;
951
+ });
952
+
953
+ jQuery('#query_txt').click(function() {
954
+ event.stopPropagation();
955
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
956
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
957
+ jQuery("#fieldlist").slideDown('fast');
958
+ selected_field=this.id;
959
+ });
960
+
961
+ jQuery('#fieldlist').click(function(event){
962
+ event.stopPropagation();
963
+ });
964
+
965
+ function save_query() {
966
+ con_type =jQuery('input[name=con_type]:checked').val();
967
+ con_method =jQuery('input[name=con_method]:checked').val();
968
+ table =jQuery('#tables').val();
969
+ table =jQuery('#tables').val();
970
+ host =jQuery('#host_rem').val();
971
+ port =jQuery('#port_rem').val();
972
+ username =jQuery('#username_rem').val();
973
+ password =jQuery('#password_rem').val();
974
+ database =jQuery('#database_rem').val();
975
+
976
+ str=con_type+"***wdfcon_typewdf***"+con_method+"***wdfcon_methodwdf***"+table+"***wdftablewdf***"+host+"***wdfhostwdf***"+port+"***wdfportwdf***"+username+"***wdfusernamewdf***"+password+"***wdfpasswordwdf***"+database+"***wdfdatabasewdf***";
977
+
978
+ if(fields.length) {
979
+ for(i=0; i<fields.length; i++) {
980
+ str+=fields[i]+'***wdfnamewdf***'+jQuery('#'+fields[i]).val()+'***wdfvaluewdf***'+jQuery('#ch_'+fields[i]+":checked" ).length+'***wdffieldwdf***';
981
+ }
982
+ }
983
+
984
+ for(i=1; i<cond_id; i++) {
985
+ if(jQuery('#'+i).html()) {
986
+ str+=jQuery('#sel_'+i).val()+'***sel***'+jQuery('#op_'+i).val()+'***op***'+jQuery('#val_'+i).val()+'***val***'+jQuery('#andor_'+i).val()+'***where***';
987
+ }
988
+ }
989
+
990
+ if(!jQuery('#query_txt').val()) {
991
+ gen_query();
992
+ }
993
+
994
+ jQuery('#details').val(str);
995
+
996
+ var datatxt = jQuery("#query_form").serialize()+'&form_id='+jQuery("#form_id").val();
997
+ if(jQuery('#query_txt').val()) {
998
+ jQuery('.c1').html('<div id="saving"><div id="saving_text">Saving</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
999
+ jQuery.ajax({
1000
+ type: "POST",
1001
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'save_query', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
1002
+ data: datatxt,
1003
+ success: function(data) {
1004
+ window.parent.wd_fm_apply_options();
1005
+ window.parent.tb_remove();
1006
+ }
1007
+ });
1008
+ }
1009
+ else {
1010
+ alert('The query is empty.');
1011
+ }
1012
+ return false;
1013
+ }
1014
+
1015
+ function gen_query() {
1016
+ if(jQuery('#query_txt').val()) {
1017
+ if(!confirm('Are you sure you want to replace the Query? All the modifications to the Query will be lost.')) {
1018
+ return;
1019
+ }
1020
+ }
1021
+ query="";
1022
+ fields=new Array(<?php
1023
+ $fields = "";
1024
+ if($table_struct) {
1025
+ foreach($table_struct as $col) {
1026
+ $fields.=' "'.$col->Field.'",';
1027
+ }
1028
+ echo substr($fields, 0, -1);
1029
+ }
1030
+ ?>);
1031
+
1032
+ con_type =jQuery('input[name=con_type]:checked').val();
1033
+ con_method =jQuery('input[name=con_method]:checked').val();
1034
+ table =jQuery('#tables').val();
1035
+ fls='';
1036
+ vals='';
1037
+ valsA=new Array();
1038
+ flsA=new Array();
1039
+
1040
+ if(fields.length) {
1041
+ for(i=0; i<fields.length; i++) {
1042
+ if(jQuery('#ch_'+fields[i]+":checked" ).length) {
1043
+ flsA.push(fields[i]);
1044
+ valsA.push(jQuery('#'+fields[i]).val());
1045
+ }
1046
+ }
1047
+ }
1048
+
1049
+ if(con_method=="insert") {
1050
+ if(flsA.length) {
1051
+ for(i=0; i<flsA.length-1; i++) {
1052
+ fls+= '`'+flsA[i]+'`, ';
1053
+ vals+= '"'+valsA[i]+'", ';
1054
+ }
1055
+ fls+= '`'+flsA[i]+'`';
1056
+ vals+= '"'+valsA[i]+'"';
1057
+ }
1058
+ if(fls) {
1059
+ query="INSERT INTO "+jQuery('#tables').val()+" (" +fls+") VALUES ("+vals+")";
1060
+ }
1061
+ }
1062
+
1063
+ if(con_method=="update") {
1064
+ if(flsA.length) {
1065
+ for(i=0; i<flsA.length-1; i++) {
1066
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'", ';
1067
+ }
1068
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'"';
1069
+ }
1070
+ where="";
1071
+ previous='';
1072
+ for(i=1; i<cond_id; i++) {
1073
+ if(jQuery('#'+i).html()) {
1074
+ if(jQuery('#op_'+i).val()=="%..%")
1075
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
1076
+ else if(jQuery('#op_'+i).val()=="%..")
1077
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
1078
+ else if(jQuery('#op_'+i).val()=="..%")
1079
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
1080
+ else
1081
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
1082
+ where+=previous+' `'+jQuery('#sel_'+i).val()+'`'+op_val;
1083
+ previous=' '+ jQuery('#andor_'+i).val();
1084
+ }
1085
+ }
1086
+ if(vals) {
1087
+ query="UPDATE "+jQuery('#tables').val()+" SET " + vals+(where? ' WHERE'+where: '') ;
1088
+ }
1089
+ }
1090
+
1091
+ if(con_method=="delete") {
1092
+ where="";
1093
+ previous='';
1094
+ for(i=1; i<cond_id; i++) {
1095
+ if(jQuery('#'+i).html()) {
1096
+ if(jQuery('#op_'+i).val()=="%..%")
1097
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
1098
+
1099
+ else if(jQuery('#op_'+i).val()=="%..")
1100
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
1101
+
1102
+ else if(jQuery('#op_'+i).val()=="..%")
1103
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
1104
+
1105
+ else
1106
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
1107
+ where+=previous+' '+jQuery('#sel_'+i).val()+op_val;
1108
+ previous=' '+ jQuery('#andor_'+i).val();
1109
+ }
1110
+ }
1111
+ if(where) {
1112
+ query="DELETE FROM "+jQuery('#tables').val()+ ' WHERE'+where ;
1113
+ }
1114
+ }
1115
+ jQuery('#query_txt').val(query);
1116
+ }
1117
+
1118
+ jQuery(document).ready(function () {
1119
+ jQuery(".hasTip").tooltip({
1120
+ track: true,
1121
+ content: function () {
1122
+ return jQuery(this).prop('title');
1123
+ }
1124
+ });
1125
+ });
1126
+
1127
+ function insert_field(myValue) {
1128
+ if(!selected_field)
1129
+ return;
1130
+ myField=document.getElementById(selected_field);
1131
+ if (document.selection) {
1132
+ myField.focus();
1133
+ sel = document.selection.createRange();
1134
+ sel.text = myValue;
1135
+ }
1136
+ else {
1137
+ if (myField.selectionStart || myField.selectionStart == '0') {
1138
+ var startPos = myField.selectionStart;
1139
+ var endPos = myField.selectionEnd;
1140
+ myField.value = myField.value.substring(0, startPos)
1141
+ + "{"+myValue+"}"
1142
+ + myField.value.substring(endPos, myField.value.length);
1143
+ }
1144
+ else {
1145
+ myField.value += "{"+myValue+"}";
1146
+ }
1147
+ }
1148
+ }
1149
+ </script>
1150
+ <style>
1151
+ .cols div:nth-child(even) {background: #FFF;}
1152
+ .cols div:nth-child(odd) {background: #F5F5F5;}
1153
+ .cols div {
1154
+ height: 28px;
1155
+ padding: 5px;
1156
+ }
1157
+ .cols label {
1158
+ display:inline-block;
1159
+ width:200px;
1160
+ font-size:15px;
1161
+ overflow: hidden;
1162
+ white-space: nowrap;
1163
+ text-overflow: ellipsis;
1164
+ vertical-align: middle;
1165
+ }
1166
+ .cols input[type="text"] {
1167
+ width: 220px;
1168
+ line-height: 18px;
1169
+ height: 20px;
1170
+ }
1171
+ .cols input[type="text"]:disabled {
1172
+ cursor: not-allowed;
1173
+ background-color: #eee;
1174
+ }
1175
+ .cols input[type="checkbox"] {
1176
+ width: 20px;
1177
+ line-height: 18px;
1178
+ height: 20px;
1179
+ vertical-align: middle;
1180
+ }
1181
+ .cols select {
1182
+ line-height: 18px;
1183
+ height: 24px;
1184
+ }
1185
+ #fieldlist {
1186
+ position: absolute;
1187
+ width:225px;
1188
+ background: #fff;
1189
+ border: solid 1px #c7c7c7;
1190
+ top: 0;
1191
+ left: 0;
1192
+ z-index: 1000;
1193
+ }
1194
+ #fieldlist a {
1195
+ padding: 5px;
1196
+ cursor:pointer;
1197
+ overflow: hidden;
1198
+ white-space: nowrap;
1199
+ text-overflow: ellipsis;
1200
+ }
1201
+ #fieldlist a:hover {
1202
+ background: #ccc;
1203
+ }
1204
+ .gen_query, .gen_query:focus {
1205
+ width: 200px;
1206
+ height: 38px;
1207
+ background: #0E73D4;
1208
+ color: white;
1209
+ cursor: pointer;
1210
+ border: 0px;
1211
+ font-size: 16px;
1212
+ font-weight: bold;
1213
+ margin: 20px;
1214
+ }
1215
+ .gen_query:active {
1216
+ background: #ccc;
1217
+ }
1218
+ </style>
1219
+ <?php
1220
+ if($table_struct) {
1221
+ ?>
1222
+
1223
+ <div class="cols">
1224
+ <?php
1225
+ if($con_method=='insert' or $con_method=='update') {
1226
+ echo '<div style="background: none;text-align: center;font-size: 20px;color: rgb(0, 164, 228);font-weight: bold;"> SET </div>';
1227
+ foreach($table_struct as $col) {
1228
+ $title=' '.$col->Field;
1229
+ $title.="<ul style='padding-left: 17px;'>";
1230
+ $title.="<li>Type - ".$col->Type."</li>";
1231
+ $title.="<li>Null - ".$col->Null."</li>";
1232
+ $title.="<li>Key - ".$col->Key."</li>";
1233
+ $title.="<li>Default - ".$col->Default."</li>";
1234
+ $title.="<li>Extra - ".$col->Extra."</li>";
1235
+ $title.="</ul>";
1236
+ ?>
1237
+ <div><label title="<?php echo $title; ?>" class="hasTip"><b><?php echo $col->Field; ?></b><img src="<?php echo WD_FM_URL . '/images/info.png'; ?>" style="width:20px; vertical-align:middle;padding-left: 10px;" /></label><input type="text" id="<?php echo $col->Field; ?>" disabled="disabled"/><input id="ch_<?php echo $col->Field; ?>" type="checkbox" onClick="dis('<?php echo $col->Field; ?>', this.checked)"/></div>
1238
+ <?php
1239
+ }
1240
+ }
1241
+ if($con_method=='delete' or $con_method=='update') {
1242
+ echo '<div style="background: none;text-align: center;font-size: 20px;color: rgb(0, 164, 228);font-weight: bold;"> WHERE </div>
1243
+
1244
+ <img src="' . WD_FM_URL . '/images/add_condition.png" title="ADD" class="add_cond"/></br>';
1245
+ }
1246
+ ?>
1247
+ </div>
1248
+ <br/>
1249
+ <input type="button" value="Generate Query" class="gen_query" onclick="gen_query()">
1250
+ <br/>
1251
+ <form name="query_form" id="query_form" >
1252
+ <label style="vertical-align: top;" for="query_txt" > Query: </label><textarea id="query_txt" name="query" rows=5 style="width:428px"></textarea>
1253
+ <input type="hidden" name="details" id="details">
1254
+ </form>
1255
+ <input type="button" value="Save" style="float: right;width: 200px;height: 38px;background: #0E73D4;color: white;cursor: pointer;border: 0px;font-size: 16px;font-weight: bold;margin: 20px;" onclick="save_query()">
1256
+ <div id="fieldlist" style="display: none;">
1257
+ <?php echo $form_fields ?>
1258
+ </div>
1259
+ <?php
1260
+ }
1261
+ die();
1262
+ }
1263
+
1264
+ ////////////////////////////////////////////////////////////////////////////////////////
1265
+ // Getters & Setters //
1266
+ ////////////////////////////////////////////////////////////////////////////////////////
1267
+ ////////////////////////////////////////////////////////////////////////////////////////
1268
+ // Private Methods //
1269
+ ////////////////////////////////////////////////////////////////////////////////////////
1270
+ ////////////////////////////////////////////////////////////////////////////////////////
1271
+ // Listeners //
1272
+ ////////////////////////////////////////////////////////////////////////////////////////
1273
+ }
admin/views/FMViewManage_fm.php CHANGED
@@ -1142,18 +1142,9 @@ class FMViewManage_fm {
1142
  }
1143
  document.getElementById('araqel').value = 1;
1144
  }
1145
- function formAddToOnload() {
1146
- if (formOldFunctionOnLoad) {
1147
- formOldFunctionOnLoad();
1148
- }
1149
  formOnload();
1150
- }
1151
- function formLoadBody() {
1152
- formOldFunctionOnLoad = window.onload;
1153
- window.onload = formOnload;
1154
- }
1155
- var formOldFunctionOnLoad = null;
1156
- formLoadBody();
1157
  </script>
1158
  <?php
1159
  }
@@ -2182,18 +2173,9 @@ class FMViewManage_fm {
2182
  document.getElementById('form').value=document.getElementById('take').innerHTML;
2183
  document.getElementById('araqel').value = 1;
2184
  }
2185
- function formAddToOnload() {
2186
- if (formOldFunctionOnLoad) {
2187
- formOldFunctionOnLoad();
2188
- }
2189
  formOnload();
2190
- }
2191
- function formLoadBody() {
2192
- formOldFunctionOnLoad = window.onload;
2193
- window.onload = formAddToOnload;
2194
- }
2195
- var formOldFunctionOnLoad = null;
2196
- formLoadBody();
2197
  </script>
2198
 
2199
  <input type="hidden" name="option" value="com_formmaker" />
@@ -2602,6 +2584,7 @@ class FMViewManage_fm {
2602
  public function form_options($id) {
2603
  $row = $this->model->get_row_data($id);
2604
  $themes = $this->model->get_theme_rows_data();
 
2605
  $page_title = $row->title . ' form options';
2606
  $label_id = array();
2607
  $label_label = array();
@@ -2670,6 +2653,14 @@ class FMViewManage_fm {
2670
  document.getElementById('condition').value = field_condition;
2671
  }
2672
  </script>
 
 
 
 
 
 
 
 
2673
  <div style="clear: both; float: left; width: 99%;">
2674
  <div style="float:left; font-size: 14px; font-weight: bold;">
2675
  This section allows you to edit form options.
@@ -2718,11 +2709,14 @@ class FMViewManage_fm {
2718
  <a id="payment" class="fm_fieldset_tab" onclick="form_maker_options_tabs('payment')" href="#">Payment Options</a>
2719
  </li>
2720
  <li>
2721
- <a id="javascript" class="fm_fieldset_tab" onclick="form_maker_options_tabs('javascript')" href="#">JavaScript</a>
2722
  </li>
2723
  <li>
2724
  <a id="conditions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('conditions')" href="#">Conditional Fields</a>
2725
  </li>
 
 
 
2726
  </ul>
2727
  </div>
2728
  </div>
@@ -3337,7 +3331,7 @@ class FMViewManage_fm {
3337
  <label for="tax">Tax</label>
3338
  </td>
3339
  <td class="fm_options_value">
3340
- <input disabled="disabled" type="text" name="tax" id="tax" value="<?php echo $row->tax; ?>" class="text_area" style="width:30px" onKeyPress="return check_isnum(event)"> %
3341
  </td>
3342
  </tr>
3343
  </table>
@@ -3349,8 +3343,8 @@ class FMViewManage_fm {
3349
  <td class="fm_options_label">
3350
  <label for="javascript">Javascript</label>
3351
  </td>
3352
- <td class="fm_options_value">
3353
- <textarea style="margin: 0px;" cols="60" rows="30" name="javascript" id="javascript"><?php echo $row->javascript; ?></textarea>
3354
  </td>
3355
  </tr>
3356
  </table>
@@ -3444,7 +3438,7 @@ class FMViewManage_fm {
3444
  ?>
3445
  <div>
3446
  <span style="font-size:13px;">Add Condition<span/>
3447
- <img src="<?php echo WD_FM_URL . '/images/add_condition.png'; ?>" title="add" onclick="add_condition('<?php echo $chose_ids; ?>', '<?php echo addslashes($chose_labels); ?>', '<?php echo $chose_types; ?>', '<?php echo $chose_paramss; ?>', '<?php echo $all_ids_cond; ?>', '<?php echo addslashes($all_labels_cond); ?>')" style="cursor: pointer; vertical-align: middle; margin-left:15px;">
3448
  </div>
3449
  <?php
3450
 
@@ -3480,7 +3474,7 @@ class FMViewManage_fm {
3480
  </select>
3481
 
3482
  <span>of the following match:</span>
3483
- <img src="<?php echo WD_FM_URL . '/images/add.png'; ?>" title="add" onclick="add_condition_fields(<?php echo $k; ?>,'<?php echo $chose_ids; ?>', '<?php echo addslashes($chose_labels); ?>', '<?php echo $chose_types; ?>', '<?php echo $chose_paramss; ?>')" style="cursor: pointer; vertical-align: middle;">
3484
 
3485
  <img src="<?php echo WD_FM_URL . '/images/page_delete.png'; ?>" onclick="delete_condition('<?php echo $k; ?>')" style="cursor: pointer; vertical-align: middle;">
3486
  </div>
@@ -3500,7 +3494,7 @@ class FMViewManage_fm {
3500
 
3501
  ?>
3502
  <div id="condition_div<?php echo $k; ?>_<?php echo $key; ?>">
3503
- <select id="field_labels<?php echo $k; ?>_<?php echo $key; ?>" onchange="change_choices(this.options[this.selectedIndex].id+'_<?php echo $key; ?>','<?php echo $chose_ids; ?>', '<?php echo $chose_types; ?>', '<?php echo $chose_paramss; ?>')" style="width:350px;"/>
3504
  <?php
3505
  foreach($labels as $key1 => $value)
3506
  {
@@ -3561,7 +3555,7 @@ class FMViewManage_fm {
3561
  else
3562
  $w_choice = $w_choices_array[$m];
3563
 
3564
- if(in_array($w_choice,$multiselect))
3565
  {
3566
  $selected = 'selected="selected"';
3567
  }
@@ -3615,6 +3609,60 @@ class FMViewManage_fm {
3615
  <input type="hidden" id="condition" name="condition" value="<?php echo $row->condition; ?>" />
3616
 
3617
  </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3618
  <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php echo WDW_FM_Library::get('fieldset_id', 'general'); ?>" />
3619
 
3620
  <input type="hidden" id="task" name="task" value=""/>
@@ -3644,6 +3692,11 @@ class FMViewManage_fm {
3644
  document.getElementById('mail_subject_user_labels').addEventListener('mouseout',hide_email_labels,true);
3645
  }
3646
  });
 
 
 
 
 
3647
  </script>
3648
  <?php
3649
  }
1142
  }
1143
  document.getElementById('araqel').value = 1;
1144
  }
1145
+ jQuery(window).load(function () {
 
 
 
1146
  formOnload();
1147
+ });
 
 
 
 
 
 
1148
  </script>
1149
  <?php
1150
  }
2173
  document.getElementById('form').value=document.getElementById('take').innerHTML;
2174
  document.getElementById('araqel').value = 1;
2175
  }
2176
+ jQuery(window).load(function () {
 
 
 
2177
  formOnload();
2178
+ });
 
 
 
 
 
 
2179
  </script>
2180
 
2181
  <input type="hidden" name="option" value="com_formmaker" />
2584
  public function form_options($id) {
2585
  $row = $this->model->get_row_data($id);
2586
  $themes = $this->model->get_theme_rows_data();
2587
+ $queries = $this->model->get_queries_rows_data($id);
2588
  $page_title = $row->title . ' form options';
2589
  $label_id = array();
2590
  $label_label = array();
2653
  document.getElementById('condition').value = field_condition;
2654
  }
2655
  </script>
2656
+ <style>
2657
+ .CodeMirror {
2658
+ border: 1px solid #ccc;
2659
+ font-size: 12px;
2660
+ margin-bottom: 6px;
2661
+ background: white;
2662
+ }
2663
+ </style>
2664
  <div style="clear: both; float: left; width: 99%;">
2665
  <div style="float:left; font-size: 14px; font-weight: bold;">
2666
  This section allows you to edit form options.
2709
  <a id="payment" class="fm_fieldset_tab" onclick="form_maker_options_tabs('payment')" href="#">Payment Options</a>
2710
  </li>
2711
  <li>
2712
+ <a id="javascript" class="fm_fieldset_tab" onclick="form_maker_options_tabs('javascript'); codemirror_for_javascript();" href="#">JavaScript</a>
2713
  </li>
2714
  <li>
2715
  <a id="conditions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('conditions')" href="#">Conditional Fields</a>
2716
  </li>
2717
+ <li>
2718
+ <a id="mapping" class="fm_fieldset_tab" onclick="form_maker_options_tabs('mapping')" href="#" >SQL Mapping</a>
2719
+ </li>
2720
  </ul>
2721
  </div>
2722
  </div>
3331
  <label for="tax">Tax</label>
3332
  </td>
3333
  <td class="fm_options_value">
3334
+ <input type="text" name="tax" id="tax" value="<?php echo $row->tax; ?>" class="text_area" style="width: 40px;" onKeyPress="return check_isnum_point(event)"> %
3335
  </td>
3336
  </tr>
3337
  </table>
3343
  <td class="fm_options_label">
3344
  <label for="javascript">Javascript</label>
3345
  </td>
3346
+ <td class="fm_options_value" style="width:650px;">
3347
+ <textarea style="margin: 0px; height: 400px; width: 600px;" cols="60" rows="30" name="javascript" id="form_javascript"><?php echo $row->javascript; ?></textarea>
3348
  </td>
3349
  </tr>
3350
  </table>
3438
  ?>
3439
  <div>
3440
  <span style="font-size:13px;">Add Condition<span/>
3441
+ <img src="<?php echo WD_FM_URL . '/images/add_condition.png'; ?>" title="add" onclick="add_condition('<?php echo $chose_ids; ?>', '<?php echo addslashes($chose_labels); ?>', '<?php echo $chose_types; ?>', '<?php echo addslashes($chose_paramss); ?>', '<?php echo $all_ids_cond; ?>', '<?php echo addslashes($all_labels_cond); ?>')" style="cursor: pointer; vertical-align: middle; margin-left:15px;">
3442
  </div>
3443
  <?php
3444
 
3474
  </select>
3475
 
3476
  <span>of the following match:</span>
3477
+ <img src="<?php echo WD_FM_URL . '/images/add.png'; ?>" title="add" onclick="add_condition_fields(<?php echo $k; ?>,'<?php echo $chose_ids; ?>', '<?php echo addslashes($chose_labels); ?>', '<?php echo $chose_types; ?>', '<?php echo addslashes($chose_paramss); ?>')" style="cursor: pointer; vertical-align: middle;">
3478
 
3479
  <img src="<?php echo WD_FM_URL . '/images/page_delete.png'; ?>" onclick="delete_condition('<?php echo $k; ?>')" style="cursor: pointer; vertical-align: middle;">
3480
  </div>
3494
 
3495
  ?>
3496
  <div id="condition_div<?php echo $k; ?>_<?php echo $key; ?>">
3497
+ <select id="field_labels<?php echo $k; ?>_<?php echo $key; ?>" onchange="change_choices(this.options[this.selectedIndex].id+'_<?php echo $key; ?>','<?php echo $chose_ids; ?>', '<?php echo $chose_types; ?>', '<?php echo addslashes($chose_paramss); ?>')" style="width:350px;"/>
3498
  <?php
3499
  foreach($labels as $key1 => $value)
3500
  {
3555
  else
3556
  $w_choice = $w_choices_array[$m];
3557
 
3558
+ if(in_array(esc_html($w_choice),$multiselect))
3559
  {
3560
  $selected = 'selected="selected"';
3561
  }
3609
  <input type="hidden" id="condition" name="condition" value="<?php echo $row->condition; ?>" />
3610
 
3611
  </fieldset>
3612
+
3613
+ <fieldset id="mapping_fieldset" class="adminform fm_fieldset_deactive">
3614
+ <legend style="color:#0B55C4;font-weight: bold;">SQL Mapping</legend>
3615
+ <div>
3616
+ <a href="<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>" class="button-secondary thickbox thickbox-preview" id="add_query" title="Add Query" onclick="return false;">
3617
+ Add Query
3618
+ </a>
3619
+ <button class="button-primary thickbox thickbox-preview" onclick="if (spider_check_email('mail') ||
3620
+ spider_check_email('from_mail') ||
3621
+ spider_check_email('reply_to') ||
3622
+ spider_check_email('mail_from_user') ||
3623
+ spider_check_email('reply_to_user') ||
3624
+ spider_check_email('mail_from_other') ||
3625
+ spider_check_email('reply_to_other') ||
3626
+ spider_check_email('paypal_email')) {return false;}; set_condition(); spider_set_input_value('task', 'remove_query')">Delete</button>
3627
+ </div>
3628
+ <?php
3629
+ if ($queries)
3630
+ {
3631
+ ?>
3632
+ <table class="wp-list-table widefat fixed posts table_content">
3633
+ <thead>
3634
+ <tr>
3635
+ <th style="width:4%;" class="table_small_col count_col sub-align">#</th>
3636
+ <th style="width:4%;" class="table_small_col count_col sub-align">ID</th>
3637
+ <th style="width:6%;" class="manage-column column-cb check-column table_small_col sub-align form_check">
3638
+ <input id="check_all" type="checkbox" style="margin:0;">
3639
+ </th>
3640
+ <th style="width:86%;" class="table_large_col">Query</th>
3641
+ </tr>
3642
+ </thead>
3643
+ <?php
3644
+ $k = 0;
3645
+ for($i=0, $n=count($queries); $i < $n ; $i++) {
3646
+ $query = $queries[$i];
3647
+ $checked = '<input type="checkbox" id="' . $i . '" name="cid[]" value="' . $query->id . '" />';
3648
+ $link = add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $query->id, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
3649
+ ?>
3650
+ <tr <?php if ($k) echo "class=\"alternate\""; ?>>
3651
+ <td align="center" class="table_small_col"><?php echo $i+1; ?></td>
3652
+ <td align="center" class="table_small_col"><?php echo $query->id; ?></td>
3653
+ <td align="center" class="table_small_col check-column"><?php echo $checked; ?></td>
3654
+ <td align="center"><a href="<?php echo $link; ?>" class="thickbox thickbox-preview" onclick="return false;"><?php echo $query->query; ?></a></td>
3655
+ </tr>
3656
+ <?php
3657
+ $k = 1 - $k;
3658
+ }
3659
+ ?>
3660
+ </table>
3661
+ <?php
3662
+ }
3663
+ ?>
3664
+ </fieldset>
3665
+ <input type="hidden" name="boxchecked" value="0">
3666
  <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php echo WDW_FM_Library::get('fieldset_id', 'general'); ?>" />
3667
 
3668
  <input type="hidden" id="task" name="task" value=""/>
3692
  document.getElementById('mail_subject_user_labels').addEventListener('mouseout',hide_email_labels,true);
3693
  }
3694
  });
3695
+ function wd_fm_apply_options() {
3696
+ set_condition();
3697
+ spider_set_input_value('task', 'apply_options');
3698
+ document.getElementById('adminForm').submit();
3699
+ }
3700
  </script>
3701
  <?php
3702
  }
admin/views/FMViewSubmissions_fm.php CHANGED
@@ -1921,9 +1921,7 @@ class FMViewSubmissions_fm {
1921
  $param['attributes'] = $param['attributes'].' '.$attr;
1922
  }
1923
 
1924
- $rep ='<div type="type_hidden" class="wdform-field">
1925
- <div class="wdform-label-section" style="float:left; width: 150px;"><span class="wdform-label">' . $label . '</span></div>
1926
- <div class="wdform-label-section" style="display: table-cell;"></div><div class="wdform-element-section" style="display: table-cell;"><input type="text" value="'.$element_value.'" id="wdform_'.$id1.'_element'.$form_id.'" name="'.$param['w_name'].'" '.$param['attributes'].'></div></div>';
1927
 
1928
  break;
1929
  }
1921
  $param['attributes'] = $param['attributes'].' '.$attr;
1922
  }
1923
 
1924
+ $rep ='<div type="type_hidden" class="wdform-field"><div class="wdform-label-section" style="float:left; width: 150px;"><span class="wdform-label">' . $label . '</span></div><div class="wdform-element-section" style="display: table-cell;"><input type="text" value="'.$element_value.'" id="wdform_'.$id1.'_element'.$form_id.'" name="'.$param['w_name'].'" '.$param['attributes'].'></div></div>';
 
 
1925
 
1926
  break;
1927
  }
admin/views/FMViewThemes_fm.php CHANGED
@@ -158,6 +158,14 @@ class FMViewThemes_fm {
158
  $row = $this->model->get_row_data($id, $reset);
159
  $page_title = (($id != 0) ? 'Edit theme ' . $row->title : 'Create new theme');
160
  ?>
 
 
 
 
 
 
 
 
161
  <div style="clear: both; float: left; width: 99%;">
162
  <div style="float:left; font-size: 14px; font-weight: bold;">
163
  This section allows you to edit form themes.
@@ -193,6 +201,17 @@ class FMViewThemes_fm {
193
  <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>"/>
194
  <input type="hidden" id="default" name="default" value="<?php echo $row->default; ?>"/>
195
  </form>
 
 
 
 
 
 
 
 
 
 
 
196
  <?php
197
  }
198
 
158
  $row = $this->model->get_row_data($id, $reset);
159
  $page_title = (($id != 0) ? 'Edit theme ' . $row->title : 'Create new theme');
160
  ?>
161
+ <style>
162
+ .CodeMirror {
163
+ border: 1px solid #ccc;
164
+ font-size: 12px;
165
+ margin-bottom: 6px;
166
+ background: white;
167
+ }
168
+ </style>
169
  <div style="clear: both; float: left; width: 99%;">
170
  <div style="float:left; font-size: 14px; font-weight: bold;">
171
  This section allows you to edit form themes.
201
  <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>"/>
202
  <input type="hidden" id="default" name="default" value="<?php echo $row->default; ?>"/>
203
  </form>
204
+ <script>
205
+ var editor = CodeMirror.fromTextArea(document.getElementById("css"), {
206
+ lineNumbers: true,
207
+ lineWrapping: true,
208
+ mode: "css"
209
+ });
210
+
211
+ CodeMirror.commands["selectAll"](editor);
212
+ editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
213
+ editor.scrollTo(0,0);
214
+ </script>
215
  <?php
216
  }
217
 
admin/views/FMViewUninstall_fm.php CHANGED
@@ -56,6 +56,7 @@ class FMViewUninstall_fm {
56
  <li><?php echo $prefix; ?>formmaker_views</li>
57
  <li><?php echo $prefix; ?>formmaker_themes</li>
58
  <li><?php echo $prefix; ?>formmaker_sessions</li>
 
59
  </ol>
60
  </td>
61
  </tr>
@@ -98,6 +99,7 @@ class FMViewUninstall_fm {
98
  <p><?php echo $prefix; ?>formmaker_submits,</p>
99
  <p><?php echo $prefix; ?>formmaker_themes,</p>
100
  <p><?php echo $prefix; ?>formmaker_views.</p>
 
101
  </div>
102
  <div class="wrap">
103
  <h2>Uninstall Form Maker</h2>
56
  <li><?php echo $prefix; ?>formmaker_views</li>
57
  <li><?php echo $prefix; ?>formmaker_themes</li>
58
  <li><?php echo $prefix; ?>formmaker_sessions</li>
59
+ <li><?php echo $prefix; ?>formmaker_query</li>
60
  </ol>
61
  </td>
62
  </tr>
99
  <p><?php echo $prefix; ?>formmaker_submits,</p>
100
  <p><?php echo $prefix; ?>formmaker_themes,</p>
101
  <p><?php echo $prefix; ?>formmaker_views.</p>
102
+ <p><?php echo $prefix; ?>formmaker_query.</p>
103
  </div>
104
  <div class="wrap">
105
  <h2>Uninstall Form Maker</h2>
form-maker.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Form Maker
4
  * Plugin URI: http://web-dorado.com/products/form-maker-wordpress.html
5
  * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
- * Version: 1.7.12
7
  * Author: http://web-dorado.com/
8
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
9
  */
@@ -27,8 +27,8 @@ function form_maker_options_panel() {
27
  add_action('admin_print_scripts-' . $blocked_ips_page, 'form_maker_manage_scripts');
28
 
29
  $themes_page = add_submenu_page('manage_fm', 'Themes', 'Themes', 'manage_options', 'themes_fm', 'form_maker');
30
- add_action('admin_print_styles-' . $themes_page, 'form_maker_styles');
31
- add_action('admin_print_scripts-' . $themes_page, 'form_maker_scripts');
32
 
33
  $licensing_plugins_page = add_submenu_page('manage_fm', 'Licensing/Donation', 'Licensing/Donation', 'manage_options', 'licensing_fm', 'form_maker');
34
 
@@ -64,6 +64,7 @@ add_action('wp_ajax_product_option', 'form_maker_ajax'); // Open product options
64
  add_action('wp_ajax_frommapeditinpopup', 'form_maker_ajax'); // Open map in submissions.
65
  add_action('wp_ajax_show_matrix', 'form_maker_ajax'); // Edit matrix in submissions.
66
  add_action('wp_ajax_FormMakerEditCSS', 'form_maker_ajax'); // Edit css from form options.
 
67
 
68
  // add_action('wp_ajax_checkpaypal', 'form_maker_ajax'); // Notify url from Paypal Sandbox.
69
  // add_action('wp_ajax_nopriv_checkpaypal', 'form_maker_ajax'); // Notify url from Paypal Sandbox for all users.
@@ -137,32 +138,7 @@ function Form_maker_fornt_end_main($content) {
137
  }
138
  add_filter('the_content', 'Form_maker_fornt_end_main', 5000);
139
 
140
- function xapel_shortcode_1($content) {
141
- $pattern = '[\[contact_form id="([0-9]*)"\]]';
142
- $count_forms_in_post = preg_match_all($pattern, $content, $matches_form);
143
- if ($count_forms_in_post) {
144
- require_once (WD_FM_DIR . '/frontend/controllers/FMControllerForm_maker.php');
145
- $controller = new FMControllerForm_maker();
146
- for ($jj = 0; $jj < $count_forms_in_post; $jj++) {
147
- $padron = $matches_form[0][$jj];
148
- $replacment = '[contact_form_for_repace id="' . $matches_form[1][$jj] . '"]';
149
- $content = str_replace($padron, $replacment, $content);
150
- }
151
- }
152
- $pattern = '[\[wd_contact_form id="([0-9]*)"\]]';
153
- $count_forms_in_post = preg_match_all($pattern, $content, $matches_form);
154
- if ($count_forms_in_post) {
155
- require_once (WD_FM_DIR . '/frontend/controllers/FMControllerForm_maker.php');
156
- $controller = new FMControllerForm_maker();
157
- for ($jj = 0; $jj < $count_forms_in_post; $jj++) {
158
- $padron = $matches_form[0][$jj];
159
- $replacment = '[contact_form_for_repace id="' . $matches_form[1][$jj] . '"]';
160
- $content = str_replace($padron, $replacment, $content);
161
- }
162
- }
163
- return $content;
164
- }
165
- // add_filter('the_content', 'xapel_shortcode_1', 1);
166
 
167
  // Add the Form Maker button to editor.
168
  add_action('wp_ajax_formmakerwindow', 'form_maker_ajax');
@@ -186,7 +162,7 @@ if (class_exists('WP_Widget')) {
186
  // Activate plugin.
187
  function form_maker_activate() {
188
  $version = get_option("wd_form_maker_version");
189
- $new_version = '1.7.6';
190
  if (!$version) {
191
  add_option("wd_form_maker_version", $new_version, '', 'no');
192
  global $wpdb;
3
  * Plugin Name: Form Maker
4
  * Plugin URI: http://web-dorado.com/products/form-maker-wordpress.html
5
  * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
+ * Version: 1.7.13
7
  * Author: http://web-dorado.com/
8
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
9
  */
27
  add_action('admin_print_scripts-' . $blocked_ips_page, 'form_maker_manage_scripts');
28
 
29
  $themes_page = add_submenu_page('manage_fm', 'Themes', 'Themes', 'manage_options', 'themes_fm', 'form_maker');
30
+ add_action('admin_print_styles-' . $themes_page, 'form_maker_manage_styles');
31
+ add_action('admin_print_scripts-' . $themes_page, 'form_maker_manage_scripts');
32
 
33
  $licensing_plugins_page = add_submenu_page('manage_fm', 'Licensing/Donation', 'Licensing/Donation', 'manage_options', 'licensing_fm', 'form_maker');
34
 
64
  add_action('wp_ajax_frommapeditinpopup', 'form_maker_ajax'); // Open map in submissions.
65
  add_action('wp_ajax_show_matrix', 'form_maker_ajax'); // Edit matrix in submissions.
66
  add_action('wp_ajax_FormMakerEditCSS', 'form_maker_ajax'); // Edit css from form options.
67
+ add_action('wp_ajax_FormMakerSQLMapping', 'form_maker_ajax'); // Add/Edit SQLMaping from form options.
68
 
69
  // add_action('wp_ajax_checkpaypal', 'form_maker_ajax'); // Notify url from Paypal Sandbox.
70
  // add_action('wp_ajax_nopriv_checkpaypal', 'form_maker_ajax'); // Notify url from Paypal Sandbox for all users.
138
  }
139
  add_filter('the_content', 'Form_maker_fornt_end_main', 5000);
140
 
141
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
  // Add the Form Maker button to editor.
144
  add_action('wp_ajax_formmakerwindow', 'form_maker_ajax');
162
  // Activate plugin.
163
  function form_maker_activate() {
164
  $version = get_option("wd_form_maker_version");
165
+ $new_version = '1.7.13';
166
  if (!$version) {
167
  add_option("wd_form_maker_version", $new_version, '', 'no');
168
  global $wpdb;
form_maker_insert.php CHANGED
@@ -162,6 +162,15 @@ function from_maker_insert() {
162
  PRIMARY KEY (`id`)
163
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
164
  $wpdb->query($formmaker_sessions);
 
 
 
 
 
 
 
 
 
165
  return;
166
  }
167
 
162
  PRIMARY KEY (`id`)
163
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
164
  $wpdb->query($formmaker_sessions);
165
+
166
+ $formmaker_query = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "formmaker_query` (
167
+ `id` int(11) NOT NULL AUTO_INCREMENT,
168
+ `form_id` int(11) NOT NULL,
169
+ `query` text NOT NULL,
170
+ `details` text NOT NULL,
171
+ PRIMARY KEY (`id`)
172
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
173
+ $wpdb->query($formmaker_query);
174
  return;
175
  }
176
 
form_maker_update.php CHANGED
@@ -78,6 +78,16 @@ function form_maker_update($version) {
78
 
79
  $wpdb->query('UPDATE ' . $wpdb->prefix . 'formmaker SET `mail_mode` = 1, `mail_mode_user` = 1, `mail_attachment` = 1, `mail_attachment_user` = 1');
80
  }
 
 
 
 
 
 
 
 
 
 
81
  return;
82
  }
83
 
78
 
79
  $wpdb->query('UPDATE ' . $wpdb->prefix . 'formmaker SET `mail_mode` = 1, `mail_mode_user` = 1, `mail_attachment` = 1, `mail_attachment_user` = 1');
80
  }
81
+ if (version_compare($version, '1.7.13') == -1) {
82
+ $formmaker_query = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "formmaker_query` (
83
+ `id` int(11) NOT NULL AUTO_INCREMENT,
84
+ `form_id` int(11) NOT NULL,
85
+ `query` text NOT NULL,
86
+ `details` text NOT NULL,
87
+ PRIMARY KEY (`id`)
88
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
89
+ $wpdb->query($formmaker_query);
90
+ }
91
  return;
92
  }
93
 
frontend/models/FMModelForm_maker.php CHANGED
@@ -170,6 +170,7 @@ class FMModelForm_maker {
170
  array_push($label_type, $label_order_each[1]);
171
  }
172
  $max = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
 
173
  if ($old == FALSE || ($old == TRUE && $form->form == '')) {
174
  foreach ($label_type as $key => $type) {
175
  $value = '';
@@ -669,6 +670,7 @@ class FMModelForm_maker {
669
  }
670
  }
671
  $save_or_no = TRUE;
 
672
  if ($form->savedb) {
673
  $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
674
  'form_id' => $id,
@@ -1145,6 +1147,40 @@ class FMModelForm_maker {
1145
  }
1146
  }
1147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1148
  $str = '';
1149
 
1150
  if ($form->paypal_mode) {
170
  array_push($label_type, $label_order_each[1]);
171
  }
172
  $max = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
173
+ $fvals=array();
174
  if ($old == FALSE || ($old == TRUE && $form->form == '')) {
175
  foreach ($label_type as $key => $type) {
176
  $value = '';
670
  }
671
  }
672
  $save_or_no = TRUE;
673
+ $fvals['{'.$i.'}']=str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***"), array(" ", "", " ", " ", " ", ", "), addslashes($value));
674
  if ($form->savedb) {
675
  $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
676
  'form_id' => $id,
1147
  }
1148
  }
1149
 
1150
+ $queries = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=".$id);
1151
+ if($queries)
1152
+ {
1153
+ foreach($queries as $query)
1154
+ {
1155
+ $temp = explode('***wdfcon_typewdf***',$query->details);
1156
+ $con_type = $temp[0];
1157
+ $temp = explode('***wdfcon_methodwdf***',$temp[1]);
1158
+ $con_method = $temp[0];
1159
+ $temp = explode('***wdftablewdf***',$temp[1]);
1160
+ $table_cur = $temp[0];
1161
+ $temp = explode('***wdfhostwdf***',$temp[1]);
1162
+ $host = $temp[0];
1163
+ $temp = explode('***wdfportwdf***',$temp[1]);
1164
+ $port = $temp[0];
1165
+ $temp = explode('***wdfusernamewdf***',$temp[1]);
1166
+ $username = $temp[0];
1167
+ $temp = explode('***wdfpasswordwdf***',$temp[1]);
1168
+ $password = $temp[0];
1169
+ $temp = explode('***wdfdatabasewdf***',$temp[1]);
1170
+ $database = $temp[0];
1171
+
1172
+ $query=str_replace(array_keys($fvals), $fvals ,$query->query);
1173
+ if($con_type == 'remote')
1174
+ {
1175
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
1176
+ $wpdb_temp->query($query);
1177
+ }
1178
+ else {
1179
+ $wpdb->query($query);
1180
+ }
1181
+ }
1182
+ // $wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
1183
+ }
1184
  $str = '';
1185
 
1186
  if ($form->paypal_mode) {
frontend/views/FMViewForm_maker.php CHANGED
@@ -207,8 +207,8 @@ class FMViewForm_maker {
207
 
208
  foreach($cond_params as $key=>$param)
209
  {
210
- $params_value = explode('***',html_entity_decode($param));
211
-
212
  switch($type_and_id[$params_value[0]])
213
  {
214
  case "type_text":
@@ -1361,6 +1361,11 @@ class FMViewForm_maker {
1361
  if($is_other) {
1362
  $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.(isset($_POST['wdform_'.$id1."_other_input".$form_id]) ? $_POST['wdform_'.$id1."_other_input".$form_id] : '').'");';
1363
  }
 
 
 
 
 
1364
  $onsubmit_js.='
1365
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#form'.$form_id.'");
1366
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#form'.$form_id.'");
@@ -1446,7 +1451,11 @@ class FMViewForm_maker {
1446
  if($is_other) {
1447
  $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.(isset($_POST['wdform_'.$id1."_other_input".$form_id]) ? $_POST['wdform_'.$id1."_other_input".$form_id] : '').'");';
1448
  }
1449
-
 
 
 
 
1450
  $onsubmit_js.='
1451
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#form'.$form_id.'");
1452
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#form'.$form_id.'");
@@ -1782,7 +1791,6 @@ class FMViewForm_maker {
1782
  }
1783
  else {
1784
  $w_year_type = '<input type="text" value="'.$param['w_year'].'" id="wdform_'.$id1.'_year'.$form_id.'" name="wdform_'.$id1.'_year'.$form_id.'" from="'.$param['w_from'].'" to="'.$param['w_to'].'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'>';
1785
- $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").blur(function() {check_year2(this)});';
1786
  $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").keypress(function() {return check_year1(event, this)});';
1787
  $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").change(function() {change_year(this)});';
1788
  }
@@ -3157,6 +3165,25 @@ class FMViewForm_maker {
3157
  }
3158
  });
3159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3160
  <?php echo $onload_js; ?>
3161
  <?php echo $condition_js; ?>
3162
 
207
 
208
  foreach($cond_params as $key=>$param)
209
  {
210
+ $params_value = explode('***',wp_specialchars_decode($param, 'single'));
211
+ if(isset($type_and_id[$params_value[0]]))
212
  switch($type_and_id[$params_value[0]])
213
  {
214
  case "type_text":
1361
  if($is_other) {
1362
  $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.(isset($_POST['wdform_'.$id1."_other_input".$form_id]) ? $_POST['wdform_'.$id1."_other_input".$form_id] : '').'");';
1363
  }
1364
+ if($param['w_randomize']=='yes')
1365
+ {
1366
+ $onload_js .='jQuery("#form'.$form_id.' div[wdid='.$id1.'] .wdform-element-section> div").shuffle();
1367
+ ';
1368
+ }
1369
  $onsubmit_js.='
1370
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#form'.$form_id.'");
1371
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#form'.$form_id.'");
1451
  if($is_other) {
1452
  $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.(isset($_POST['wdform_'.$id1."_other_input".$form_id]) ? $_POST['wdform_'.$id1."_other_input".$form_id] : '').'");';
1453
  }
1454
+ if($param['w_randomize']=='yes')
1455
+ {
1456
+ $onload_js .='jQuery("#form'.$form_id.' div[wdid='.$id1.'] .wdform-element-section> div").shuffle();
1457
+ ';
1458
+ }
1459
  $onsubmit_js.='
1460
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#form'.$form_id.'");
1461
  jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#form'.$form_id.'");
1791
  }
1792
  else {
1793
  $w_year_type = '<input type="text" value="'.$param['w_year'].'" id="wdform_'.$id1.'_year'.$form_id.'" name="wdform_'.$id1.'_year'.$form_id.'" from="'.$param['w_from'].'" to="'.$param['w_to'].'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'>';
 
1794
  $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").keypress(function() {return check_year1(event, this)});';
1795
  $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").change(function() {change_year(this)});';
1796
  }
3165
  }
3166
  });
3167
 
3168
+ (function(jQuery){
3169
+ jQuery.fn.shuffle = function() {
3170
+ var allElems = this.get(),
3171
+ getRandom = function(max) {
3172
+ return Math.floor(Math.random() * max);
3173
+ },
3174
+ shuffled = jQuery.map(allElems, function(){
3175
+ var random = getRandom(allElems.length),
3176
+ randEl = jQuery(allElems[random]).clone(true)[0];
3177
+ allElems.splice(random, 1);
3178
+ return randEl;
3179
+ });
3180
+ this.each(function(i){
3181
+ jQuery(this).replaceWith(jQuery(shuffled[i]));
3182
+ });
3183
+ return jQuery(shuffled);
3184
+ };
3185
+ })(jQuery);
3186
+
3187
  <?php echo $onload_js; ?>
3188
  <?php echo $condition_js; ?>
3189
 
js/form_maker_manage.js CHANGED
@@ -347,6 +347,9 @@ function refresh_old() {
347
  }
348
 
349
  function form_maker_options_tabs(id) {
 
 
 
350
  jQuery("#fieldset_id").val(id);
351
  jQuery(".fm_fieldset_active").removeClass("fm_fieldset_active").addClass("fm_fieldset_deactive");
352
  jQuery("#" + id + "_fieldset").removeClass("fm_fieldset_deactive").addClass("fm_fieldset_active");
@@ -355,6 +358,18 @@ function form_maker_options_tabs(id) {
355
  return false;
356
  }
357
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  function set_type(type) {
359
  switch(type) {
360
  case 'post':
@@ -641,7 +656,7 @@ function add_condition_fields(num, ids1, labels1, types1, params1)
641
 
642
  var labels_select = document.createElement('select');
643
  labels_select.setAttribute("id", "field_labels"+num+'_'+m);
644
- labels_select.setAttribute("onchange", "change_choices(options[selectedIndex].id+'_"+m+"','"+ids1+"','"+types1+"','"+params1+"')");
645
  labels_select.style.cssText="width:350px; vertical-align:top;";
646
 
647
  for(k=0; k<labels.length; k++)
@@ -875,7 +890,7 @@ function add_condition(ids1, labels1, types1, params1, all_ids, all_labels)
875
 
876
  var add_img = document.createElement('img');
877
  add_img.setAttribute('src',plugin_url + '/images/add.png');
878
- add_img.setAttribute('onClick','add_condition_fields("'+num+'", "'+ids1+'", "'+labels1+'", "'+types1+'", "'+params1+'")');
879
  add_img.style.cssText = "cursor: pointer; vertical-align: middle;";
880
 
881
  var delete_img = document.createElement('img');
347
  }
348
 
349
  function form_maker_options_tabs(id) {
350
+ if (spider_check_email('mail') || spider_check_email('from_mail') || spider_check_email('reply_to') || spider_check_email('mail_from_user') || spider_check_email('reply_to_user') || spider_check_email('mail_from_other') || spider_check_email('reply_to_other') || spider_check_email('paypal_email')) {
351
+ return false;
352
+ }
353
  jQuery("#fieldset_id").val(id);
354
  jQuery(".fm_fieldset_active").removeClass("fm_fieldset_active").addClass("fm_fieldset_deactive");
355
  jQuery("#" + id + "_fieldset").removeClass("fm_fieldset_deactive").addClass("fm_fieldset_active");
358
  return false;
359
  }
360
 
361
+ function codemirror_for_javascript() {
362
+ var editor = CodeMirror.fromTextArea(document.getElementById("form_javascript"), {
363
+ lineNumbers: true,
364
+ lineWrapping: true,
365
+ mode: "javascript"
366
+ });
367
+
368
+ CodeMirror.commands["selectAll"](editor);
369
+ editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
370
+ editor.scrollTo(0,0);
371
+ }
372
+
373
  function set_type(type) {
374
  switch(type) {
375
  case 'post':
656
 
657
  var labels_select = document.createElement('select');
658
  labels_select.setAttribute("id", "field_labels"+num+'_'+m);
659
+ labels_select.setAttribute("onchange", "change_choices(options[selectedIndex].id+'_"+m+"','"+ids1+"','"+types1+"','"+params1.replace(/\'/g,"\\'")+"')");
660
  labels_select.style.cssText="width:350px; vertical-align:top;";
661
 
662
  for(k=0; k<labels.length; k++)
890
 
891
  var add_img = document.createElement('img');
892
  add_img.setAttribute('src',plugin_url + '/images/add.png');
893
+ add_img.setAttribute('onClick','add_condition_fields("'+num+'", "'+ids1+'", "'+labels1+'", "'+types1.replace(/\'/g,"\\'")+'", "'+params1.replace(/\'/g,"\\'")+'")');
894
  add_img.style.cssText = "cursor: pointer; vertical-align: middle;";
895
 
896
  var delete_img = document.createElement('img');
js/formmaker_div_free.js CHANGED
@@ -2560,8 +2560,8 @@ function close_window() {
2560
  document.getElementById('edit_table').innerHTML = "";
2561
  document.getElementById('show_table').innerHTML = "";
2562
  document.getElementById('main_editor').style.display = "none";
2563
- if (document.getElementById('form_maker_editor_ifr')) {
2564
- ifr_id = 'form_maker_editor_ifr';
2565
  ifr = getIFrameDocument(ifr_id);
2566
  ifr.body.innerHTML = "";
2567
  }
@@ -3767,8 +3767,8 @@ return rv;
3767
  }
3768
 
3769
  function delete_last_child() {
3770
- if (document.getElementById('form_maker_editor_ifr')) {
3771
- ifr_id = 'form_maker_editor_ifr';
3772
  ifr = getIFrameDocument(ifr_id);
3773
  ifr.body.innerHTML = "";
3774
  }
@@ -4077,8 +4077,8 @@ function type_section_break(i, w_editor) {
4077
  document.getElementById('main_editor').style.left=iReturnLeft+195+"px";
4078
  document.getElementById('main_editor').style.top=iReturnTop+70+"px";
4079
 
4080
- if (document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display == "none") {
4081
- ifr_id = 'form_maker_editor_ifr';
4082
  ifr = getIFrameDocument(ifr_id);
4083
  ifr.body.innerHTML = w_editor;
4084
  }
@@ -4113,8 +4113,8 @@ function type_editor(i, w_editor) {
4113
  document.getElementById('main_editor').style.left=iReturnLeft+195+"px";
4114
  document.getElementById('main_editor').style.top=iReturnTop+70+"px";
4115
 
4116
- if (document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display=="none") {
4117
- ifr_id='form_maker_editor_ifr';
4118
  ifr=getIFrameDocument(ifr_id);
4119
  ifr.body.innerHTML=w_editor;
4120
  }
@@ -26298,8 +26298,7 @@ function add(key) {
26298
  wdform_field_in_editor=document.getElementById(i+"_element_sectionform_id_temp");
26299
 
26300
 
26301
-
26302
- ifr_id='form_maker_editor_ifr';
26303
  ifr=getIFrameDocument(ifr_id);
26304
  if(document.getElementById('form_maker_editor').style.display=="none")
26305
  wdform_field_in_editor.innerHTML=ifr.body.innerHTML;
@@ -26379,7 +26378,7 @@ function add(key) {
26379
  in_editor.setAttribute("class", 'wdform_section_break');
26380
 
26381
 
26382
- ifr_id='form_maker_editor_ifr';
26383
  ifr=getIFrameDocument(ifr_id)
26384
 
26385
  if(document.getElementById('form_maker_editor').style.display=="none")
@@ -26875,7 +26874,7 @@ function add(key) {
26875
  td_PAGEDOWN.appendChild(img_PAGEDOWN);
26876
 
26877
 
26878
- ifr_id='form_maker_editor_ifr';
26879
  ifr=getIFrameDocument(ifr_id)
26880
 
26881
  if(document.getElementById('form_maker_editor').style.display=="none")
@@ -27336,13 +27335,11 @@ function edit(id)
27336
  t=0;
27337
 
27338
  /////////shat handipox
27339
-
27340
- if (document.getElementById(id+'_element_labelform_id_temp').innerHTML) {
27341
- w_field_label = document.getElementById(id+'_element_labelform_id_temp').innerHTML;
27342
- }
27343
- else {
27344
- w_field_label = " ";
27345
- }
27346
 
27347
  if(document.getElementById(id+'_label_sectionform_id_temp'))
27348
  if(document.getElementById(id+'_label_sectionform_id_temp').style.display=="block")
2560
  document.getElementById('edit_table').innerHTML = "";
2561
  document.getElementById('show_table').innerHTML = "";
2562
  document.getElementById('main_editor').style.display = "none";
2563
+ if (document.getElementById("form_maker_editor_ifr")) {
2564
+ ifr_id = "form_maker_editor_ifr";
2565
  ifr = getIFrameDocument(ifr_id);
2566
  ifr.body.innerHTML = "";
2567
  }
3767
  }
3768
 
3769
  function delete_last_child() {
3770
+ if (document.getElementById("form_maker_editor_ifr")) {
3771
+ ifr_id = "form_maker_editor_ifr";
3772
  ifr = getIFrameDocument(ifr_id);
3773
  ifr.body.innerHTML = "";
3774
  }
4077
  document.getElementById('main_editor').style.left=iReturnLeft+195+"px";
4078
  document.getElementById('main_editor').style.top=iReturnTop+70+"px";
4079
 
4080
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
4081
+ ifr_id = "form_maker_editor_ifr";
4082
  ifr = getIFrameDocument(ifr_id);
4083
  ifr.body.innerHTML = w_editor;
4084
  }
4113
  document.getElementById('main_editor').style.left=iReturnLeft+195+"px";
4114
  document.getElementById('main_editor').style.top=iReturnTop+70+"px";
4115
 
4116
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
4117
+ ifr_id = "form_maker_editor_ifr";
4118
  ifr=getIFrameDocument(ifr_id);
4119
  ifr.body.innerHTML=w_editor;
4120
  }
26298
  wdform_field_in_editor=document.getElementById(i+"_element_sectionform_id_temp");
26299
 
26300
 
26301
+ ifr_id = "form_maker_editor_ifr";
 
26302
  ifr=getIFrameDocument(ifr_id);
26303
  if(document.getElementById('form_maker_editor').style.display=="none")
26304
  wdform_field_in_editor.innerHTML=ifr.body.innerHTML;
26378
  in_editor.setAttribute("class", 'wdform_section_break');
26379
 
26380
 
26381
+ ifr_id = "form_maker_editor_ifr";
26382
  ifr=getIFrameDocument(ifr_id)
26383
 
26384
  if(document.getElementById('form_maker_editor').style.display=="none")
26874
  td_PAGEDOWN.appendChild(img_PAGEDOWN);
26875
 
26876
 
26877
+ ifr_id = "form_maker_editor_ifr";
26878
  ifr=getIFrameDocument(ifr_id)
26879
 
26880
  if(document.getElementById('form_maker_editor').style.display=="none")
27335
  t=0;
27336
 
27337
  /////////shat handipox
27338
+
27339
+ if(document.getElementById(id+'_element_labelform_id_temp').innerHTML)
27340
+ w_field_label=document.getElementById(id+'_element_labelform_id_temp').innerHTML;
27341
+ else
27342
+ w_field_label=" ";
 
 
27343
 
27344
  if(document.getElementById(id+'_label_sectionform_id_temp'))
27345
  if(document.getElementById(id+'_label_sectionform_id_temp').style.display=="block")
js/formmaker_free.js CHANGED
@@ -2364,8 +2364,8 @@ function close_window() {
2364
  document.getElementById('edit_table').innerHTML = "";
2365
  document.getElementById('show_table').innerHTML = "";
2366
  document.getElementById('main_editor').style.display = "none";
2367
- if (document.getElementById('form_maker_editor_ifr')) {
2368
- ifr_id = 'form_maker_editor_ifr';
2369
  ifr = getIFrameDocument(ifr_id);
2370
  ifr.body.innerHTML = "";
2371
  }
@@ -3396,22 +3396,21 @@ function remove_option(id, num) {
3396
  choices_td.removeChild(br);
3397
  }
3398
 
3399
- function getIFrameDocument(aID) {
3400
- var rv = null;
3401
- // If contentDocument exists, W3C compliant (Mozilla).
3402
- if (document.getElementById(aID).contentDocument) {
3403
- rv = document.getElementById(aID).contentDocument;
3404
- }
3405
- else {
3406
- // IE.
3407
- rv = document.frames[aID].document;
3408
- }
3409
- return rv;
3410
  }
3411
 
3412
  function delete_last_child() {
3413
- if (document.getElementById('form_maker_editor_ifr')) {
3414
- ifr_id = 'form_maker_editor_ifr';
3415
  ifr = getIFrameDocument(ifr_id);
3416
  ifr.body.innerHTML = "";
3417
  }
@@ -3643,8 +3642,8 @@ function type_section_break(i, w_editor) {
3643
  document.getElementById('main_editor').style.display="block";
3644
  document.getElementById('main_editor').style.left=iReturnLeft + 195 + "px";
3645
  document.getElementById('main_editor').style.top=iReturnTop + 70 + "px";
3646
- if (document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display == "none") {
3647
- ifr_id = 'form_maker_editor_ifr';
3648
  ifr = getIFrameDocument(ifr_id);
3649
  ifr.body.innerHTML = w_editor;
3650
  }
@@ -3682,8 +3681,8 @@ function type_editor(i, w_editor){
3682
 
3683
 
3684
 
3685
- if (document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display=="none") {
3686
- ifr_id='form_maker_editor_ifr';
3687
  ifr=getIFrameDocument(ifr_id);
3688
  ifr.body.innerHTML=w_editor;
3689
  }
@@ -25194,9 +25193,8 @@ function add(key) {
25194
  in_editor.setAttribute('class', 'toolbar_padding');
25195
 
25196
 
25197
- if(document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display=="none")
25198
- {
25199
- ifr_id='form_maker_editor_ifr';
25200
  ifr=getIFrameDocument(ifr_id);
25201
  in_editor.innerHTML=ifr.body.innerHTML;
25202
  }
@@ -25349,9 +25347,8 @@ function add(key) {
25349
 
25350
 
25351
 
25352
- if(document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display=="none")
25353
- {
25354
- ifr_id='form_maker_editor_ifr';
25355
  ifr=getIFrameDocument(ifr_id)
25356
  in_editor.innerHTML=ifr.body.innerHTML;
25357
  }
@@ -25857,9 +25854,8 @@ function add(key) {
25857
  in_editor.setAttribute('class', 'toolbar_padding');
25858
 
25859
 
25860
- if(document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display=="none")
25861
- {
25862
- ifr_id='form_maker_editor_ifr';
25863
  ifr=getIFrameDocument(ifr_id);
25864
  in_editor.innerHTML=ifr.body.innerHTML;
25865
  }
@@ -26055,9 +26051,8 @@ function add(key) {
26055
 
26056
 
26057
 
26058
- if(document.getElementById('form_maker_editor_ifr') && document.getElementById('form_maker_editor').style.display=="none")
26059
- {
26060
- ifr_id='form_maker_editor_ifr';
26061
  ifr=getIFrameDocument(ifr_id)
26062
  in_editor.innerHTML=ifr.body.innerHTML;
26063
  }
2364
  document.getElementById('edit_table').innerHTML = "";
2365
  document.getElementById('show_table').innerHTML = "";
2366
  document.getElementById('main_editor').style.display = "none";
2367
+ if (document.getElementById("form_maker_editor_ifr")) {
2368
+ ifr_id = "form_maker_editor_ifr";
2369
  ifr = getIFrameDocument(ifr_id);
2370
  ifr.body.innerHTML = "";
2371
  }
3396
  choices_td.removeChild(br);
3397
  }
3398
 
3399
+ function getIFrameDocument(aID){
3400
+ var rv = null;
3401
+ // if contentDocument exists, W3C compliant (Mozilla)
3402
+ if (document.getElementById(aID) && document.getElementById(aID).contentDocument){
3403
+ rv = document.getElementById(aID).contentDocument;
3404
+ } else if (document.getElementById(aID)) {
3405
+ // IE
3406
+ rv = document.frames[aID].document;
3407
+ }
3408
+ return rv;
 
3409
  }
3410
 
3411
  function delete_last_child() {
3412
+ if (document.getElementById("form_maker_editor_ifr")) {
3413
+ ifr_id = "form_maker_editor_ifr";
3414
  ifr = getIFrameDocument(ifr_id);
3415
  ifr.body.innerHTML = "";
3416
  }
3642
  document.getElementById('main_editor').style.display="block";
3643
  document.getElementById('main_editor').style.left=iReturnLeft + 195 + "px";
3644
  document.getElementById('main_editor').style.top=iReturnTop + 70 + "px";
3645
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
3646
+ ifr_id = "form_maker_editor_ifr";
3647
  ifr = getIFrameDocument(ifr_id);
3648
  ifr.body.innerHTML = w_editor;
3649
  }
3681
 
3682
 
3683
 
3684
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
3685
+ ifr_id = "form_maker_editor_ifr";
3686
  ifr=getIFrameDocument(ifr_id);
3687
  ifr.body.innerHTML=w_editor;
3688
  }
25193
  in_editor.setAttribute('class', 'toolbar_padding');
25194
 
25195
 
25196
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
25197
+ ifr_id = "form_maker_editor_ifr";
 
25198
  ifr=getIFrameDocument(ifr_id);
25199
  in_editor.innerHTML=ifr.body.innerHTML;
25200
  }
25347
 
25348
 
25349
 
25350
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
25351
+ ifr_id = "form_maker_editor_ifr";
 
25352
  ifr=getIFrameDocument(ifr_id)
25353
  in_editor.innerHTML=ifr.body.innerHTML;
25354
  }
25854
  in_editor.setAttribute('class', 'toolbar_padding');
25855
 
25856
 
25857
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
25858
+ ifr_id = "form_maker_editor_ifr";
 
25859
  ifr=getIFrameDocument(ifr_id);
25860
  in_editor.innerHTML=ifr.body.innerHTML;
25861
  }
26051
 
26052
 
26053
 
26054
+ if (document.getElementById("form_maker_editor_ifr") && document.getElementById('form_maker_editor').style.display == "none") {
26055
+ ifr_id = "form_maker_editor_ifr";
 
26056
  ifr=getIFrameDocument(ifr_id)
26057
  in_editor.innerHTML=ifr.body.innerHTML;
26058
  }
js/main_div_front_end.js CHANGED
@@ -1 +1 @@
1
- F=2;
2
  var chCode1 = e.which || e.keyCode;
3
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
4
  return false;
5
  if(document.getElementById(num+'_total_element'+form_id)){
6
  var chCode1 = e.which || e.keyCode;
7
  if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
8
  return true;
9
  return false;
10
  var chCode1 = e.which || e.keyCode;
11
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
12
  return false;
13
  return false;
14
  var chCode1 = e.which || e.keyCode;
15
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
16
  return false;
17
  return false;
18
  var chCode1 = e.which || e.keyCode;
19
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
20
  return false;
21
  return false;
22
  var chCode1 = e.which || e.keyCode;
23
  if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
24
  return true;
25
  }
26
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
27
  return false;
28
  }
29
  return false;
30
  return false;
31
  return false;
32
  var chCode1 = e.which || e.keyCode;
33
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
34
  return false;
35
  return false;
36
  return false;
37
  return false;
38
  var chCode1 = e.which || e.keyCode;
39
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
40
  return false;
41
  return false;
42
  return false;
43
  return false;
44
  var chCode1 = e.which || e.keyCode;
45
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
46
  return false;
47
  return false;
48
  while (node.firstChild)
49
  node.removeChild(node.firstChild);
50
 
51
  }
52
 
53
  }
54
  jQuery('.wdform-element-section').each(function() {
55
  var div_parent = document.createElement('div');
56
  div_parent.setAttribute("class", "page_percentage_deactive");
57
  var div = document.createElement('div');
58
  div.setAttribute("id", "div_percentage");
59
  div.setAttribute("class", "page_percentage_active");
60
  div.setAttribute("align", "right");
61
  var div_arrow = document.createElement('div');
62
  div_arrow.setAttribute("class", "wdform_percentage_arrow");
63
  b.setAttribute("class", "wdform_percentage_text");
64
  var curtop = 0;
65
  if (obj.offsetParent) {
66
  do {
67
  curtop += obj.offsetTop;
68
  } while (obj = obj.offsetParent);
69
  return [curtop];
70
  }
71
  addclass = typeof(addclass) != 'undefined' ? addclass : '';
72
  jQuery(select).wrap('<div class="sel-wrap ' + addclass + '"/>');
73
  var sel_options = '';
74
  var selected_option = false;
75
  jQuery(select).children('option').each(function() {
76
  if(jQuery(this).is(':selected')){
77
  selected_option = jQuery(this).index();
78
  }
79
  sel_options = sel_options + '<div class="sel-option" value="' + jQuery(this).val() + '">' + jQuery(this).html() + '</div>';
80
  });
81
  <div class="sel-selected">\
82
  <div class="selected-text">' + jQuery(select).children('option').eq(selected_option).html() + '</div>\
83
  <div class="sel-arraw"></div>\
84
  </div>\
85
  <div class="sel-options">' + sel_options + '</div>\
86
  </div>';
87
  jQuery(select).before(sel_imul);
88
  jQuery('.sel-imul').removeClass('act');
89
  jQuery(this).addClass('act');
90
  if (jQuery(this).children('.sel-options').is(':visible')) {
91
  jQuery('.sel-options').hide();
92
  }
93
  else {
94
  jQuery('.sel-options').hide();
95
  jQuery(this).children('.sel-options').show();
96
  }
97
  var tektext = jQuery(this).html();
98
  jQuery(this).parent('.sel-options').parent('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext);
99
  jQuery(this).parent('.sel-options').children('.sel-option').removeClass('sel-ed');
100
  jQuery(this).addClass('sel-ed');
101
  var tekval = jQuery(this).attr('value');
102
  tekval = typeof(tekval) != 'undefined' ? tekval : tektext;
103
  jQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').children('option').removeAttr('selected').each(function() {
104
  if (jQuery(this).html() == tektext) {
105
 
106
  jQuery(this).attr('selected', 'select');
107
  }
108
  });
109
  selenter = true;
110
  selenter = false;
111
  if (!selenter) {
112
  jQuery('.sel-options').hide();
113
  jQuery('.sel-imul').removeClass('act');
114
  }
115
  if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
 
116
  var chCode1 = e.which || e.keyCode;
117
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
118
  return false;
119
  if(document.getElementById(num+'_total_element'+form_id)){
120
  var chCode1 = e.which || e.keyCode;
121
  if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
122
  return true;
123
  return false;
124
  var chCode1 = e.which || e.keyCode;
125
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
126
  return false;
127
  return false;
128
  var chCode1 = e.which || e.keyCode;
129
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
130
  return false;
131
  return false;
132
  var chCode1 = e.which || e.keyCode;
133
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
134
  return false;
135
  return false;
136
  var chCode1 = e.which || e.keyCode;
137
  if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
138
  return true;
139
  }
140
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
141
  return false;
142
  }
143
  return false;
144
  return false;
145
  return false;
146
  var chCode1 = e.which || e.keyCode;
147
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
148
  return false;
149
  return false;
150
  return false;
151
  return false;
152
  var chCode1 = e.which || e.keyCode;
153
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
154
  return false;
155
  return false;
156
  return false;
157
  return false;
158
  var chCode1 = e.which || e.keyCode;
159
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
160
  return false;
161
  return false;
162
  while (node.firstChild)
163
  node.removeChild(node.firstChild);
164
 
165
  }
166
 
167
  }
168
  jQuery('.wdform-element-section').each(function() {
169
  var div_parent = document.createElement('div');
170
  div_parent.setAttribute("class", "page_percentage_deactive");
171
  var div = document.createElement('div');
172
  div.setAttribute("id", "div_percentage");
173
  div.setAttribute("class", "page_percentage_active");
174
  div.setAttribute("align", "right");
175
  var div_arrow = document.createElement('div');
176
  div_arrow.setAttribute("class", "wdform_percentage_arrow");
177
  b.setAttribute("class", "wdform_percentage_text");
178
  var curtop = 0;
179
  if (obj.offsetParent) {
180
  do {
181
  curtop += obj.offsetTop;
182
  } while (obj = obj.offsetParent);
183
  return [curtop];
184
  }
185
  addclass = typeof(addclass) != 'undefined' ? addclass : '';
186
  jQuery(select).wrap('<div class="sel-wrap ' + addclass + '"/>');
187
  var sel_options = '';
188
  var selected_option = false;
189
  jQuery(select).children('option').each(function() {
190
  if(jQuery(this).is(':selected')){
191
  selected_option = jQuery(this).index();
192
  }
193
  sel_options = sel_options + '<div class="sel-option" value="' + jQuery(this).val() + '">' + jQuery(this).html() + '</div>';
194
  });
195
  <div class="sel-selected">\
196
  <div class="selected-text">' + jQuery(select).children('option').eq(selected_option).html() + '</div>\
197
  <div class="sel-arraw"></div>\
198
  </div>\
199
  <div class="sel-options">' + sel_options + '</div>\
200
  </div>';
201
  jQuery(select).before(sel_imul);
202
  jQuery('.sel-imul').removeClass('act');
203
  jQuery(this).addClass('act');
204
  if (jQuery(this).children('.sel-options').is(':visible')) {
205
  jQuery('.sel-options').hide();
206
  }
207
  else {
208
  jQuery('.sel-options').hide();
209
  jQuery(this).children('.sel-options').show();
210
  }
211
  var tektext = jQuery(this).html();
212
  jQuery(this).parent('.sel-options').parent('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext);
213
  jQuery(this).parent('.sel-options').children('.sel-option').removeClass('sel-ed');
214
  jQuery(this).addClass('sel-ed');
215
  var tekval = jQuery(this).attr('value');
216
  tekval = typeof(tekval) != 'undefined' ? tekval : tektext;
217
  jQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').children('option').removeAttr('selected').each(function() {
218
  if (jQuery(this).html() == tektext) {
219
 
220
  jQuery(this).attr('selected', 'select');
221
  }
222
  });
223
  selenter = true;
224
  selenter = false;
225
  if (!selenter) {
226
  jQuery('.sel-options').hide();
227
  jQuery('.sel-imul').removeClass('act');
228
  }
229
  if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
 
1
  var chCode1 = e.which || e.keyCode;
2
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
3
  return false;
4
  if(document.getElementById(num+'_total_element'+form_id)){
5
  var chCode1 = e.which || e.keyCode;
6
  if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
7
  return true;
8
  return false;
9
  var chCode1 = e.which || e.keyCode;
10
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
11
  return false;
12
  return false;
13
  var chCode1 = e.which || e.keyCode;
14
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
15
  return false;
16
  return false;
17
  var chCode1 = e.which || e.keyCode;
18
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
19
  return false;
20
  return false;
21
  var chCode1 = e.which || e.keyCode;
22
  if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
23
  return true;
24
  }
25
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
26
  return false;
27
  }
28
  return false;
29
  return false;
30
  return false;
31
  var chCode1 = e.which || e.keyCode;
32
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
33
  return false;
34
  return false;
35
  return false;
36
  return false;
37
  var chCode1 = e.which || e.keyCode;
38
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
39
  return false;
40
  return false;
41
  return false;
42
  return false;
43
  var chCode1 = e.which || e.keyCode;
44
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
45
  return false;
46
  return false;
47
  while (node.firstChild)
48
  node.removeChild(node.firstChild);
49
 
50
  }
51
 
52
  }
53
  jQuery('.wdform-element-section').each(function() {
54
  var div_parent = document.createElement('div');
55
  div_parent.setAttribute("class", "page_percentage_deactive");
56
  var div = document.createElement('div');
57
  div.setAttribute("id", "div_percentage");
58
  div.setAttribute("class", "page_percentage_active");
59
  div.setAttribute("align", "right");
60
  var div_arrow = document.createElement('div');
61
  div_arrow.setAttribute("class", "wdform_percentage_arrow");
62
  b.setAttribute("class", "wdform_percentage_text");
63
  var curtop = 0;
64
  if (obj.offsetParent) {
65
  do {
66
  curtop += obj.offsetTop;
67
  } while (obj = obj.offsetParent);
68
  return [curtop];
69
  }
70
  addclass = typeof(addclass) != 'undefined' ? addclass : '';
71
  jQuery(select).wrap('<div class="sel-wrap ' + addclass + '"/>');
72
  var sel_options = '';
73
  var selected_option = false;
74
  jQuery(select).children('option').each(function() {
75
  if(jQuery(this).is(':selected')){
76
  selected_option = jQuery(this).index();
77
  }
78
  sel_options = sel_options + '<div class="sel-option" value="' + jQuery(this).val() + '">' + jQuery(this).html() + '</div>';
79
  });
80
  <div class="sel-selected">\
81
  <div class="selected-text">' + jQuery(select).children('option').eq(selected_option).html() + '</div>\
82
  <div class="sel-arraw"></div>\
83
  </div>\
84
  <div class="sel-options">' + sel_options + '</div>\
85
  </div>';
86
  jQuery(select).before(sel_imul);
87
  jQuery('.sel-imul').removeClass('act');
88
  jQuery(this).addClass('act');
89
  if (jQuery(this).children('.sel-options').is(':visible')) {
90
  jQuery('.sel-options').hide();
91
  }
92
  else {
93
  jQuery('.sel-options').hide();
94
  jQuery(this).children('.sel-options').show();
95
  }
96
  var tektext = jQuery(this).html();
97
  jQuery(this).parent('.sel-options').parent('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext);
98
  jQuery(this).parent('.sel-options').children('.sel-option').removeClass('sel-ed');
99
  jQuery(this).addClass('sel-ed');
100
  var tekval = jQuery(this).attr('value');
101
  tekval = typeof(tekval) != 'undefined' ? tekval : tektext;
102
  jQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').children('option').removeAttr('selected').each(function() {
103
  if (jQuery(this).html() == tektext) {
104
 
105
  jQuery(this).attr('selected', 'select');
106
  }
107
  });
108
  selenter = true;
109
  selenter = false;
110
  if (!selenter) {
111
  jQuery('.sel-options').hide();
112
  jQuery('.sel-imul').removeClass('act');
113
  }
114
  if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
115
+ F=2;
116
  var chCode1 = e.which || e.keyCode;
117
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
118
  return false;
119
  if(document.getElementById(num+'_total_element'+form_id)){
120
  var chCode1 = e.which || e.keyCode;
121
  if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
122
  return true;
123
  return false;
124
  var chCode1 = e.which || e.keyCode;
125
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
126
  return false;
127
  return false;
128
  var chCode1 = e.which || e.keyCode;
129
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
130
  return false;
131
  return false;
132
  var chCode1 = e.which || e.keyCode;
133
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
134
  return false;
135
  return false;
136
  var chCode1 = e.which || e.keyCode;
137
  if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
138
  return true;
139
  }
140
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
141
  return false;
142
  }
143
  return false;
144
  return false;
145
  return false;
146
  var chCode1 = e.which || e.keyCode;
147
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
148
  return false;
149
  return false;
150
  return false;
151
  return false;
152
  var chCode1 = e.which || e.keyCode;
153
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
154
  return false;
155
  return false;
156
  return false;
157
  return false;
158
  var chCode1 = e.which || e.keyCode;
159
  if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
160
  return false;
161
  return false;
162
  while (node.firstChild)
163
  node.removeChild(node.firstChild);
164
 
165
  }
166
 
167
  }
168
  jQuery('.wdform-element-section').each(function() {
169
  var div_parent = document.createElement('div');
170
  div_parent.setAttribute("class", "page_percentage_deactive");
171
  var div = document.createElement('div');
172
  div.setAttribute("id", "div_percentage");
173
  div.setAttribute("class", "page_percentage_active");
174
  div.setAttribute("align", "right");
175
  var div_arrow = document.createElement('div');
176
  div_arrow.setAttribute("class", "wdform_percentage_arrow");
177
  b.setAttribute("class", "wdform_percentage_text");
178
  var curtop = 0;
179
  if (obj.offsetParent) {
180
  do {
181
  curtop += obj.offsetTop;
182
  } while (obj = obj.offsetParent);
183
  return [curtop];
184
  }
185
  addclass = typeof(addclass) != 'undefined' ? addclass : '';
186
  jQuery(select).wrap('<div class="sel-wrap ' + addclass + '"/>');
187
  var sel_options = '';
188
  var selected_option = false;
189
  jQuery(select).children('option').each(function() {
190
  if(jQuery(this).is(':selected')){
191
  selected_option = jQuery(this).index();
192
  }
193
  sel_options = sel_options + '<div class="sel-option" value="' + jQuery(this).val() + '">' + jQuery(this).html() + '</div>';
194
  });
195
  <div class="sel-selected">\
196
  <div class="selected-text">' + jQuery(select).children('option').eq(selected_option).html() + '</div>\
197
  <div class="sel-arraw"></div>\
198
  </div>\
199
  <div class="sel-options">' + sel_options + '</div>\
200
  </div>';
201
  jQuery(select).before(sel_imul);
202
  jQuery('.sel-imul').removeClass('act');
203
  jQuery(this).addClass('act');
204
  if (jQuery(this).children('.sel-options').is(':visible')) {
205
  jQuery('.sel-options').hide();
206
  }
207
  else {
208
  jQuery('.sel-options').hide();
209
  jQuery(this).children('.sel-options').show();
210
  }
211
  var tektext = jQuery(this).html();
212
  jQuery(this).parent('.sel-options').parent('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext);
213
  jQuery(this).parent('.sel-options').children('.sel-option').removeClass('sel-ed');
214
  jQuery(this).addClass('sel-ed');
215
  var tekval = jQuery(this).attr('value');
216
  tekval = typeof(tekval) != 'undefined' ? tekval : tektext;
217
  jQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').children('option').removeAttr('selected').each(function() {
218
  if (jQuery(this).html() == tektext) {
219
 
220
  jQuery(this).attr('selected', 'select');
221
  }
222
  });
223
  selenter = true;
224
  selenter = false;
225
  if (!selenter) {
226
  jQuery('.sel-options').hide();
227
  jQuery('.sel-imul').removeClass('act');
228
  }
229
  if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-dorado.com/products/wordpress-form.html
4
  Tags: form, forms, form builder, form maker, form manager, form plugin, form with recaptcha, forms plugin, multiple forms, paypal form, survey form, feedback form, feedback forms, contact form,contact form plugin, contact form builder, form creator, email form, secure form, web form, form to email, contact forms, custom forms, form widget, captcha form, wordpress contact form ,recaptcha contact form, form creation, contact form with auto reply, widget contact form, builder, feedback, contacts form plugin , custom contact form, contact us form, Formular, formulario
5
  Requires at least: 3.0
6
  Tested up to: 3.9.1
7
- Stable tag: 1.7.12
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -123,7 +123,7 @@ Upgrade to [WordPress Form Maker Pro](http://web-dorado.com/products/wordpress-f
123
 
124
  ### Supported languages Of Form Maker
125
 
126
- *If you need language of Form Maker which is not included in this list, please contact us and we will do the translation of Form Maker within 3 days. If you find some mistakes in the translation of Form Maker, please contact us and we will correct it within 3 days.*
127
 
128
  Afrikaans (af)
129
  Albanian (sq)
4
  Tags: form, forms, form builder, form maker, form manager, form plugin, form with recaptcha, forms plugin, multiple forms, paypal form, survey form, feedback form, feedback forms, contact form,contact form plugin, contact form builder, form creator, email form, secure form, web form, form to email, contact forms, custom forms, form widget, captcha form, wordpress contact form ,recaptcha contact form, form creation, contact form with auto reply, widget contact form, builder, feedback, contacts form plugin , custom contact form, contact us form, Formular, formulario
5
  Requires at least: 3.0
6
  Tested up to: 3.9.1
7
+ Stable tag: 1.7.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
123
 
124
  ### Supported languages Of Form Maker
125
 
126
+ *If you need language of Form Maker which is not included in this list, please contact us and we will do the translation of Form Maker within 3 days. If you find any mistakes in the translation, please contact us and we will make relevant corrections within 3 days.*
127
 
128
  Afrikaans (af)
129
  Albanian (sq)