Contact Form by WD – responsive drag & drop contact form builder tool - Version 1.8.39

Version Description

  • Fixed: Bug with Hidden field in custom text in Email
  • Fixed: Bug on email verification custom post
  • Changed: Filters now apply to CSV and XML export
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Contact Form by WD – responsive drag & drop contact form builder tool
Version 1.8.39
Comparing to
See all releases

Code changes from version 1.8.38 to 1.8.39

admin/models/FMModelGenerete_csv_fmc.php CHANGED
@@ -1,269 +1,279 @@
1
- <?php
2
-
3
- class FMModelGenerete_csv_fmc {
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 get_data() {
22
- global $wpdb;
23
- $is_paypal_info = FALSE;
24
- $params = array();
25
- $group_id_s = array();
26
- $form_id = (int)$_REQUEST['form_id'];
27
- $limitstart = (int)$_REQUEST['limitstart'];
28
-
29
- $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
30
- $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
31
-
32
- $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id);
33
- $group_id_s = $wpdb->get_col($query);
34
-
35
- $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
36
- $labels = $wpdb->get_col($query);
37
-
38
- $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
39
- $rows_lable = $wpdb->get_results($query_lable);
40
- $ptn = "/[^a-zA-Z0-9_]/";
41
- $rpltxt = "";
42
- $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
43
-
44
- $sorted_labels_id = array();
45
- $sorted_labels = array();
46
- $label_titles = array();
47
- $label_id = array();
48
- $label_order = array();
49
- $label_order_original = array();
50
- $label_type = array();
51
- if ($labels) {
52
- $label_all = explode('#****#', $rows_lable[0]->label_order);
53
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
54
- foreach ($label_all as $key => $label_each) {
55
- $label_id_each = explode('#**id**#', $label_each);
56
- array_push($label_id, $label_id_each[0]);
57
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
58
- array_push($label_order_original, $label_oder_each[0]);
59
- $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
60
- array_push($label_order, $label_temp);
61
- array_push($label_type, $label_oder_each[1]);
62
- }
63
- foreach ($label_id as $key => $label) {
64
- if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
65
- array_push($sorted_labels, $label_order[$key]);
66
- array_push($sorted_labels_id, $label);
67
- array_push($label_titles, stripslashes($label_order_original[$key]));
68
- }
69
- }
70
- }
71
-
72
- $m = count($sorted_labels);
73
- $wpdb->query("SET SESSION group_concat_max_len = 1000000");
74
-
75
- $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
76
- $rows = $wpdb->get_results($query, OBJECT_K);
77
-
78
- $data = array();
79
- $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
80
-
81
- for ($www = $limitstart; $www < $group_id_s_count; $www++) {
82
- $i = $group_id_s[$www];
83
- $field_key = array_search($i, $label_id);
84
- if($label_type[$field_key] != 'type_arithmetic_captcha') {
85
- $data_temp = array();
86
- $tt = $rows[$i];
87
-
88
- $date = $tt->date;
89
- $ip = $tt->ip;
90
- $user_id = get_userdata($tt->user_id_wd);
91
- $username = $user_id ? $user_id->display_name : "";
92
- $useremail = $user_id ? $user_id->user_email : "";
93
- $data_temp['Submit date'] = $date;
94
- $data_temp['Ip']=$ip;
95
- $data_temp['Submitter\'s Username']=$username;
96
- $data_temp['Submitter\'s Email Address']=$useremail;
97
-
98
- $element_labels = explode(',', $tt->element_label);
99
- $element_values = explode('*:*el_value*:*', $tt->element_value);
100
- for ($h = 0; $h < $m; $h++) {
101
- if(isset($data_temp[$label_titles[$h]]))
102
- $label_titles[$h] .= '(1)';
103
-
104
- if(in_array($sorted_labels_id[$h], $element_labels)) {
105
- $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
106
-
107
- if (strpos($element_value, "*@@url@@*")) {
108
- $file_names = '';
109
- $new_files = explode("*@@url@@*", $element_value);
110
- foreach ($new_files as $new_file) {
111
- if ($new_file) {
112
- $file_names .= $new_file . ", ";
113
- }
114
- }
115
- $data_temp[stripslashes($label_titles[$h])] = $file_names;
116
- }
117
- elseif (strpos($element_value, "***br***")) {
118
- $element_value = str_replace("***br***", ', ', $element_value);
119
- if (strpos($element_value, "***quantity***")) {
120
- $element_value = str_replace("***quantity***", '', $element_value);
121
- }
122
- if (strpos($element_value, "***property***")) {
123
- $element_value = str_replace("***property***", '', $element_value);
124
- }
125
- if(substr($element_value, -2) == ', ') {
126
- $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
127
- }
128
- else {
129
- $data_temp[stripslashes($label_titles[$h])]= $element_value;
130
- }
131
- }
132
- elseif (strpos($element_value, "***map***")) {
133
- $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
134
- }
135
- elseif (strpos($element_value, "***star_rating***")) {
136
- $element = str_replace("***star_rating***", '', $element_value);
137
- $element = explode("***", $element);
138
- $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
139
- }
140
- elseif (strpos($element_value, "@@@") || $element_value == "@@@" || $element_value == "@@@@@@@@@") {
141
- $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
142
- }
143
- elseif (strpos($element_value, "***grading***")) {
144
- $element = str_replace("***grading***", '', $element_value);
145
- $grading = explode(":", $element);
146
- $items_count = sizeof($grading) - 1;
147
- $items = "";
148
- $total = "";
149
- for ($k = 0; $k < $items_count / 2; $k++) {
150
- $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
151
- $total += $grading[$k];
152
- }
153
- $items .= "Total: " . $total;
154
- $data_temp[stripslashes($label_titles[$h])] = $items;
155
- }
156
- elseif (strpos($element_value, "***matrix***")) {
157
- $element = str_replace("***matrix***", '', $element_value);
158
- $matrix_value = explode('***', $element);
159
- $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
160
- $mat_rows = $matrix_value[0];
161
- $mat_columns = $matrix_value[$mat_rows + 1];
162
- $matrix = "";
163
- $aaa = array();
164
- $var_checkbox = 1;
165
- $selected_value = "";
166
- $selected_value_yes = "";
167
- $selected_value_no = "";
168
- for ($k = 1; $k <= $mat_rows; $k++) {
169
- if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
170
- if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
171
- $checked = "0";
172
- $aaa[1] = "";
173
- }
174
- else {
175
- $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
176
- }
177
- for ($l = 1; $l <= $mat_columns; $l++) {
178
- $checked = $aaa[1] == $l ? '1' : '0';
179
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
180
- }
181
- }
182
- else {
183
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
184
- for ($l = 1; $l <= $mat_columns; $l++) {
185
- $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
186
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
187
- $var_checkbox++;
188
- }
189
- }
190
- else {
191
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
192
- for ($l = 1; $l <= $mat_columns; $l++) {
193
- $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
194
- $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
195
- $var_checkbox++;
196
- }
197
- }
198
- else {
199
- for ($l = 1; $l <= $mat_columns; $l++) {
200
- $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
201
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
202
- $var_checkbox++;
203
- }
204
- }
205
- }
206
- }
207
- }
208
- $data_temp[stripslashes($label_titles[$h])] = $matrix;
209
- }
210
- else {
211
- $val = htmlspecialchars_decode($element_value);
212
- $val = stripslashes(str_replace('&#039;', "'", $val));
213
- $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
214
- }
215
- }
216
- else
217
- $data_temp[stripslashes($label_titles[$h])] = '';
218
- }
219
-
220
- $query = $wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits where element_label=%s AND form_id = %d AND group_id=%d",'item_total', $form_id, $i);
221
- $is_paypal = $wpdb->get_results($query);
222
-
223
- if($is_paypal) {
224
- $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'item_total'));
225
- $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'total'));
226
- $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, '0'));
227
- $data_temp['Item Total'] = $item_total;
228
- $data_temp['Total'] = $total;
229
- $data_temp['Payment Status'] = $payment_status;
230
- }
231
- $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id=%d",$i);
232
- $paypal_info = $wpdb->get_results($query);
233
- if ($paypal_info) {
234
- $is_paypal_info = TRUE;
235
- }
236
- if ($is_paypal) {
237
- foreach ($paypal_info_fields as $key=>$paypal_info_field) {
238
- if ($paypal_info) {
239
- $data_temp['PAYPAL_'.$paypal_info_labels[$key]]=$paypal_info[0]->$paypal_info_field;
240
- }
241
- else {
242
- $data_temp['PAYPAL_'.$paypal_info_labels[$key]]='';
243
- }
244
- }
245
- }
246
-
247
- $data[$i] = $data_temp;
248
- }
249
- }
250
-
251
- array_push($params, $data);
252
- array_push($params, $title);
253
- array_push($params, $is_paypal_info);
254
-
255
- return $params;
256
-
257
- }
258
-
259
-
260
- ////////////////////////////////////////////////////////////////////////////////////////
261
- // Getters & Setters //
262
- ////////////////////////////////////////////////////////////////////////////////////////
263
- ////////////////////////////////////////////////////////////////////////////////////////
264
- // Private Methods //
265
- ////////////////////////////////////////////////////////////////////////////////////////
266
- ////////////////////////////////////////////////////////////////////////////////////////
267
- // Listeners //
268
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
 
269
  }
1
+ <?php
2
+
3
+ class FMModelGenerete_csv_fmc {
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 get_data() {
22
+ global $wpdb;
23
+ $is_paypal_info = FALSE;
24
+ $params = array();
25
+ $group_id_s = array();
26
+ $form_id = (int)$_REQUEST['form_id'];
27
+ $limitstart = (int)$_REQUEST['limitstart'];
28
+ $search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : '';
29
+
30
+ $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
31
+ $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
32
+
33
+
34
+ if($search_labels){
35
+ $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d and group_id IN(".$search_labels.")", $form_id);
36
+ $group_id_s = $wpdb->get_col($query);
37
+ }
38
+
39
+ $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
40
+ $labels = $wpdb->get_col($query);
41
+
42
+ $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
43
+ $rows_lable = $wpdb->get_results($query_lable);
44
+ $ptn = "/[^a-zA-Z0-9_]/";
45
+ $rpltxt = "";
46
+ $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
47
+
48
+ $sorted_labels_id = array();
49
+ $sorted_labels = array();
50
+ $label_titles = array();
51
+ $label_id = array();
52
+ $label_order = array();
53
+ $label_order_original = array();
54
+ $label_type = array();
55
+ if ($labels) {
56
+ $label_all = explode('#****#', $rows_lable[0]->label_order);
57
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
58
+ foreach ($label_all as $key => $label_each) {
59
+ $label_id_each = explode('#**id**#', $label_each);
60
+ array_push($label_id, $label_id_each[0]);
61
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
62
+ array_push($label_order_original, $label_oder_each[0]);
63
+ $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
64
+ array_push($label_order, $label_temp);
65
+ array_push($label_type, $label_oder_each[1]);
66
+ }
67
+ foreach ($label_id as $key => $label) {
68
+ if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
69
+ array_push($sorted_labels, $label_order[$key]);
70
+ array_push($sorted_labels_id, $label);
71
+ array_push($label_titles, stripslashes($label_order_original[$key]));
72
+ }
73
+ }
74
+ }
75
+
76
+ $m = count($sorted_labels);
77
+ $wpdb->query("SET SESSION group_concat_max_len = 1000000");
78
+
79
+ $rows = array();
80
+
81
+ if($search_labels){
82
+ $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d and group_id IN (".$search_labels.") GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
83
+ $rows = $wpdb->get_results($query, OBJECT_K);
84
+ }
85
+
86
+ $data = array();
87
+ $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
88
+
89
+ sort($group_id_s,SORT_NUMERIC);
90
+
91
+ for ($www = $limitstart; $www < $group_id_s_count; $www++) {
92
+ $i = $group_id_s[$www];
93
+ $field_key = array_search($i, $label_id);
94
+ if($label_type[$field_key] != 'type_arithmetic_captcha') {
95
+ $data_temp = array();
96
+ $tt = $rows[$i];
97
+
98
+ $date = $tt->date;
99
+ $ip = $tt->ip;
100
+ $user_id = get_userdata($tt->user_id_wd);
101
+ $username = $user_id ? $user_id->display_name : "";
102
+ $useremail = $user_id ? $user_id->user_email : "";
103
+ $data_temp['Submit date'] = $date;
104
+ $data_temp['Ip']=$ip;
105
+ $data_temp['Submitter\'s Username']=$username;
106
+ $data_temp['Submitter\'s Email Address']=$useremail;
107
+
108
+ $element_labels = explode(',', $tt->element_label);
109
+ $element_values = explode('*:*el_value*:*', $tt->element_value);
110
+ for ($h = 0; $h < $m; $h++) {
111
+ if(isset($data_temp[$label_titles[$h]]))
112
+ $label_titles[$h] .= '(1)';
113
+
114
+ if(in_array($sorted_labels_id[$h], $element_labels)) {
115
+ $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
116
+
117
+ if (strpos($element_value, "*@@url@@*")) {
118
+ $file_names = '';
119
+ $new_files = explode("*@@url@@*", $element_value);
120
+ foreach ($new_files as $new_file) {
121
+ if ($new_file) {
122
+ $file_names .= $new_file . ", ";
123
+ }
124
+ }
125
+ $data_temp[stripslashes($label_titles[$h])] = $file_names;
126
+ }
127
+ elseif (strpos($element_value, "***br***")) {
128
+ $element_value = str_replace("***br***", ', ', $element_value);
129
+ if (strpos($element_value, "***quantity***")) {
130
+ $element_value = str_replace("***quantity***", '', $element_value);
131
+ }
132
+ if (strpos($element_value, "***property***")) {
133
+ $element_value = str_replace("***property***", '', $element_value);
134
+ }
135
+ if(substr($element_value, -2) == ', ') {
136
+ $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
137
+ }
138
+ else {
139
+ $data_temp[stripslashes($label_titles[$h])]= $element_value;
140
+ }
141
+ }
142
+ elseif (strpos($element_value, "***map***")) {
143
+ $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
144
+ }
145
+ elseif (strpos($element_value, "***star_rating***")) {
146
+ $element = str_replace("***star_rating***", '', $element_value);
147
+ $element = explode("***", $element);
148
+ $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
149
+ }
150
+ elseif (strpos($element_value, "@@@") || $element_value == "@@@" || $element_value == "@@@@@@@@@") {
151
+ $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
152
+ }
153
+ elseif (strpos($element_value, "***grading***")) {
154
+ $element = str_replace("***grading***", '', $element_value);
155
+ $grading = explode(":", $element);
156
+ $items_count = sizeof($grading) - 1;
157
+ $items = "";
158
+ $total = "";
159
+ for ($k = 0; $k < $items_count / 2; $k++) {
160
+ $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
161
+ $total += $grading[$k];
162
+ }
163
+ $items .= "Total: " . $total;
164
+ $data_temp[stripslashes($label_titles[$h])] = $items;
165
+ }
166
+ elseif (strpos($element_value, "***matrix***")) {
167
+ $element = str_replace("***matrix***", '', $element_value);
168
+ $matrix_value = explode('***', $element);
169
+ $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
170
+ $mat_rows = $matrix_value[0];
171
+ $mat_columns = $matrix_value[$mat_rows + 1];
172
+ $matrix = "";
173
+ $aaa = array();
174
+ $var_checkbox = 1;
175
+ $selected_value = "";
176
+ $selected_value_yes = "";
177
+ $selected_value_no = "";
178
+ for ($k = 1; $k <= $mat_rows; $k++) {
179
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
180
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
181
+ $checked = "0";
182
+ $aaa[1] = "";
183
+ }
184
+ else {
185
+ $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
186
+ }
187
+ for ($l = 1; $l <= $mat_columns; $l++) {
188
+ $checked = $aaa[1] == $l ? '1' : '0';
189
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
190
+ }
191
+ }
192
+ else {
193
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
194
+ for ($l = 1; $l <= $mat_columns; $l++) {
195
+ $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
196
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
197
+ $var_checkbox++;
198
+ }
199
+ }
200
+ else {
201
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
202
+ for ($l = 1; $l <= $mat_columns; $l++) {
203
+ $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
204
+ $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
205
+ $var_checkbox++;
206
+ }
207
+ }
208
+ else {
209
+ for ($l = 1; $l <= $mat_columns; $l++) {
210
+ $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
211
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
212
+ $var_checkbox++;
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+ $data_temp[stripslashes($label_titles[$h])] = $matrix;
219
+ }
220
+ else {
221
+ $val = htmlspecialchars_decode($element_value);
222
+ $val = stripslashes(str_replace('&#039;', "'", $val));
223
+ $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
224
+ }
225
+ }
226
+ else
227
+ $data_temp[stripslashes($label_titles[$h])] = '';
228
+ }
229
+
230
+ $query = $wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits where element_label=%s AND form_id = %d AND group_id=%d",'item_total', $form_id, $i);
231
+ $is_paypal = $wpdb->get_results($query);
232
+
233
+ if($is_paypal) {
234
+ $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'item_total'));
235
+ $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'total'));
236
+ $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, '0'));
237
+ $data_temp['Item Total'] = $item_total;
238
+ $data_temp['Total'] = $total;
239
+ $data_temp['Payment Status'] = $payment_status;
240
+ }
241
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id=%d",$i);
242
+ $paypal_info = $wpdb->get_results($query);
243
+ if ($paypal_info) {
244
+ $is_paypal_info = TRUE;
245
+ }
246
+ if ($is_paypal) {
247
+ foreach ($paypal_info_fields as $key=>$paypal_info_field) {
248
+ if ($paypal_info) {
249
+ $data_temp['PAYPAL_'.$paypal_info_labels[$key]]=$paypal_info[0]->$paypal_info_field;
250
+ }
251
+ else {
252
+ $data_temp['PAYPAL_'.$paypal_info_labels[$key]]='';
253
+ }
254
+ }
255
+ }
256
+
257
+ $data[$i] = $data_temp;
258
+ }
259
+ }
260
+
261
+ array_push($params, $data);
262
+ array_push($params, $title);
263
+ array_push($params, $is_paypal_info);
264
+
265
+ return $params;
266
+
267
+ }
268
+
269
+
270
+ ////////////////////////////////////////////////////////////////////////////////////////
271
+ // Getters & Setters //
272
+ ////////////////////////////////////////////////////////////////////////////////////////
273
+ ////////////////////////////////////////////////////////////////////////////////////////
274
+ // Private Methods //
275
+ ////////////////////////////////////////////////////////////////////////////////////////
276
+ ////////////////////////////////////////////////////////////////////////////////////////
277
+ // Listeners //
278
+ ////////////////////////////////////////////////////////////////////////////////////////
279
  }
admin/models/FMModelGenerete_xml_fmc.php CHANGED
@@ -1,276 +1,285 @@
1
- <?php
2
-
3
- class FMModelGenerete_xml_fmc {
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
- public function get_data() {
23
- global $wpdb;
24
- $is_paypal_info = FALSE;
25
- $params = array();
26
- $group_id_s = array();
27
- $form_id = (int)$_REQUEST['form_id'];
28
- $limitstart = (int)$_REQUEST['limitstart'];
29
-
30
- $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
31
- $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
32
-
33
- $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id);
34
- $group_id_s = $wpdb->get_col($query);
35
-
36
- $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
37
- $labels = $wpdb->get_col($query);
38
-
39
- $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
40
- $rows_lable = $wpdb->get_results($query_lable);
41
- $ptn = "/[^a-zA-Z0-9_]/";
42
- $rpltxt = "";
43
- $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
44
-
45
- $sorted_labels_id = array();
46
- $sorted_labels = array();
47
- $label_titles = array();
48
- $label_id = array();
49
- $label_order = array();
50
- $label_order_original = array();
51
- $label_type = array();
52
- if ($labels) {
53
- $label_all = explode('#****#', $rows_lable[0]->label_order);
54
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
55
- foreach ($label_all as $key => $label_each) {
56
- $label_id_each = explode('#**id**#', $label_each);
57
- array_push($label_id, $label_id_each[0]);
58
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
59
- array_push($label_order_original, $label_oder_each[0]);
60
- $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
61
- array_push($label_order, $label_temp);
62
- array_push($label_type, $label_oder_each[1]);
63
- }
64
- foreach ($label_id as $key => $label) {
65
- if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
66
- array_push($sorted_labels, $label_order[$key]);
67
- array_push($sorted_labels_id, $label);
68
- array_push($label_titles, stripslashes($label_order_original[$key]));
69
- }
70
- }
71
- }
72
-
73
- $m = count($sorted_labels);
74
-
75
- $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
76
- $rows = $wpdb->get_results($query, OBJECT_K);
77
-
78
- $data = array();
79
- $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
80
-
81
- for ($www = $limitstart; $www < $group_id_s_count; $www++) {
82
- $i = $group_id_s[$www];
83
- $field_key = array_search($i, $label_id);
84
- if($label_type[$field_key] != 'type_arithmetic_captcha') {
85
- $data_temp = array();
86
- $tt = $rows[$i];
87
-
88
- $date = $tt->date;
89
- $ip = $tt->ip;
90
- $user_id = get_userdata($tt->user_id_wd);
91
- $username = $user_id ? $user_id->display_name : "";
92
- $useremail = $user_id ? $user_id->user_email : "";
93
- $data_temp['Submit date'] = $date;
94
- $data_temp['Ip']=$ip;
95
- $data_temp['Submitter\'s Username']=$username;
96
- $data_temp['Submitter\'s Email Address']=$useremail;
97
-
98
- $element_labels = explode(',', $tt->element_label);
99
- $element_values = explode('*:*el_value*:*', $tt->element_value);
100
- for ($h = 0; $h < $m; $h++) {
101
- if(isset($data_temp[$label_titles[$h]]))
102
- $label_titles[$h] .= '(1)';
103
-
104
- if(in_array($sorted_labels_id[$h], $element_labels)) {
105
- $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
106
-
107
- if (strpos($element_value, "*@@url@@*")) {
108
- $file_names = '';
109
- $new_files = explode("*@@url@@*", $element_value);
110
- foreach ($new_files as $new_file) {
111
- if ($new_file) {
112
- $file_names .= $new_file . ", ";
113
- }
114
- }
115
- $data_temp[stripslashes($label_titles[$h])] = $file_names;
116
- }
117
- elseif (strpos($element_value, "***br***")) {
118
- $element_value = str_replace("***br***", ', ', $element_value);
119
- if (strpos($element_value, "***quantity***")) {
120
- $element_value = str_replace("***quantity***", '', $element_value);
121
- }
122
- if (strpos($element_value, "***property***")) {
123
- $element_value = str_replace("***property***", '', $element_value);
124
- }
125
- if(substr($element_value, -2) == ', ') {
126
- $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
127
- }
128
- else {
129
- $data_temp[stripslashes($label_titles[$h])]= $element_value;
130
- }
131
- }
132
- elseif (strpos($element_value, "***map***")) {
133
- $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
134
- }
135
- elseif (strpos($element_value, "***star_rating***")) {
136
- $element = str_replace("***star_rating***", '', $element_value);
137
- $element = explode("***", $element);
138
- $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
139
- }
140
- elseif (strpos($element_value, "@@@") || $element_value == "@@@" || $element_value == "@@@@@@@@@") {
141
- $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
142
- }
143
- elseif (strpos($element_value, "***grading***")) {
144
- $element = str_replace("***grading***", '', $element_value);
145
- $grading = explode(":", $element);
146
- $items_count = sizeof($grading) - 1;
147
- $items = "";
148
- $total = "";
149
- for ($k = 0; $k < $items_count / 2; $k++) {
150
- $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
151
- $total += $grading[$k];
152
- }
153
- $items .= "Total: " . $total;
154
- $data_temp[stripslashes($label_titles[$h])] = $items;
155
- }
156
- elseif (strpos($element_value, "***matrix***")) {
157
- $element = str_replace("***matrix***", '', $element_value);
158
- $matrix_value = explode('***', $element);
159
- $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
160
- $mat_rows = $matrix_value[0];
161
- $mat_columns = $matrix_value[$mat_rows + 1];
162
- $matrix = "";
163
- $aaa = array();
164
- $var_checkbox = 1;
165
- $selected_value = "";
166
- $selected_value_yes = "";
167
- $selected_value_no = "";
168
- for ($k = 1; $k <= $mat_rows; $k++) {
169
- if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
170
- if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
171
- $checked = "0";
172
- $aaa[1] = "";
173
- }
174
- else {
175
- $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
176
- }
177
- for ($l = 1; $l <= $mat_columns; $l++) {
178
- $checked = $aaa[1] == $l ? '1' : '0';
179
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
180
- }
181
- }
182
- else {
183
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
184
- for ($l = 1; $l <= $mat_columns; $l++) {
185
- $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
186
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
187
- $var_checkbox++;
188
- }
189
- }
190
- else {
191
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
192
- for ($l = 1; $l <= $mat_columns; $l++) {
193
- $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
194
- $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
195
- $var_checkbox++;
196
- }
197
- }
198
- else {
199
- for ($l = 1; $l <= $mat_columns; $l++) {
200
- $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
201
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
202
- $var_checkbox++;
203
- }
204
- }
205
- }
206
- }
207
- }
208
- $data_temp[stripslashes($label_titles[$h])] = $matrix;
209
- }
210
- else {
211
- $val = htmlspecialchars_decode($element_value);
212
- $val = stripslashes(str_replace('&#039;', "'", $val));
213
- $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
214
- }
215
- }
216
- else
217
- $data_temp[stripslashes($label_titles[$h])] = '';
218
- }
219
-
220
- $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'item_total'));
221
-
222
- $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'total'));
223
-
224
- $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'0'));
225
-
226
-
227
- if($item_total)
228
- $data_temp['Item Total'] = $item_total;
229
-
230
- if($total)
231
- $data_temp['Total'] = $total;
232
-
233
- if($payment_status)
234
- $data_temp['Payment Status'] = $payment_status;
235
-
236
- $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id= %d", $i);
237
-
238
-
239
-
240
- $paypal_info = $wpdb->get_results($query);
241
- if ($paypal_info) {
242
- $is_paypal_info = TRUE;
243
- }
244
- if ($is_paypal_info) {
245
- foreach ($paypal_info_fields as $key=>$paypal_info_field) {
246
- if ($paypal_info) {
247
- $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = $paypal_info[0]->$paypal_info_field;
248
- }
249
- else {
250
- $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = '';
251
- }
252
- }
253
- }
254
-
255
- $data[$i] = $data_temp;
256
- }
257
- }
258
-
259
- array_push($params, $data);
260
- array_push($params, $title);
261
- array_push($params, $is_paypal_info);
262
-
263
- return $params;
264
-
265
- }
266
-
267
- ////////////////////////////////////////////////////////////////////////////////////////
268
- // Getters & Setters //
269
- ////////////////////////////////////////////////////////////////////////////////////////
270
- ////////////////////////////////////////////////////////////////////////////////////////
271
- // Private Methods //
272
- ////////////////////////////////////////////////////////////////////////////////////////
273
- ////////////////////////////////////////////////////////////////////////////////////////
274
- // Listeners //
275
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
276
  }
1
+ <?php
2
+
3
+ class FMModelGenerete_xml_fmc {
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
+ public function get_data() {
23
+ global $wpdb;
24
+ $is_paypal_info = FALSE;
25
+ $params = array();
26
+ $group_id_s = array();
27
+ $form_id = (int)$_REQUEST['form_id'];
28
+ $limitstart = (int)$_REQUEST['limitstart'];
29
+ $search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : '';
30
+
31
+ $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
32
+ $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
33
+
34
+ if($search_labels){
35
+ $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d and group_id IN(".$search_labels.")", $form_id);
36
+ $group_id_s = $wpdb->get_col($query);
37
+ }
38
+
39
+ $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
40
+ $labels = $wpdb->get_col($query);
41
+
42
+ $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
43
+ $rows_lable = $wpdb->get_results($query_lable);
44
+ $ptn = "/[^a-zA-Z0-9_]/";
45
+ $rpltxt = "";
46
+ $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
47
+
48
+ $sorted_labels_id = array();
49
+ $sorted_labels = array();
50
+ $label_titles = array();
51
+ $label_id = array();
52
+ $label_order = array();
53
+ $label_order_original = array();
54
+ $label_type = array();
55
+ if ($labels) {
56
+ $label_all = explode('#****#', $rows_lable[0]->label_order);
57
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
58
+ foreach ($label_all as $key => $label_each) {
59
+ $label_id_each = explode('#**id**#', $label_each);
60
+ array_push($label_id, $label_id_each[0]);
61
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
62
+ array_push($label_order_original, $label_oder_each[0]);
63
+ $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
64
+ array_push($label_order, $label_temp);
65
+ array_push($label_type, $label_oder_each[1]);
66
+ }
67
+ foreach ($label_id as $key => $label) {
68
+ if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
69
+ array_push($sorted_labels, $label_order[$key]);
70
+ array_push($sorted_labels_id, $label);
71
+ array_push($label_titles, stripslashes($label_order_original[$key]));
72
+ }
73
+ }
74
+ }
75
+
76
+ $m = count($sorted_labels);
77
+
78
+ $rows = array();
79
+
80
+ if($search_labels){
81
+ $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d and group_id IN(".$search_labels.") GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
82
+ $rows = $wpdb->get_results($query, OBJECT_K);
83
+ }
84
+
85
+ $data = array();
86
+ $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
87
+
88
+ sort($group_id_s,SORT_NUMERIC);
89
+
90
+ for ($www = $limitstart; $www < $group_id_s_count; $www++) {
91
+ $i = $group_id_s[$www];
92
+ $field_key = array_search($i, $label_id);
93
+ if($label_type[$field_key] != 'type_arithmetic_captcha') {
94
+ $data_temp = array();
95
+ $tt = $rows[$i];
96
+
97
+ $date = $tt->date;
98
+ $ip = $tt->ip;
99
+ $user_id = get_userdata($tt->user_id_wd);
100
+ $username = $user_id ? $user_id->display_name : "";
101
+ $useremail = $user_id ? $user_id->user_email : "";
102
+ $data_temp['Submit date'] = $date;
103
+ $data_temp['Ip']=$ip;
104
+ $data_temp['Submitter\'s Username']=$username;
105
+ $data_temp['Submitter\'s Email Address']=$useremail;
106
+
107
+ $element_labels = explode(',', $tt->element_label);
108
+ $element_values = explode('*:*el_value*:*', $tt->element_value);
109
+ for ($h = 0; $h < $m; $h++) {
110
+ if(isset($data_temp[$label_titles[$h]]))
111
+ $label_titles[$h] .= '(1)';
112
+
113
+ if(in_array($sorted_labels_id[$h], $element_labels)) {
114
+ $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
115
+
116
+ if (strpos($element_value, "*@@url@@*")) {
117
+ $file_names = '';
118
+ $new_files = explode("*@@url@@*", $element_value);
119
+ foreach ($new_files as $new_file) {
120
+ if ($new_file) {
121
+ $file_names .= $new_file . ", ";
122
+ }
123
+ }
124
+ $data_temp[stripslashes($label_titles[$h])] = $file_names;
125
+ }
126
+ elseif (strpos($element_value, "***br***")) {
127
+ $element_value = str_replace("***br***", ', ', $element_value);
128
+ if (strpos($element_value, "***quantity***")) {
129
+ $element_value = str_replace("***quantity***", '', $element_value);
130
+ }
131
+ if (strpos($element_value, "***property***")) {
132
+ $element_value = str_replace("***property***", '', $element_value);
133
+ }
134
+ if(substr($element_value, -2) == ', ') {
135
+ $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
136
+ }
137
+ else {
138
+ $data_temp[stripslashes($label_titles[$h])]= $element_value;
139
+ }
140
+ }
141
+ elseif (strpos($element_value, "***map***")) {
142
+ $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
143
+ }
144
+ elseif (strpos($element_value, "***star_rating***")) {
145
+ $element = str_replace("***star_rating***", '', $element_value);
146
+ $element = explode("***", $element);
147
+ $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
148
+ }
149
+ elseif (strpos($element_value, "@@@") || $element_value == "@@@" || $element_value == "@@@@@@@@@") {
150
+ $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
151
+ }
152
+ elseif (strpos($element_value, "***grading***")) {
153
+ $element = str_replace("***grading***", '', $element_value);
154
+ $grading = explode(":", $element);
155
+ $items_count = sizeof($grading) - 1;
156
+ $items = "";
157
+ $total = "";
158
+ for ($k = 0; $k < $items_count / 2; $k++) {
159
+ $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
160
+ $total += $grading[$k];
161
+ }
162
+ $items .= "Total: " . $total;
163
+ $data_temp[stripslashes($label_titles[$h])] = $items;
164
+ }
165
+ elseif (strpos($element_value, "***matrix***")) {
166
+ $element = str_replace("***matrix***", '', $element_value);
167
+ $matrix_value = explode('***', $element);
168
+ $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
169
+ $mat_rows = $matrix_value[0];
170
+ $mat_columns = $matrix_value[$mat_rows + 1];
171
+ $matrix = "";
172
+ $aaa = array();
173
+ $var_checkbox = 1;
174
+ $selected_value = "";
175
+ $selected_value_yes = "";
176
+ $selected_value_no = "";
177
+ for ($k = 1; $k <= $mat_rows; $k++) {
178
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
179
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
180
+ $checked = "0";
181
+ $aaa[1] = "";
182
+ }
183
+ else {
184
+ $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
185
+ }
186
+ for ($l = 1; $l <= $mat_columns; $l++) {
187
+ $checked = $aaa[1] == $l ? '1' : '0';
188
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
189
+ }
190
+ }
191
+ else {
192
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
193
+ for ($l = 1; $l <= $mat_columns; $l++) {
194
+ $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
195
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
196
+ $var_checkbox++;
197
+ }
198
+ }
199
+ else {
200
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
201
+ for ($l = 1; $l <= $mat_columns; $l++) {
202
+ $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
203
+ $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
204
+ $var_checkbox++;
205
+ }
206
+ }
207
+ else {
208
+ for ($l = 1; $l <= $mat_columns; $l++) {
209
+ $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
210
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
211
+ $var_checkbox++;
212
+ }
213
+ }
214
+ }
215
+ }
216
+ }
217
+ $data_temp[stripslashes($label_titles[$h])] = $matrix;
218
+ }
219
+ else {
220
+ $val = htmlspecialchars_decode($element_value);
221
+ $val = stripslashes(str_replace('&#039;', "'", $val));
222
+ $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
223
+ }
224
+ }
225
+ else
226
+ $data_temp[stripslashes($label_titles[$h])] = '';
227
+ }
228
+
229
+ $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'item_total'));
230
+
231
+ $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'total'));
232
+
233
+ $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'0'));
234
+
235
+
236
+ if($item_total)
237
+ $data_temp['Item Total'] = $item_total;
238
+
239
+ if($total)
240
+ $data_temp['Total'] = $total;
241
+
242
+ if($payment_status)
243
+ $data_temp['Payment Status'] = $payment_status;
244
+
245
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id= %d", $i);
246
+
247
+
248
+
249
+ $paypal_info = $wpdb->get_results($query);
250
+ if ($paypal_info) {
251
+ $is_paypal_info = TRUE;
252
+ }
253
+ if ($is_paypal_info) {
254
+ foreach ($paypal_info_fields as $key=>$paypal_info_field) {
255
+ if ($paypal_info) {
256
+ $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = $paypal_info[0]->$paypal_info_field;
257
+ }
258
+ else {
259
+ $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = '';
260
+ }
261
+ }
262
+ }
263
+
264
+ $data[$i] = $data_temp;
265
+ }
266
+ }
267
+
268
+ array_push($params, $data);
269
+ array_push($params, $title);
270
+ array_push($params, $is_paypal_info);
271
+
272
+ return $params;
273
+
274
+ }
275
+
276
+ ////////////////////////////////////////////////////////////////////////////////////////
277
+ // Getters & Setters //
278
+ ////////////////////////////////////////////////////////////////////////////////////////
279
+ ////////////////////////////////////////////////////////////////////////////////////////
280
+ // Private Methods //
281
+ ////////////////////////////////////////////////////////////////////////////////////////
282
+ ////////////////////////////////////////////////////////////////////////////////////////
283
+ // Listeners //
284
+ ////////////////////////////////////////////////////////////////////////////////////////
285
  }
admin/models/FMModelSubmissions_fmc.php CHANGED
@@ -60,7 +60,7 @@ class FMModelSubmissions_fmc {
60
  $join_where = array();
61
  $rows_ord = array();
62
  $join = '';
63
- for ($i = 0; $i < 8; $i++) {
64
  array_push($labels_parameters, NULL);
65
  }
66
  $sorted_label_names = array();
@@ -115,7 +115,7 @@ class FMModelSubmissions_fmc {
115
  $orderby = "";
116
  }
117
  if ($form_id) {
118
- for($i = 0; $i < 8; $i++) {
119
  array_pop($labels_parameters);
120
  }
121
  $query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE ". $where;
@@ -221,11 +221,22 @@ class FMModelSubmissions_fmc {
221
  for ($i = 0; $i < count($results); $i++) {
222
  array_push($rows_ord, $results[$i]->group_id);
223
  }
 
 
 
 
 
 
 
 
 
 
224
  $where2 = array();
225
  $where2[] = "group_id='0'";
226
  foreach ($rows_ord as $rows_ordd) {
227
  $where2[] = "group_id='" . $rows_ordd . "'";
228
  }
 
229
  $where2 = (count($where2) ? ' WHERE ' . implode( ' OR ', $where2 ) . '' : '' );
230
  $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
231
  $rows = $wpdb->get_results($query);
@@ -241,6 +252,7 @@ class FMModelSubmissions_fmc {
241
  array_push($labels_parameters, $rows);
242
  array_push($labels_parameters, $group_ids);
243
  array_push($labels_parameters, $where_choices);
 
244
  }
245
  return $labels_parameters;
246
  }
60
  $join_where = array();
61
  $rows_ord = array();
62
  $join = '';
63
+ for ($i = 0; $i < 9; $i++) {
64
  array_push($labels_parameters, NULL);
65
  }
66
  $sorted_label_names = array();
115
  $orderby = "";
116
  }
117
  if ($form_id) {
118
+ for($i = 0; $i < 9; $i++) {
119
  array_pop($labels_parameters);
120
  }
121
  $query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE ". $where;
221
  for ($i = 0; $i < count($results); $i++) {
222
  array_push($rows_ord, $results[$i]->group_id);
223
  }
224
+
225
+
226
+ $query1 = $join . ' ' . $orderby ;
227
+ $searched_group_ids = $wpdb->get_results($query1);
228
+ $searched_ids = array();
229
+ for ($i = 0; $i < count($searched_group_ids); $i++) {
230
+ array_push($searched_ids, $searched_group_ids[$i]->group_id);
231
+ }
232
+
233
+
234
  $where2 = array();
235
  $where2[] = "group_id='0'";
236
  foreach ($rows_ord as $rows_ordd) {
237
  $where2[] = "group_id='" . $rows_ordd . "'";
238
  }
239
+
240
  $where2 = (count($where2) ? ' WHERE ' . implode( ' OR ', $where2 ) . '' : '' );
241
  $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
242
  $rows = $wpdb->get_results($query);
252
  array_push($labels_parameters, $rows);
253
  array_push($labels_parameters, $group_ids);
254
  array_push($labels_parameters, $where_choices);
255
+ array_push($labels_parameters, $searched_ids);
256
  }
257
  return $labels_parameters;
258
  }
admin/models/FMModelUninstall_fmc.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
-
3
- class FMModelUninstall_fmc {
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 delete_db_tables() {
22
- global $wpdb;
23
- $true_or_false_forms = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker WHERE `id` IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
24
- if ($true_or_false_forms) {
25
- $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker WHERE `id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
26
- $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
27
- $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker_views WHERE `form_id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
28
- delete_option('contact_form_forms');
29
- }
30
- else {
31
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker");
32
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_submits");
33
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_views");
34
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_themes");
35
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_sessions");
36
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_blocked");
37
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_query");
38
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_backup");
39
- delete_option('contact_form_forms');
40
- delete_option("wd_form_maker_version");
41
- delete_option('formmaker_cureent_version');
42
- delete_option('fm_emailverification');
43
- delete_option('form_maker_pro_active');
44
-
45
- }
46
- delete_option('fmc_settings');
47
- }
48
- ////////////////////////////////////////////////////////////////////////////////////////
49
- // Getters & Setters //
50
- ////////////////////////////////////////////////////////////////////////////////////////
51
- ////////////////////////////////////////////////////////////////////////////////////////
52
- // Private Methods //
53
- ////////////////////////////////////////////////////////////////////////////////////////
54
- ////////////////////////////////////////////////////////////////////////////////////////
55
- // Listeners //
56
- ////////////////////////////////////////////////////////////////////////////////////////
57
  }
1
+ <?php
2
+
3
+ class FMModelUninstall_fmc {
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 delete_db_tables() {
22
+ global $wpdb;
23
+ $true_or_false_forms = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker WHERE `id` IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
24
+ if ($true_or_false_forms) {
25
+ $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker WHERE `id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
26
+ $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
27
+ $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker_views WHERE `form_id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
28
+ delete_option('contact_form_forms');
29
+ }
30
+ else {
31
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker");
32
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_submits");
33
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_views");
34
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_themes");
35
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_sessions");
36
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_blocked");
37
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_query");
38
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_backup");
39
+ delete_option('contact_form_forms');
40
+ delete_option("wd_form_maker_version");
41
+ delete_option('formmaker_cureent_version');
42
+ delete_option('fm_emailverification');
43
+ delete_option('form_maker_pro_active');
44
+
45
+ }
46
+ delete_option('fmc_settings');
47
+ }
48
+ ////////////////////////////////////////////////////////////////////////////////////////
49
+ // Getters & Setters //
50
+ ////////////////////////////////////////////////////////////////////////////////////////
51
+ ////////////////////////////////////////////////////////////////////////////////////////
52
+ // Private Methods //
53
+ ////////////////////////////////////////////////////////////////////////////////////////
54
+ ////////////////////////////////////////////////////////////////////////////////////////
55
+ // Listeners //
56
+ ////////////////////////////////////////////////////////////////////////////////////////
57
  }
admin/views/FMViewSubmissions_fmc.php CHANGED
@@ -1,4464 +1,4466 @@
1
- <?php
2
-
3
- class FMViewSubmissions_fmc {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- // Constructor & Destructor //
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
- public function __construct($model) {
19
- $this->model = $model;
20
- }
21
-
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- public function display($form_id) {
26
-
27
-
28
- global $wpdb;
29
- $forms = $this->model->get_form_titles();
30
- $statistics = $this->model->get_statistics($form_id);
31
- $labels_parameters = $this->model->get_labels_parameters($form_id);
32
-
33
- $sorted_labels_id = $labels_parameters[0];
34
- $sorted_label_types = $labels_parameters[1];
35
- $lists = $labels_parameters[2];
36
- $sorted_label_names = $labels_parameters[3];
37
- $sorted_label_names_original = $labels_parameters[4];
38
- $rows = ((isset($labels_parameters[5])) ? $labels_parameters[5] : NULL);
39
- $group_ids = ((isset($labels_parameters[6])) ? $labels_parameters[6] : NULL);
40
- $where_choices = $labels_parameters[7];
41
- $order_by = (isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
42
- $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc');
43
- $style_id = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
44
- $style_date = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
45
- $style_ip = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
46
-
47
- $style_username = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
48
- $style_useremail = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
49
-
50
- $oder_class_default = "manage-column column-autor sortable desc";
51
- $oder_class = "manage-column column-title sorted " . $asc_or_desc;
52
- $ispaypal = FALSE;
53
- $temp = array();
54
- $m = count($sorted_label_names);
55
- $n = count($rows);
56
- $group_id_s = array();
57
- $group_id_s = $this->model->sort_group_ids(count($sorted_label_names),$group_ids);
58
- $ka_fielderov_search = (($lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] || $lists['id_search']) ? TRUE : FALSE);
59
- $is_stats = false;
60
- $blocked_ips = $this->model->blocked_ips();
61
-
62
- if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
63
- require_once(WD_FM_PDF_DIR.'/model.php');
64
- $pdf_data = WD_FM_PDF_model::get_pdf_data($form_id);
65
- }
66
- $subs_count = $this->model->get_subs_count($form_id);
67
- $chosen_form_title = '';
68
- if ($forms) {
69
- foreach($forms as $form) {
70
- if ($form_id == $form->id) {
71
- $chosen_form_title = $form->title;
72
- }
73
- }
74
- }
75
- ?>
76
- <script type="text/javascript">
77
- function export_submissions(type, limit) {
78
- var progressbar = jQuery( "#fm-progressbar" );
79
- var progressLabel = jQuery( ".fm-progress-label" );
80
-
81
- progressbar.progressbar({
82
- max: <?php echo $subs_count; ?>
83
- });
84
-
85
- jQuery.ajax({
86
- type: "POST",
87
- url:"<?php echo add_query_arg(array('form_id' => $form_id, 'send_header' => 0), admin_url('admin-ajax.php')); ?>&action=generete_"+type+"_fmc&limitstart="+limit,
88
- beforeSend: function() {
89
- if(<?php echo $subs_count; ?> >= 1000 )
90
- jQuery('.fm_modal').show();
91
- },
92
- success: function(data) {
93
- if(limit < <?php echo $subs_count; ?>) {
94
- limit += 1000;
95
- export_submissions(type, limit);
96
- progressbar.progressbar( "value", limit);
97
- loaded_percent = Math.round((progressbar.progressbar( "value" ) * 100)/ parseInt(<?php echo $subs_count; ?>));
98
- progressLabel.text( loaded_percent + ' %');
99
- progressbarValue = progressbar.find( ".fm-progress-label" );
100
- if( loaded_percent >= 46 ) {
101
- progressbarValue.css({
102
- "color": '#fff',
103
- });
104
- }
105
- else {
106
- progressbarValue.css({
107
- "color": '#444',
108
- });
109
- }
110
- }
111
- else{
112
- jQuery('.fm_modal').hide();
113
- progressbar.progressbar( "value", 0);
114
- progressLabel.text( 'Loading ...' );
115
- progressbarValue = progressbar.find( ".fm-progress-label" );
116
- progressbarValue.css({
117
- "color": '#444',
118
- });
119
- window.location = "<?php echo add_query_arg(array('form_id' => $form_id, 'send_header' => 1), admin_url('admin-ajax.php')); ?>&action=generete_"+type+"_fmc&limitstart="+limit;
120
- }
121
- }
122
- });
123
- }
124
-
125
- function clickLabChBAll(ChBAll) {
126
- <?php
127
- if (isset($sorted_label_names)) {
128
- $templabels = array_merge(array(
129
- 'submitid',
130
- 'submitdate',
131
- 'submitterip',
132
- 'submitterusername',
133
- 'submitteremail'
134
- ), $sorted_labels_id);
135
- $sorted_label_names_for_check = array_merge(array(
136
- 'ID',
137
- 'Submit date',
138
- "Submitter's IP",
139
- "Submitter's Username",
140
- "Submitter's Email Address"
141
- ), $sorted_label_names_original);
142
- }
143
- else {
144
- $templabels = array(
145
- 'submitid',
146
- 'submitdate',
147
- 'submitterip',
148
- 'submitterusername',
149
- 'submitteremail'
150
- );
151
- $sorted_label_names_for_check = array(
152
- 'ID',
153
- 'Submit date',
154
- "Submitter's IP",
155
- 'Submitter\'s Username',
156
- 'Submitter\'s Email Address'
157
- );
158
- }
159
- ?>
160
- if (ChBAll.checked) {
161
- document.forms.admin_form.hide_label_list.value = '';
162
- for (i = 0; i <= ChBAll.form.length; i++) {
163
- if (typeof(ChBAll.form[i]) != "undefined") {
164
- if (ChBAll.form[i].type == "checkbox") {
165
- ChBAll.form[i].checked = true;
166
- }
167
- }
168
- }
169
- }
170
- else {
171
- document.forms.admin_form.hide_label_list.value = '@<?php echo implode($templabels, '@@') ?>@' + '@payment_info@';
172
- for (i = 0; i <= ChBAll.form.length; i++) {
173
- if (typeof(ChBAll.form[i]) != "undefined") {
174
- if (ChBAll.form[i].type == "checkbox") {
175
- ChBAll.form[i].checked = false;
176
- }
177
- }
178
- }
179
- }
180
- renderColumns();
181
- }
182
-
183
- function remove_all() {
184
- if(document.getElementById('startdate'))
185
- document.getElementById('startdate').value='';
186
- if(document.getElementById('enddate'))
187
- document.getElementById('enddate').value='';
188
- if(document.getElementById('id_search'))
189
- document.getElementById('id_search').value='';
190
- if(document.getElementById('ip_search'))
191
- document.getElementById('ip_search').value='';
192
- if(document.getElementById('username_search'))
193
- document.getElementById('username_search').value='';
194
- if(document.getElementById('useremail_search'))
195
- document.getElementById('useremail_search').value='';
196
- <?php
197
- $n = count($rows);
198
- for ($i = 0; $i < count($sorted_label_names); $i++) {
199
- if ($sorted_label_types[$i] != "type_mark_map") { ?>
200
- document.getElementById('<?php echo $form_id . '_' . $sorted_labels_id[$i] . '_search'; ?>').value='';
201
- <?php
202
- }
203
- }
204
- ?>
205
- }
206
- function show_hide_filter() {
207
- if (document.getElementById('fields_filter').style.display == "none") {
208
- document.getElementById('fields_filter').style.display = '';
209
- }
210
- else {
211
- document.getElementById('fields_filter').style.display = "none";
212
- }
213
- return false;
214
- }
215
- jQuery(document).ready(function () {
216
- jQuery('.theme-detail').click(function () {
217
- jQuery(this).siblings('.themedetaildiv').toggle();
218
- return false;
219
- });
220
- });
221
- </script>
222
- <div class="fm_modal">
223
- <div id="fm-progressbar" >
224
- <div class="fm-progress-label">Loading...</div>
225
- </div>
226
- </div>
227
- <div class="export_progress">
228
- <span class="exp_count"><?php echo $subs_count; ?></span> left from <?php echo $subs_count; ?>
229
- </div>
230
- <div id="sbox-overlay" onclick="toggleChBDiv(false);">
231
- </div>
232
- <div id="ChBDiv">
233
- <form action="#">
234
- <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
235
- <p style="font-weight: bold; font-size: 18px; margin-top: 0px;">Select Columns</p>
236
- <div class="fm_check_labels"><input type="checkbox" <?php echo ($lists['hide_label_list'] === '') ? 'checked="checked"' : ''; ?> onclick="clickLabChBAll(this)" id="ChBAll"/><label for="ChBAll"> All</label></div>
237
- <?php
238
- foreach ($templabels as $key => $curlabel) {
239
- if (strpos($lists['hide_label_list'], '@' . $curlabel . '@') === FALSE) {
240
- ?>
241
- <div class="fm_check_labels"><input type="checkbox" checked="checked" onclick="clickLabChB('<?php echo $curlabel; ?>', this)" id="fm_check_id_<?php echo $curlabel; ?>" /><label for="fm_check_id_<?php echo $curlabel; ?>"> <?php echo stripslashes($sorted_label_names_for_check[$key]); ?></label></div>
242
- <?php
243
- }
244
- else {
245
- ?>
246
- <div class="fm_check_labels"><input type="checkbox" onclick="clickLabChB('<?php echo $curlabel; ?>', this)" id="fm_check_id_<?php echo $curlabel; ?>"/><label for="fm_check_id_<?php echo $curlabel; ?>"> <?php echo stripslashes($sorted_label_names_for_check[$key]); ?></label></div>
247
- <?php
248
- }
249
- }
250
- $ispaypal = FALSE;
251
- for ($i = 0; $i < count($sorted_label_names); $i++) {
252
- if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
253
- $ispaypal = TRUE;
254
- }
255
- }
256
- if ($ispaypal) {
257
- ?>
258
- <div class="fm_check_labels">
259
- <input type="checkbox" onclick="clickLabChB('payment_info', this)" id="fm_check_payment_info" <?php echo (strpos($lists['hide_label_list'], '@payment_info@') === FALSE) ? 'checked="checked"' : ''; ?> />
260
- <label for="fm_check_payment_info"> Payment Info</label>
261
- </div>
262
- <?php
263
- }
264
- ?>
265
- <div style="text-align: center; padding-top: 20px;">
266
- <button onclick="toggleChBDiv(false); return false;" style="background: #4EC0D9; width: 78px; height: 32px; border: 1px solid #4EC0D9; border-radius: 0px; color: #fff; cursor: pointer;">Done</button>
267
- </div>
268
- </form>
269
- </div>
270
- <div class="fm-user-manual">
271
- This section allows you to view and manage form submissions.
272
- <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-7.html">Read More in User Manual</a>
273
- </div>
274
- <div class="fm-upgrade-pro">
275
- <a target="_blank" href="https://web-dorado.com/files/fromContactForm.php">
276
- <div class="fm-upgrade-img">
277
- UPGRADE TO PRO VERSION
278
- <span></span>
279
- </div>
280
- </a>
281
- </div>
282
- <div class="fm-clear"></div>
283
- <form action="admin.php?page=submissions_fmc" method="post" id="admin_form" name="admin_form">
284
- <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
285
- <input type="hidden" name="option" value="com_formmaker" />
286
- <input type="hidden" id="task" name="task" value="" />
287
- <input type="hidden" id="current_id" name="current_id" value="" />
288
- <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php echo $asc_or_desc; ?>" />
289
- <input type="hidden" name="order_by" id="order_by" value="<?php echo $order_by; ?>" />
290
-
291
- <div class="fm-submissions-page">
292
- <div class="submissions-actions">
293
- <div class="fm-form-title">
294
- <?php echo $chosen_form_title; ?>
295
- </div>
296
- <div class="fm-page-actions">
297
- <button class="fm-button block-button small" onclick="fm_set_input_value('task', 'block_ip'); fm_form_submit(event, 'admin_form');">
298
- <span></span>
299
- Block IP
300
- </button>
301
- <button class="fm-button unblock-button medium" onclick="fm_set_input_value('task', 'unblock_ip'); fm_form_submit(event, 'admin_form');">
302
- <span></span>
303
- Unblock IP
304
- </button>
305
- <button class="fm-button delete-button small" onclick="if (confirm('Do you want to delete selected items?')) { fm_set_input_value('task', 'delete_all'); fm_form_submit(event, 'admin_form'); } else { return false; }">
306
- <span></span>
307
- Delete
308
- </button>
309
- </div>
310
- </div>
311
- <div class="submissions-toolbar">
312
- <div class="submissions-tools">
313
- <select name="form_id" id="form_id" onchange="document.admin_form.submit();">
314
- <option value="0" selected="selected"> - Select a Form - </option>
315
- <?php if ($forms) {
316
- foreach($forms as $form) {
317
- ?>
318
- <option value="<?php echo $form->id; ?>" <?php if ($form_id == $form->id) { echo 'selected="selected"'; }?>> <?php echo $form->title ?> </option>
319
- <?php
320
- }
321
- } ?>
322
- </select>
323
- <div class="fm-reports">
324
- <div class="fm-tools-button"><div class="fm-total_entries"><?php echo $statistics["total_entries"]; ?></div>Entries</div>
325
- <div class="fm-tools-button"><div class="fm-total_rate"><?php echo $statistics["conversion_rate"]; ?></div>Conversion Rate</div>
326
- <div class="fm-tools-button"><div class="fm-total_views"><?php echo $statistics["total_views"] ? $statistics["total_views"] : 0; ?></div>Views</div>
327
- </div>
328
-
329
- <div class="fm-export-tools">
330
- <span class="exp_but_span">Export to</span>
331
- &nbsp;
332
- <button class="fm-tools-button" onclick="export_submissions('csv', 0); return false;">
333
- CSV
334
- </button>
335
- <button class="fm-tools-button" onclick="export_submissions('xml', 0); return false;">
336
- XML
337
- </button>
338
- </div>
339
- </div>
340
- </div>
341
- <div class="tablenav top">
342
- <div class="fm-filters">
343
- <div class="fm-search-tools">
344
- <input type="hidden" name="hide_label_list" value="<?php echo $lists['hide_label_list']; ?>">
345
- <button class="fm-icon show-filter-icon" onclick="show_hide_filter(); return false;" title="Show Filters">
346
- <span></span>
347
- </button>
348
- <button class="fm-icon search-icon" onclick="fm_form_submit(event, 'admin_form'); return false;" title="Search">
349
- </button>
350
- <button class="fm-icon reset-icon" onclick="remove_all(); fm_form_submit(event, 'admin_form'); return false;" title="Reset">
351
- </button>
352
- </div>
353
- <div class="fm-add-remove">
354
- <?php if (isset($sorted_label_names)) { ?>
355
- <button class="fm-button" onclick="toggleChBDiv(true); return false;">
356
- Add/Remove Columns
357
- </button>
358
- <?php WDW_FMC_Library::html_page_nav($lists['total'], $lists['limit'], 'admin_form'); ?>
359
- <?php } ?>
360
- <input type="hidden" name="pagination_clicked" id="pagination_clicked" value=""/>
361
- </div>
362
- </div>
363
- <div class="fm-clear"></div>
364
- </div>
365
-
366
- <div class="fm-loading-container" style="display:none;">
367
- <div class="fm-loading-content">
368
- </div>
369
- </div>
370
- <div class="submit_content" id="fm-scroll" style="width: 100%;">
371
- <table class="wp-list-table widefat fixed posts table_content">
372
- <thead>
373
- <tr>
374
- <?php if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))): ?>
375
- <th class="table_small_col count_col sub-align">PDF</th>
376
- <?php endif; ?>
377
- <th class="table_small_col count_col sub-align">#</th>
378
- <th scope="col" id="cb" class="manage-column column-cb check-column table_small_col sub-align form_check"><input id="check_all" type="checkbox"></th>
379
- <th scope="col" id="submitid_fc" class="table_small_col sub-align submitid_fc <?php if ($order_by == "group_id") echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_id;?>>
380
- <a href="" class="sub_id" onclick="fm_set_input_value('order_by', 'group_id');
381
- fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'group_id' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
382
- fm_form_submit(event, 'admin_form')">
383
- <span>ID</span>
384
- <span class="sorting-indicator" style="margin-top: 8px;"></span>
385
- </a>
386
- </th>
387
- <th class="table_small_col sub-align">Edit</th>
388
- <th class="table_small_col sub-align">Delete</th>
389
- <th scope="col" id="submitdate_fc" class="table_large_col submitdate_fc <?php if ($order_by == "date") echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_date;?>>
390
- <a href="" onclick="fm_set_input_value('order_by', 'date');
391
- fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'date' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
392
- fm_form_submit(event, 'admin_form')">
393
- <span>Submit date</span>
394
- <span class="sorting-indicator"></span>
395
- </a>
396
- </th>
397
- <th scope="col" id="submitterip_fc" class="table_medium_col_uncenter submitterip_fc <?php if ($order_by == "ip")echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_ip;?>>
398
- <a href="" onclick="fm_set_input_value('order_by', 'ip');
399
- fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'ip' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
400
- fm_form_submit(event, 'admin_form')">
401
- <span>Submitter's IP</span>
402
- <span class="sorting-indicator"></span>
403
- </a>
404
- </th>
405
- <th scope="col" id="submitterusername_fc" class="table_medium_col_uncenter submitterusername_fc <?php if ($order_by == "display_name")echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_username;?>>
406
- <a href="" onclick="fm_set_input_value('order_by', 'display_name');
407
- fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'display_name' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
408
- fm_form_submit(event, 'admin_form')">
409
- <span>Submitter's Username</span>
410
- <span class="sorting-indicator"></span>
411
- </a>
412
- </th>
413
- <th scope="col" id="submitteremail_fc" class="table_medium_col_uncenter submitteremail_fc <?php if ($order_by == "user_email")echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_useremail ;?>>
414
- <a href="" onclick="fm_set_input_value('order_by', 'user_email');
415
- fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'user_email' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
416
- fm_form_submit(event, 'admin_form')">
417
- <span>Submitter's Email Address</span>
418
- <span class="sorting-indicator"></span>
419
- </a>
420
- </th>
421
- <?php
422
- for ($i = 0; $i < count($sorted_label_names); $i++) {
423
- $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
424
- $styleStr2 = $this->model->hide_or_not($lists['hide_label_list'] , '@payment_info@');
425
- $field_title = $this->model->get_type_address($sorted_label_types[$i], $sorted_label_names_original[$i]);
426
- if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
427
- $ispaypal = TRUE;
428
- ?>
429
- <th <?php echo $styleStr; ?> id="<?php echo $sorted_labels_id[$i] . '_fc'; ?>" class="table_large_col <?php echo $sorted_labels_id[$i] . '_fc'; if ($order_by == $sorted_labels_id[$i] . "_field") echo $oder_class . '"';else echo $oder_class_default . '"'; ?>">
430
- <a href="" onclick="fm_set_input_value('order_by', '<?php echo $sorted_labels_id[$i] . '_field'; ?>'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'admin_form')">
431
- <span><?php echo $field_title; ?></span>
432
- <span class="sorting-indicator"></span>
433
- </a>
434
- </th>
435
- <th class="table_large_col payment_info_fc" <?php echo $styleStr2; ?>>Payment Info</th>
436
- <?php
437
- }
438
- else {
439
- ?>
440
- <th <?php echo $styleStr; ?> id="<?php echo $sorted_labels_id[$i] . '_fc';?>" class="<?php echo ($sorted_label_types[$i] == 'type_mark_map' || $sorted_label_types[$i] == 'type_matrix') ? 'table_large_col ' : ''; echo $sorted_labels_id[$i] . '_fc'; if ($order_by == $sorted_labels_id[$i] . "_field") echo $oder_class . '"';else echo $oder_class_default . '"'; ?>">
441
- <a href="" onclick="fm_set_input_value('order_by', '<?php echo $sorted_labels_id[$i] . '_field'; ?>'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'admin_form')">
442
- <span><?php echo $field_title; ?></span>
443
- <span class="sorting-indicator"></span>
444
- </a>
445
- </th>
446
- <?php
447
- }
448
- }
449
- ?>
450
- </tr>
451
- <tr id="fields_filter" style="display: none;">
452
- <th></th>
453
- <th></th>
454
- <th class="submitid_fc" <?php echo $style_id; ?> >
455
- <input type="text" name="id_search" id="id_search" value="<?php echo $lists['id_search'] ?>" onChange="this.form.submit();" style="width:30px"/>
456
- </th>
457
- <th></th>
458
- <th></th>
459
- <th width="150" class="submitdate_fc" <?php echo $style_date; ?>>
460
- <table align="center" style="margin:auto" class="simple_table">
461
- <tr class="simple_table">
462
- <td class="simple_table" style="text-align: left;">From:</td>
463
- <td style="text-align: center;" class="simple_table">
464
- <input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php echo $lists['startdate']; ?>" />
465
- </td>
466
- <td style="text-align: center;" class="simple_table">
467
- <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
468
- </td>
469
- </tr>
470
- <tr class="simple_table">
471
- <td style="text-align: left;" class="simple_table">To:</td>
472
- <td style="text-align: center;" class="simple_table">
473
- <input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php echo $lists['enddate']; ?>" />
474
- </td>
475
- <td style="text-align: center;" class="simple_table">
476
- <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
477
- </td>
478
- </tr>
479
- </table>
480
- </th>
481
- <th class="table_medium_col_uncenter submitterip_fc" <?php echo $style_ip; ?>>
482
- <input type="text" name="ip_search" id="ip_search" value="<?php echo $lists['ip_search']; ?>" onChange="this.form.submit();" />
483
- </th>
484
- <th class="table_medium_col_uncenter submitterusername_fc" <?php echo $style_username; ?>>
485
- <input type="text" name="username_search" id="username_search" value="<?php echo $lists['username_search']; ?>" onChange="this.form.submit();" />
486
- </th>
487
- <th class="table_medium_col_uncenter submitteremail_fc" <?php echo $style_useremail; ?>>
488
- <input type="text" name="useremail_search" id="useremail_search" value="<?php echo $lists['useremail_search']; ?>" onChange="this.form.submit();" />
489
- </th>
490
- <?php
491
- for ($i = 0; $i < count($sorted_label_names); $i++) {
492
- $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
493
- if (!$ka_fielderov_search) {
494
- if ($lists[$form_id . '_' . $sorted_labels_id[$i] . '_search']) {
495
- $ka_fielderov_search = TRUE;
496
- }
497
- }
498
- switch ($sorted_label_types[$i]) {
499
- case 'type_mark_map': ?>
500
- <th class="table_large_col <?php echo $sorted_labels_id[$i]; ?>_fc" <?php echo $styleStr; ?>></th>
501
- <?php
502
- break;
503
- case 'type_paypal_payment_status': ?>
504
- <th class="table_large_col <?php echo $sorted_labels_id[$i]; ?>_fc" <?php echo $styleStr; ?>>
505
- <select style="font-size: 11px; margin: 0; padding: 0; height: inherit;" name="<?php echo $form_id . '_' . $sorted_labels_id[$i]; ?>_search" id="<?php echo $form_id.'_'.$sorted_labels_id[$i]; ?>_search" onChange="this.form.submit();" value="<?php echo $lists[$form_id.'_'.$sorted_labels_id[$i].'_search']; ?>" >
506
- <option value="" ></option>
507
- <option value="canceled" >Canceled</option>
508
- <option value="cleared" >Cleared</option>
509
- <option value="cleared by payment review" >Cleared by payment review</option>
510
- <option value="completed" >Completed</option>
511
- <option value="denied" >Denied</option>
512
- <option value="failed" >Failed</option>
513
- <option value="held" >Held</option>
514
- <option value="in progress" >In progress</option>
515
- <option value="on hold" >On hold</option>
516
- <option value="paid" >Paid</option>
517
- <option value="partially refunded" >Partially refunded</option>
518
- <option value="pending verification" >Pending verification</option>
519
- <option value="placed" >Placed</option>
520
- <option value="processing" >Processing</option>
521
- <option value="refunded" >Refunded</option>
522
- <option value="refused" >Refused</option>
523
- <option value="removed" >Removed</option>
524
- <option value="returned" >Returned</option>
525
- <option value="reversed" >Reversed</option>
526
- <option value="temporary hold" >Temporary hold</option>
527
- <option value="unclaimed" >Unclaimed</option>
528
- </select>
529
- <script>
530
- var element = document.getElementById('<?php echo $form_id.'_'.$sorted_labels_id[$i]; ?>_search');
531
- element.value = '<?php echo $lists[$form_id.'_'.$sorted_labels_id[$i].'_search']; ?>';
532
- </script>
533
- </th>
534
- <th class="table_large_col payment_info_fc" <?php echo $styleStr2; ?>></th>
535
- <?php
536
- break;
537
- default: ?>
538
- <th class="<?php echo $sorted_labels_id[$i]; ?>_fc" <?php echo $styleStr; ?>>
539
- <input name="<?php echo $form_id .'_' . $sorted_labels_id[$i].'_search'; ?>" id="<?php echo $form_id .'_' . $sorted_labels_id[$i].'_search'; ?>" type="text" value="<?php echo $lists[$form_id.'_'.$sorted_labels_id[$i].'_search']; ?>" onChange="this.form.submit();" >
540
- </th>
541
- <?php
542
- break;
543
- }
544
- }
545
- ?>
546
- </tr>
547
- </thead>
548
- <?php
549
- $k = 0;
550
- for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
551
- $i = $group_id_s[$www];
552
- $alternate = (!isset($alternate) || $alternate == 'class="alternate"') ? '' : 'class="alternate"';
553
- $temp = $this->model->array_for_group_id($group_id_s[$www], $rows);
554
- $data = $temp[0];
555
- $userinfo=get_userdata($data->user_id_wd);
556
- $useremail=$userinfo ? $userinfo->user_email : "";
557
- $username=$userinfo ? $userinfo->display_name : "";
558
- ?>
559
- <tr <?php echo $alternate; ?>>
560
- <?php if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))): ?>
561
- <td class="table_small_col pdf_col sub-align">
562
- <?php if($pdf_data && isset($pdf_data[$group_id_s[$www]])): ?>
563
- <a href="<?php echo site_url().'/'.$pdf_data[$group_id_s[$www]]; ?>" style="display: block;" download><img src="<?php echo WD_FM_PDF_URL . '/images/pdf-icon.png'; ?>" /></a>
564
- <?php endif; ?>
565
- </td>
566
- <?php endif; ?>
567
- <td class="table_small_col count_col sub-align"><?php echo $www + 1; ?></td>
568
- <td class="check-column table_small_col sub-align" style="padding: 0;">
569
- <input type="checkbox" name="post[]" value="<?php echo $data->group_id; ?>">
570
- </td>
571
- <td class="table_small_col sub-align submitid_fc" id="submitid_fc" <?php echo $style_id; ?>>
572
- <a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form');" >
573
- <?php echo $data->group_id; ?>
574
- </a>
575
- </td>
576
- <td class="table_small_col sub-align">
577
- <a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form');">Edit
578
- </a>
579
- </td>
580
- <td class="table_small_col sub-align">
581
- <a href="" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form'); } else { return false; }">Delete
582
- </a>
583
- </td>
584
- <td class="table_large_col submitdate_fc sub-align" id="submitdate_fc" <?php echo $style_date; ?>>
585
- <a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form');" ><?php echo $data->date ;?>
586
- </a>
587
- </td>
588
- <td class="table_medium_col_uncenter submitterip_fc sub-align" id="submitterip_fc" <?php echo $style_ip; ?>>
589
- <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'fromipinfoinpopup_fmc', 'data_ip' => $data->ip, 'width' => '400', 'height' => '300', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>" title="Show submitter information" <?php echo (!in_array($data->ip, $blocked_ips)) ? '' : 'style="color: #FF0000;"'; ?>><?php echo $data->ip; ?></a>
590
- </td>
591
- <td class="table_large_col submitterusername_fc sub-align" id="submitterusername_fc" <?php echo $style_username; ?>>
592
- <?php echo $username; ?>
593
- </td>
594
- <td class="table_large_col submitteremail_fc sub-align" id="submitteremail_fc" <?php echo $style_useremail; ?>>
595
- <?php echo $useremail; ?>
596
- </td>
597
- <?php
598
- for ($h = 0; $h < $m; $h++) {
599
- $not_label = TRUE;
600
- for ($g = 0; $g < count($temp); $g++) {
601
- $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$h]);
602
- if ($temp[$g]->element_label == $sorted_labels_id[$h]) {
603
- if (strpos($temp[$g]->element_value, "***map***")) {
604
- $map_params = explode('***map***', $temp[$g]->element_value);
605
- ?>
606
- <td class="table_large_col <?php echo $sorted_labels_id[$h]; ?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
607
- <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'frommapeditinpopup_fmc', 'long' => $map_params[0], 'lat' => $map_params[1], 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>" title="Show on Map">Show on Map</a>
608
- </td>
609
- <?php
610
- }
611
- elseif (strpos($temp[$g]->element_value, "*@@url@@*")) {
612
- ?>
613
- <td class="<?php echo $sorted_labels_id[$h]; ?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
614
- <?php
615
- $new_files = explode("*@@url@@*", $temp[$g]->element_value);
616
- foreach ($new_files as $new_file) {
617
- if ($new_file) {
618
- $new_filename = explode('/', $new_file);
619
- $new_filename = $new_filename[count($new_filename) - 1];
620
- ?>
621
- <a target="_blank" class="fm_fancybox" rel="group_<?php echo $www; ?>" href="<?php echo $new_file; ?>"><?php echo $new_filename; ?></a><br />
622
- <?php
623
- }
624
- }
625
- ?>
626
- </td>
627
- <?php
628
- }
629
- elseif (strpos($temp[$g]->element_value, "***star_rating***")) {
630
- $view_star_rating_array = $this->model->view_for_star_rating($temp[$g]->element_value, $temp[$g]->element_label);
631
- $stars = $view_star_rating_array[0];
632
- ?>
633
- <td align="center" class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>><?php echo $stars; ?></td>
634
- <?php
635
- }
636
- elseif (strpos($temp[$g]->element_value, "***matrix***")) {
637
- ?>
638
- <td class="table_large_col <?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
639
- <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'show_matrix', 'matrix_params' => $temp[$g]->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>" title="Show Matrix">Show Matrix</a>
640
- </td>
641
- <?php
642
- }
643
- elseif (strpos($temp[$g]->element_value, "@@@") !== FALSE || $temp[$g]->element_value == "@@@" || $temp[$g]->element_value == "@@@@@@@@@") {
644
- ?>
645
- <td class="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
646
- <p><?php echo str_replace("@@@", " ", $temp[$g]->element_value); ?></p>
647
- </td>
648
- <?php
649
- }
650
- elseif (strpos($temp[$g]->element_value, "***grading***")) {
651
- $view_grading_array = $this->model->view_for_grading($temp[$g]->element_value);
652
- $items = $view_grading_array[0];
653
- ?>
654
- <td class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
655
- <p><?php echo $items; ?></p>
656
- </td>
657
- <?php
658
- }
659
- else {
660
- if (strpos($temp[$g]->element_value, "***quantity***")) {
661
- $temp[$g]->element_value = str_replace("***quantity***", " ", $temp[$g]->element_value);
662
- }
663
- if (strpos($temp[$g]->element_value, "***property***")) {
664
- $temp[$g]->element_value = str_replace("***property***", " ", $temp[$g]->element_value);
665
- }
666
-
667
- if($sorted_label_types[$h]=="type_submitter_mail"){
668
- $query = $wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d" AND group_id="%d" AND element_value="verified**%d"', $form_id, $i, $sorted_labels_id[$h]);
669
- $isverified = $wpdb->get_var($query);
670
-
671
- if($isverified) { ?>
672
- <td class="<?php echo $sorted_labels_id[$h];?>_fc" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
673
- <p><?php echo $temp[$g]->element_value; ?> <span style="color:#2DA068;">( Verified <img src="<?php echo WD_FMC_URL . '/images/verified.png'; ?>" /> )</span></p>
674
- </td>
675
- <?php }
676
- else {?>
677
- <td class="<?php echo $sorted_labels_id[$h];?>_fc" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
678
- <p><?php echo $temp[$g]->element_value; ?></p>
679
- </td>
680
- <?php }
681
- }
682
- else{
683
- ?>
684
- <td class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
685
- <p><?php echo str_replace("***br***", '<br>', stripslashes($temp[$g]->element_value)) ; ?></p>
686
- </td>
687
- <?php
688
- }
689
- }
690
- $not_label = FALSE;
691
- }
692
- }
693
- if ($not_label) {
694
- ?>
695
- <td class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>><p>&nbsp;</p></td>
696
- <?php
697
- }
698
- }
699
- if ($ispaypal) {
700
- $styleStr = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
701
- ?>
702
- <td class="table_large_col payment_info_fc sub-align" id="payment_info_fc" <?php echo $styleStr; ?>>
703
- <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'paypal_info', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>">
704
- <img src="<?php echo WD_FMC_URL . '/images/info.png'; ?>" />
705
- </a>
706
- </td>
707
- <?php
708
- }
709
- ?>
710
- </tr>
711
- <?php
712
- $k = 1 - $k;
713
- }
714
- ?>
715
- </table>
716
- </div>
717
- <?php
718
- if ($sorted_label_types) {
719
- foreach ($sorted_label_types as $key => $sorted_label_type) {
720
- if ($this->model->check_radio_type($sorted_label_type)) {
721
- $is_stats = true;
722
- break;
723
- }
724
- }
725
- if ($is_stats) {
726
- $ajax_nonce = wp_create_nonce( "nonce_fmc_ajax" );
727
- ?>
728
- <br/>
729
- <div class="fm-statistics">
730
- <h1>Statistics</h1>
731
- <table class="stats">
732
- <tr>
733
- <td>
734
- <label for="sorted_label_key">Select a Field:</label>
735
- </td>
736
- <td>
737
- <select id="sorted_label_key">
738
- <option value="">Select a Field</option>
739
- <?php
740
- foreach ($sorted_label_types as $key => $sorted_label_type) {
741
- if ($sorted_label_type=="type_checkbox" || $sorted_label_type=="type_radio" || $sorted_label_type=="type_own_select" || $sorted_label_type=="type_country" || $sorted_label_type=="type_paypal_select" || $sorted_label_type=="type_paypal_radio" || $sorted_label_type=="type_paypal_checkbox" || $sorted_label_type=="type_paypal_shipping") {
742
- ?>
743
- <option value="<?php echo $key; ?>"><?php echo $sorted_label_names_original[$key]; ?></option>
744
- <?php
745
- }
746
- }
747
- ?>
748
- </select>
749
- </td>
750
- <td></td>
751
- </tr>
752
- <tr>
753
- <td>
754
- <label>Select a Date:</label>
755
- </td>
756
- <td>
757
- From: <input class="inputbox" type="text" name="startstats" id="startstats" size="9" maxlength="9" />
758
- <input type="reset" class="button" style="width: 22px;" value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');" />
759
-
760
- To: <input class="inputbox" type="text" name="endstats" id="endstats" size="9" maxlength="9" />
761
- <input type="reset" class="button" style="width: 22px;" value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');" />
762
- </td>
763
- <td>
764
- <button onclick="show_stats(); return false;">Show</button>
765
- </td>
766
- </tr>
767
- </table>
768
-
769
- <div id="div_stats"></div>
770
- </div>
771
- <script>
772
- function show_stats() {
773
- jQuery('#div_stats').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
774
- if(jQuery('#sorted_label_key').val()!="") {
775
- jQuery('#div_stats').load('<?php echo add_query_arg(array('action' => 'get_stats_fmc', 'page' => 'submissions_fmc'), admin_url('admin-ajax.php')); ?>', {
776
- 'task': 'show_stats',
777
- 'form_id' : '<?php echo $form_id; ?>',
778
- 'sorted_label_key' : jQuery('#sorted_label_key').val(),
779
- 'startdate' : jQuery('#startstats').val(),
780
- 'enddate' : jQuery('#endstats').val(),
781
- 'nonce_fmc_ajax': '<?php echo $ajax_nonce; ?>'
782
- });
783
- }
784
- else {
785
- jQuery('#div_stats').html("<div style='padding:10px 5px; color:red; font-size:14px;'>Please select the field!</div>");
786
- }
787
- jQuery("#div_stats").removeClass("fm_loading");
788
- }
789
- </script>
790
- <?php
791
- }
792
- }
793
- ?>
794
- </div>
795
- </form>
796
- <script>
797
- function fm_scroll(element) {
798
- var scrollbar= document.createElement('div');
799
- scrollbar.appendChild(document.createElement('div'));
800
- scrollbar.style.overflow= 'auto';
801
- scrollbar.style.overflowY= 'hidden';
802
- scrollbar.firstChild.style.width= element.scrollWidth+'px';
803
- scrollbar.firstChild.style.paddingTop= '1px';
804
- scrollbar.firstChild.appendChild(document.createTextNode('\xA0'));
805
- scrollbar.onscroll= function() {
806
- element.scrollLeft= scrollbar.scrollLeft;
807
- };
808
- element.onscroll= function() {
809
- scrollbar.scrollLeft= element.scrollLeft;
810
- };
811
- element.parentNode.insertBefore(scrollbar, element);
812
- }
813
- jQuery(window).load(function() {
814
- fm_popup();
815
- fm_scroll(document.getElementById('fm-scroll'));
816
- if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
817
- jQuery(".fm_fancybox").fancybox({
818
- 'maxWidth ' : 600,
819
- 'maxHeight' : 500
820
- });
821
- }
822
- });
823
- <?php if ($ka_fielderov_search) { ?>
824
- document.getElementById('fields_filter').style.display = '';
825
- <?php } ?>
826
- </script>
827
- <?php
828
- }
829
-
830
- public function show_stats($form_id) {
831
- $key = (isset($_POST['sorted_label_key']) ? esc_html(stripslashes($_POST['sorted_label_key'])) : '');
832
- $labels_parameters = $this->model->get_labels_parameters($form_id);
833
- $where_choices = $labels_parameters[7];
834
- $sorted_label_names_original = $labels_parameters[4];
835
- $sorted_labels_id = $labels_parameters[0];
836
- if(count($sorted_labels_id)!=0 && $key < count($sorted_labels_id) ) {
837
- $choices_params = $this->model->statistic_for_radio($where_choices, $sorted_labels_id[$key]);
838
- $sorted_label_name_original = $sorted_label_names_original[$key];
839
- $choices_count = $choices_params[0];
840
- $choices_labels = $choices_params[1];
841
- $unanswered = $choices_params[2];
842
- $all = $choices_params[3];
843
- $colors = $choices_params[4];
844
- $choices_colors = $choices_params[5];
845
- }
846
- else {
847
- $choices_labels = array();
848
- $sorted_label_name_original = '';
849
- $unanswered = NULL;
850
- $all = 0;
851
- }
852
- ?>
853
- <br/>
854
- <br/>
855
- <div class="field-label"><?php echo stripslashes($sorted_label_name_original); ?></div>
856
- <table class="adminlist">
857
- <thead>
858
- <tr>
859
- <th width="20%">Choices</th>
860
- <th>Percentage</th>
861
- <th width="10%">Count</th>
862
- </tr>
863
- </thead>
864
- <?php
865
- $k=0;
866
- foreach ($choices_labels as $key => $choices_label) {
867
- if (strpos($choices_label, "***quantity***")) {
868
- $choices_label = str_replace("***quantity***", " ", $choices_label);
869
- }
870
- if (strpos($choices_label, "***property***")) {
871
- $choices_label = str_replace("***property***", " ", $choices_label);
872
- }
873
- ?>
874
- <tr>
875
- <td class="label<?php echo $k; ?>"><?php echo str_replace("***br***",'<br>', $choices_label)?></td>
876
- <td>
877
- <div class="bordered" style="width:<?php echo ($choices_count[$key]/($all-$unanswered))*100; ?>%; height:16px; background-color:<?php echo $colors[$key % 2]; ?>; float: left;">
878
- </div>
879
- <div <?php echo ($choices_count[$key]/($all-$unanswered)!=1 ? 'class="bordered'.$k.'"' : "") ?> style="width:<?php echo 100-($choices_count[$key]/($all-$unanswered))*100; ?>%; height:16px; background-color:#F2F0F1; float: left;">
880
- </div>
881
- </td>
882
- <td>
883
- <div>
884
- <div style="width: 0; height: 0; border-top: 8px solid transparent;border-bottom: 8px solid transparent; border-right:8px solid <?php echo $choices_colors[$key % 2]; ?>; float:left;">
885
- </div>
886
- <div style="background-color:<?php echo $choices_colors[$key % 2]; ?>; height:16px; width:16px; text-align: center; margin-left:8px; color: #fff;">
887
- <?php echo $choices_count[$key]?>
888
- </div>
889
- </div>
890
- </td>
891
- </tr>
892
- <tr>
893
- <td colspan="3">
894
- </td>
895
- </tr>
896
- <?php
897
- $k = 1 - $k;
898
- }
899
- if($unanswered){
900
- ?>
901
- <tr>
902
- <td colspan="2" style="text-align:right; color: #000;">Unanswered</th>
903
- <td><strong style="margin-left:10px;"><?php echo $unanswered;?></strong></th>
904
- </tr>
905
- <?php
906
- }
907
- ?>
908
- <tr>
909
- <td colspan="2" style="text-align:right; color: #000;"><strong>Total</strong></th>
910
- <td><strong style="margin-left:10px;"><?php echo $all;?></strong></th>
911
- </tr>
912
- </table>
913
- <?php
914
- die();
915
- }
916
-
917
- public function edit($id) {
918
- $current_id = ((isset($id)) ? $id : 0);
919
- $params = $this->model->get_data_of_group_id($current_id);
920
- $rows = $params[0];
921
- $labels_id = $params[1];
922
- $labels_name = $params[2];
923
- $labels_type = $params[3];
924
- $ispaypal = $params[4];
925
- $userinfo = get_userdata($rows[0]->user_id_wd);
926
- $username = $userinfo ? $userinfo->display_name : "";
927
- $useremail = $userinfo ? $userinfo->user_email : "";
928
-
929
- ?>
930
- <form action="admin.php?page=submissions_fmc" method="post" id="adminForm" name="adminForm">
931
- <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
932
- <table width="99%">
933
- <tbody>
934
- <tr>
935
- <td width="100%"><h2>Edit Submission</h2></td>
936
- <td align="right">
937
- <input type="button" onclick="fm_set_input_value('task', 'save');
938
- fm_set_input_value('current_id', <?php echo $current_id; ?>);
939
- fm_form_submit(event, 'adminForm');" value="Save" class="button-secondary action">
940
- </td>
941
- <td align="right">
942
- <input type="button" onclick="fm_set_input_value('task', 'apply');
943
- fm_set_input_value('current_id', <?php echo $current_id ;?>);
944
- fm_form_submit(event, 'adminForm');" value="Apply" class="button-secondary action">
945
- </td>
946
- <td align="right">
947
- <input type="button" onclick="fm_set_input_value('task', '');fm_form_submit(event, 'adminForm');" value="Cancel" class="button-secondary action">
948
- </td>
949
- </tr>
950
- </tbody>
951
- </table>
952
- <table class="admintable">
953
- <tr>
954
- <td class="key"><label for="ID">ID: </label></td>
955
- <td><?php echo $rows[0]->group_id; ?></td>
956
- </tr>
957
- <tr>
958
- <td class="key"><label for="Date">Date: </label></td>
959
- <td><?php echo $rows[0]->date; ?></td>
960
- </tr>
961
- <tr>
962
- <td class="key"><label for="IP">IP: </label></td>
963
- <td><?php echo $rows[0]->ip; ?></td>
964
- </tr>
965
-
966
-
967
- <tr>
968
- <td class="key"><label for="Submitter's Username">Submitter's Username: </label></td>
969
- <td><?php echo $username; ?></td>
970
- </tr>
971
- <tr>
972
- <td class="key"><label for="Submitter's Email Address">Submitter's Email Address: </label></td>
973
- <td><?php echo $useremail; ?></td>
974
- </tr>
975
- <?php
976
- foreach ($labels_id as $key => $label_id) {
977
- if ($this->model->check_type_for_edit_function($labels_type[$key])) {
978
- $element_value = $this->model->check_for_submited_label($rows, $label_id);
979
- if ($element_value == "continue") {
980
- continue;
981
- }
982
- switch ($labels_type[$key]) {
983
- case 'type_checkbox':
984
- $choices = explode('***br***', $element_value);
985
- $choices = array_slice($choices, 0, count($choices) - 1);
986
- ?>
987
- <tr>
988
- <td class="key" rowspan="<?php echo count($choices); ?>">
989
- <label for="title"><?php echo $labels_name[$key]; ?></label>
990
- </td>
991
- <?php
992
- foreach ($choices as $choice_key => $choice) {
993
- ?>
994
- <td>
995
- <input type="text" name="submission_<?php echo $label_id.'_'.$choice_key; ?>" id="submission_<?php echo $label_id.'_'.$choice_key; ?>" value="<?php echo $choice; ?>" size="80" />
996
- </td>
997
- </tr>
998
- <?php
999
- }
1000
- break;
1001
- case 'type_paypal_payment_status':
1002
- ?>
1003
- <tr>
1004
- <td class="key">
1005
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1006
- </td>
1007
- <td>
1008
- <select name="submission_0" id="submission_0" >
1009
- <option value=""></option>
1010
- <option value="Canceled" >Canceled</option>
1011
- <option value="Cleared" >Cleared</option>
1012
- <option value="Cleared by payment review" >Cleared by payment review</option>
1013
- <option value="Completed" >Completed</option>
1014
- <option value="Denied" >Denied</option>
1015
- <option value="Failed" >Failed</option>
1016
- <option value="Held" >Held</option>
1017
- <option value="In progress" >In progress</option>
1018
- <option value="On hold" >On hold</option>
1019
- <option value="Paid" >Paid</option>
1020
- <option value="Partially refunded" >Partially refunded</option>
1021
- <option value="Pending verification" >Pending verification</option>
1022
- <option value="Placed" >Placed</option>
1023
- <option value="Processing" >Processing</option>
1024
- <option value="Refunded" >Refunded</option>
1025
- <option value="Refused" >Refused</option>
1026
- <option value="Removed" >Removed</option>
1027
- <option value="Returned" >Returned</option>
1028
- <option value="Reversed" >Reversed</option>
1029
- <option value="Temporary hold" >Temporary hold</option>
1030
- <option value="Unclaimed" >Unclaimed</option>
1031
- </select>
1032
- <script>
1033
- var element = document.getElementById("submission_0");
1034
- element.value = "<?php echo $element_value; ?>";
1035
- </script>
1036
- </td>
1037
- </tr>
1038
- <?php
1039
- break;
1040
- case 'type_star_rating':
1041
- $star_rating_array = $this->model->images_for_star_rating($element_value, $label_id);
1042
- $edit_stars = $star_rating_array[0];
1043
- $stars_value = $star_rating_array[1];
1044
- ?>
1045
- <tr>
1046
- <td class="key">
1047
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1048
- </td>
1049
- <td>
1050
- <input type="hidden" id="<?php echo $label_id; ?>_star_amountform_id_temp" name="<?php echo $label_id; ?>_star_amountform_id_temp" value="<?php echo $stars_value[0]; ?>">
1051
- <input type="hidden" name="<?php echo $label_id; ?>_star_colorform_id_temp" id="<?php echo $label_id; ?>_star_colorform_id_temp" value="<?php echo $stars_value[2]; ?>">
1052
- <input type="hidden" id="<?php echo $label_id; ?>_selected_star_amountform_id_temp" name="<?php echo $label_id; ?>_selected_star_amountform_id_temp" value="<?php echo $stars_value[1]; ?>">
1053
- <?php echo $edit_stars; ?>
1054
- <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1055
- </td>
1056
- </tr>
1057
- <?php
1058
- break;
1059
- case "type_scale_rating":
1060
- $scale_rating_array = $this->model->params_for_scale_rating($element_value, $label_id);
1061
- $scale = $scale_rating_array[0];
1062
- $scale_radio = $scale_rating_array[1];
1063
- $checked = $scale_rating_array[2];
1064
- ?>
1065
- <tr>
1066
- <td class="key">
1067
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1068
- </td>
1069
- <td>
1070
- <input type="hidden" id="<?php echo $label_id; ?>_scale_checkedform_id_temp" name="<?php echo $label_id; ?>_scale_checkedform_id_temp" value="<?php echo $scale_radio[1]; ?>">
1071
- <?php echo $scale; ?>
1072
- <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1073
- </td>
1074
- </tr>
1075
- <?php
1076
- break;
1077
- case 'type_range':
1078
- $range = $this->model->params_for_type_range($element_value, $label_id);
1079
- ?>
1080
- <tr>
1081
- <td class="key">
1082
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1083
- </td>
1084
- <td>
1085
- <?php echo $range; ?>
1086
- <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1087
- </td>
1088
- </tr>
1089
- <?php
1090
- break;
1091
- case 'type_spinner':
1092
- ?>
1093
- <tr>
1094
- <td class="key">
1095
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1096
- </td>
1097
- <td>
1098
- <input type="text" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo str_replace("*@@url@@*", '', $element_value); ?>" size="20" />
1099
- </td>
1100
- </tr>
1101
- <?php
1102
- break;
1103
- case 'type_grading':
1104
- $type_grading_array = $this->model->params_for_type_grading($element_value, $label_id);
1105
- $garding = $type_grading_array[0];
1106
- $garding_value = $type_grading_array[1];
1107
- $sum = $type_grading_array[2];
1108
- $items_count = $type_grading_array[3];
1109
- $element_value1 = $type_grading_array[4];
1110
- ?>
1111
- <tr>
1112
- <td class="key">
1113
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1114
- </td>
1115
- <td>
1116
- <?php echo $garding; ?>
1117
- <span id="<?php echo $label_id; ?>_grading_sumform_id_temp"><?php echo $sum; ?></span>/<span id="<?php echo $label_id; ?>_grading_totalform_id_temp"><?php echo $garding_value[$items_count]; ?></span><span id="<?php echo $label_id; ?>_text_elementform_id_temp"></span>
1118
- <input type="hidden" id="<?php echo $label_id; ?>_element_valueform_id_temp" name="<?php echo $label_id; ?>_element_valueform_id_temp" value="<?php echo $element_value1; ?>" />
1119
- <input type="hidden" id="<?php echo $label_id; ?>_grading_totalform_id_temp" name="<?php echo $label_id; ?>_grading_totalform_id_temp" value="<?php echo $garding_value[$items_count]; ?>" />
1120
- <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1121
- </td>
1122
- </tr>
1123
- <?php
1124
- break;
1125
- case 'type_matrix':
1126
- $type_matrix_array = $this->model->params_for_type_matrix($element_value, $label_id);
1127
- $matrix = $type_matrix_array[0];
1128
- $new_filename = $type_matrix_array[1];
1129
- ?>
1130
- <tr>
1131
- <td class="key">
1132
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1133
- </td>
1134
- <td>
1135
- <input type="hidden" id="<?php echo $label_id; ?>_matrixform_id_temp" name="<?php echo $label_id; ?>_matrixform_id_temp" value="<?php echo $new_filename; ?>">
1136
- <?php echo $matrix; ?>
1137
- <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1138
- </td>
1139
- </tr>
1140
- <?php
1141
- break;
1142
- default:
1143
- ?>
1144
- <tr>
1145
- <td class="key">
1146
- <label for="title"><?php echo $labels_name[$key]; ?></label>
1147
- </td>
1148
- <td>
1149
- <input type="text" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo str_replace("*@@url@@*", '', $element_value); ?>" size="80" />
1150
- </td>
1151
- </tr>
1152
- <?php
1153
- break;
1154
- }
1155
- }
1156
- }
1157
- ?>
1158
- </table>
1159
- <input type="hidden" name="option" value="com_formmaker"/>
1160
- <input type="hidden" id="current_id" name="current_id" value="<?php echo $rows[0]->group_id; ?>" />
1161
- <input type="hidden" name="form_id" value="<?php echo $rows[0]->form_id; ?>" />
1162
- <input type="hidden" name="date" value="<?php echo $rows[0]->date; ?>" />
1163
- <input type="hidden" name="ip" value="<?php echo $rows[0]->ip; ?>" />
1164
- <input type="hidden" id="task" name="task" value="" />
1165
- <input type="hidden" value="<?php echo WD_FMC_URL; ?>" id="form_plugins_url" />
1166
- <script>
1167
- plugin_url = document.getElementById('form_plugins_url').value;
1168
- </script>
1169
- </form>
1170
- <?php
1171
- }
1172
-
1173
- public function new_edit($id) {
1174
- $current_id = ((isset($id)) ? $id : 0);
1175
- $params = $this->model->get_data_of_group_id($current_id);
1176
- $rows = $params[0];
1177
- $labels_id = $params[1];
1178
- $labels_name = $params[2];
1179
- $labels_type = $params[3];
1180
- $ispaypal = $params[4];
1181
- $form = $params[5];
1182
- $form_theme = $params[6];
1183
- $userinfo = get_userdata($rows[0]->user_id_wd);
1184
- $username = $userinfo ? $userinfo->display_name : "";
1185
- $useremail = $userinfo ? $userinfo->user_email : "";
1186
- ?>
1187
- <div class="fm-user-manual">
1188
- This section allows you to edit form submissions.
1189
- <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-6.html">Read More in User Manual</a>
1190
- </div>
1191
- <div class="fm-upgrade-pro">
1192
- <a target="_blank" href="https://web-dorado.com/files/fromContactForm.php">
1193
- <div class="fm-upgrade-img">
1194
- UPGRADE TO PRO VERSION
1195
- <span></span>
1196
- </div>
1197
- </a>
1198
- </div>
1199
- <div class="fm-clear"></div>
1200
- <form action="admin.php?page=submissions_fmc" method="post" id="formform_id_temp" name="formform_id_temp">
1201
- <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
1202
- <div class="fm-page-header">
1203
- <div class="fm-page-title">Edit Submission</div>
1204
- <div class="fm-page-actions">
1205
- <button class="fm-button save-button small" onclick="pressbutton(); fm_set_input_value('task', 'save'); fm_set_input_value('current_id', <?php echo $current_id ;?>); fm_form_submit(event, 'formform_id_temp');">
1206
- <span></span>
1207
- Save
1208
- </button>
1209
- <button class="fm-button apply-button small" onclick="pressbutton(); fm_set_input_value('task', 'apply'); fm_set_input_value('current_id', <?php echo $current_id ;?>); fm_form_submit(event, 'formform_id_temp');">
1210
- <span></span>
1211
- Apply
1212
- </button>
1213
- <button class="fm-button cancel-button small" onclick="fm_set_input_value('task', '');fm_form_submit(event, 'formform_id_temp');">
1214
- <span></span>
1215
- Cancel
1216
- </button>
1217
- </div>
1218
- <div class="fm-clear"></div>
1219
- </div>
1220
- <div class="fm-submissins-edit">
1221
- <table>
1222
- <tr>
1223
- <td class="fm-key"><label for="ID">ID: </label></td>
1224
- <td><?php echo $rows[0]->group_id; ?></td>
1225
- </tr>
1226
- <tr>
1227
- <td class="fm-key"><label for="Date">Date: </label></td>
1228
- <td><?php echo $rows[0]->date; ?></td>
1229
- </tr>
1230
- <tr>
1231
- <td class="fm-key"><label for="IP">IP: </label></td>
1232
- <td><?php echo $rows[0]->ip; ?></td>
1233
- </tr>
1234
- <tr>
1235
- <td class="fm-key"><label for="Submitter's Username">Submitter's Username: </label></td>
1236
- <td><?php echo $username; ?></td>
1237
- </tr>
1238
- <tr>
1239
- <td class="fm-key"><label for="Submitter's Email Address">Submitter's Email Address: </label></td>
1240
- <td><?php echo $useremail; ?></td>
1241
- </tr>
1242
- </table>
1243
- <?php
1244
- $css_rep1 = array("[SITE_ROOT]");
1245
- $css_rep2 = array(WD_FMC_URL);
1246
- $order = array("\r\n", "\n", "\r");
1247
- $form_theme = str_replace($order, '', $form_theme);
1248
- $form_theme = str_replace($css_rep1, $css_rep2, $form_theme);
1249
- $form_theme = "#form" . $form->id . ' ' . $form_theme;
1250
- ?>
1251
- <style>
1252
- <?php
1253
- echo $form_theme;
1254
- ?>
1255
- .wdform-page-and-images{
1256
- width: 50%;
1257
- }
1258
- .wdform-page-and-images div {
1259
- background-color: rgba(0, 0, 0, 0);
1260
- }
1261
- </style>
1262
- <?php
1263
- $form_currency = '$';
1264
- $check_js = '';
1265
- $onload_js = '';
1266
- $onsubmit_js = '';
1267
- $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
1268
- $currency_sign = array('$' , '€' , '£' , '¥' , 'C$', 'Mex$', 'HK$', 'Ft' , 'kr' , 'NZ$', 'S$' , 'kr' , 'zl' , 'A$' , 'kr' , 'CHF' , 'Kc', '?' , 'R$' , 'NT$', 'RM' , '?' , '?' );
1269
- $is_type = array();
1270
- $id1s = array();
1271
- $types = array();
1272
- $labels = array();
1273
- $paramss = array();
1274
- $fields = explode('*:*new_field*:*', $form->form_fields);
1275
- $fields = array_slice($fields, 0, count($fields) - 1);
1276
- foreach ($fields as $field) {
1277
- $temp = explode('*:*id*:*',$field);
1278
- array_push($id1s, $temp[0]);
1279
- $temp = explode('*:*type*:*', $temp[1]);
1280
- array_push($types, $temp[0]);
1281
- $temp = explode('*:*w_field_label*:*', $temp[1]);
1282
- array_push($labels, $temp[0]);
1283
- array_push($paramss, $temp[1]);
1284
- }
1285
- $form = $form->form_front;
1286
- $form_id = 'form_id_temp';
1287
- $start = 0;
1288
- foreach ($id1s as $id1s_key => $id1) {
1289
- $label = $labels[$id1s_key];
1290
- $type = $types[$id1s_key];
1291
- $params = $paramss[$id1s_key];
1292
- if ($type != 'type_address') {
1293
- foreach ($rows as $row) {
1294
- if ($row->element_label == $id1) {
1295
- $element_value = $row->element_value;
1296
- break;
1297
- }
1298
- else {
1299
- $element_value = '';
1300
- }
1301
- }
1302
- }
1303
- else {
1304
- for ($i = 0; $i < 6; $i++) {
1305
- $address_value = '';
1306
- foreach ($rows as $row) {
1307
- if ($row->element_label == (string)((int) $id1 + $i)) {
1308
- $address_value = $row->element_value;
1309
- }
1310
- }
1311
- $elements_of_address[$i] = $address_value;
1312
- }
1313
- }
1314
- if (strpos($form, '%' . $id1 . ' - ' . $label . '%')) {
1315
- $rep = '';
1316
- $param = array();
1317
- $param['attributes'] = '';
1318
- $is_type[$type] = TRUE;
1319
- switch ($type) {
1320
- case 'type_section_break':
1321
- case 'type_editor':
1322
- case 'type_file_upload':
1323
- case 'type_captcha':
1324
- case 'type_recaptcha':
1325
- case 'type_mark_map':
1326
- case 'type_map':
1327
- case 'type_submit_reset':
1328
- case 'type_button':
1329
- case 'type_paypal_total':
1330
- break;
1331
-
1332
- case 'type_text': {
1333
- $params_names = array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique');
1334
- $temp = $params;
1335
- foreach ($params_names as $params_name ) {
1336
- $temp = explode('*:*'.$params_name.'*:*', $temp);
1337
- $param[$params_name] = $temp[0];
1338
- $temp = $temp[1];
1339
- }
1340
- if ($temp) {
1341
- $temp = explode('*:*w_attr_name*:*', $temp);
1342
- $attrs = array_slice($temp, 0, count($temp) - 1);
1343
- foreach ($attrs as $attr) {
1344
- $param['attributes'] = $param['attributes'].' '.$attr;
1345
- }
1346
- }
1347
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size']+$param['w_size'] : max($param['w_field_label_size'],$param['w_size']));
1348
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "display:block;");
1349
- $rep ='<div type="type_text" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1350
- $rep.='</div><div class="wdform-element-section" style="width: '.$param['w_size'].'px;" ><input type="text" class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1351
- break;
1352
- }
1353
-
1354
- case 'type_number': {
1355
- $params_names = array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique','w_class');
1356
- $temp = $params;
1357
- foreach ($params_names as $params_name ) {
1358
- $temp = explode('*:*'.$params_name.'*:*', $temp);
1359
- $param[$params_name] = $temp[0];
1360
- $temp = $temp[1];
1361
- }
1362
- if ($temp) {
1363
- $temp =explode('*:*w_attr_name*:*',$temp);
1364
- $attrs = array_slice($temp,0, count($temp)-1);
1365
- foreach($attrs as $attr)
1366
- $param['attributes'] = $param['attributes'].' '.$attr;
1367
- }
1368
-
1369
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size'] : max($param['w_field_label_size'],$param['w_size']));
1370
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1371
-
1372
- $rep ='<div type="type_number" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" class="'.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1373
-
1374
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><input type="text" class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1375
-
1376
- break;
1377
- }
1378
-
1379
- case 'type_password': {
1380
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_required','w_unique','w_class');
1381
- $temp=$params;
1382
-
1383
- foreach($params_names as $params_name ) {
1384
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1385
- $param[$params_name] = $temp[0];
1386
- $temp=$temp[1];
1387
- }
1388
-
1389
- if($temp) {
1390
- $temp =explode('*:*w_attr_name*:*',$temp);
1391
- $attrs = array_slice($temp,0, count($temp)-1);
1392
- foreach($attrs as $attr)
1393
- $param['attributes'] = $param['attributes'].' '.$attr;
1394
- }
1395
-
1396
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size'] : max($param['w_field_label_size'],$param['w_size']));
1397
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1398
-
1399
-
1400
- $rep ='<div type="type_password" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" class="'.$param['w_class'].'" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1401
-
1402
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><input type="password" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1403
-
1404
-
1405
- break;
1406
- }
1407
-
1408
- case 'type_textarea': {
1409
- $params_names=array('w_field_label_size','w_field_label_pos','w_size_w','w_size_h','w_first_val','w_title','w_required','w_unique','w_class');
1410
- $temp=$params;
1411
-
1412
- foreach($params_names as $params_name ) {
1413
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1414
- $param[$params_name] = $temp[0];
1415
- $temp=$temp[1];
1416
- }
1417
-
1418
-
1419
- if($temp) {
1420
- $temp =explode('*:*w_attr_name*:*',$temp);
1421
- $attrs = array_slice($temp,0, count($temp)-1);
1422
- foreach($attrs as $attr)
1423
- $param['attributes'] = $param['attributes'].' '.$attr;
1424
- }
1425
-
1426
-
1427
-
1428
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size_w'] : max($param['w_field_label_size'],$param['w_size_w']));
1429
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1430
-
1431
-
1432
- $rep ='<div type="type_textarea" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1433
-
1434
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size_w'].'px"><textarea class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" title="'.$param['w_title'].'" style="width: 100%; height: '.$param['w_size_h'].'px;" '.$param['attributes'].'>'.$element_value.'</textarea></div></div>';
1435
-
1436
-
1437
-
1438
- break;
1439
- }
1440
-
1441
- case 'type_wdeditor': {
1442
- $params_names=array('w_field_label_size','w_field_label_pos','w_size_w','w_size_h','w_title','w_required','w_class');
1443
- $temp=$params;
1444
-
1445
- foreach($params_names as $params_name ) {
1446
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1447
- $param[$params_name] = $temp[0];
1448
- $temp=$temp[1];
1449
- }
1450
-
1451
- if($temp) {
1452
- $temp =explode('*:*w_attr_name*:*',$temp);
1453
- $attrs = array_slice($temp,0, count($temp)-1);
1454
- foreach($attrs as $attr)
1455
- $param['attributes'] = $param['attributes'].' '.$attr;
1456
- }
1457
-
1458
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size_w']+10 : max($param['w_field_label_size'],$param['w_size_w']));
1459
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1460
-
1461
- $rep ='<div type="type_wdeditor" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1462
-
1463
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size_w'].'px">';
1464
-
1465
- if(user_can_richedit()) {
1466
- ob_start();
1467
- wp_editor($element_value, 'wdform_'.$id1.'_wd_editor'.$form_id, array('teeny' => FALSE, 'media_buttons' => FALSE, 'textarea_rows' => 5));
1468
- $wd_editor = ob_get_clean();
1469
- }
1470
- else {
1471
- $wd_editor='
1472
- <textarea class="'.$param['w_class'].'" name="wdform_'.$id1.'_wd_editor'.$form_id.'" id="wdform_'.$id1.'_wd_editor'.$form_id.'" style="width: '.$param['w_size_w'].'px; height: '.$param['w_size_h'].'px; " class="mce_editable" aria-hidden="true">'.$element_value.'</textarea>';
1473
- }
1474
-
1475
- $rep.= $wd_editor.'</div></div>';
1476
-
1477
- break;
1478
- }
1479
-
1480
- case 'type_phone': {
1481
-
1482
- if($element_value=='')
1483
- $element_value = ' ';
1484
-
1485
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_mini_labels','w_required','w_unique', 'w_class');
1486
- $temp=$params;
1487
-
1488
- foreach($params_names as $params_name ) {
1489
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1490
- $param[$params_name] = $temp[0];
1491
- $temp=$temp[1];
1492
- }
1493
-
1494
- if($temp) {
1495
- $temp =explode('*:*w_attr_name*:*',$temp);
1496
- $attrs = array_slice($temp,0, count($temp)-1);
1497
- foreach($attrs as $attr)
1498
- $param['attributes'] = $param['attributes'].' '.$attr;
1499
- }
1500
-
1501
- $element_value = explode(' ',$element_value);
1502
-
1503
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']+65) : max($param['w_field_label_size'],($param['w_size']+65)));
1504
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1505
-
1506
- $w_mini_labels = explode('***',$param['w_mini_labels']);
1507
-
1508
- $rep ='<div type="type_phone" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label" >'.$label.'</span>';
1509
-
1510
- $rep.='
1511
- </div>
1512
- <div class="wdform-element-section '.$param['w_class'].'" style="width: '.($param['w_size']+65).'px;">
1513
- <div style="display: table-cell;vertical-align: middle;">
1514
- <div><input type="text" class="" id="wdform_'.$id1.'_element_first'.$form_id.'" name="wdform_'.$id1.'_element_first'.$form_id.'" value="'.$element_value[0].'" style="width: 50px;" '.$param['attributes'].'></div>
1515
- <div><label class="mini_label">'.$w_mini_labels[0].'</label></div>
1516
- </div>
1517
- <div style="display: table-cell;vertical-align: middle;">
1518
- <div class="wdform_line" style="margin: 0px 4px 10px 4px; padding: 0px;">-</div>
1519
- </div>
1520
- <div style="display: table-cell;vertical-align: middle; width:100%;">
1521
- <div><input type="text" class="" id="wdform_'.$id1.'_element_last'.$form_id.'" name="wdform_'.$id1.'_element_last'.$form_id.'" value="'.$element_value[1].'" style="width: 100%;" '.$param['attributes'].'></div>
1522
- <div><label class="mini_label">'.$w_mini_labels[1].'</label></div>
1523
- </div>
1524
- </div>
1525
- </div>';
1526
-
1527
- break;
1528
- }
1529
-
1530
- case 'type_name': {
1531
-
1532
- if($element_value =='')
1533
- $element_value = '@@@';
1534
-
1535
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
1536
- $temp = $params;
1537
- if(strpos($temp, 'w_name_fields') > -1)
1538
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields');
1539
-
1540
- foreach($params_names as $params_name ) {
1541
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1542
- $param[$params_name] = $temp[0];
1543
- $temp=$temp[1];
1544
- }
1545
-
1546
-
1547
- if($temp) {
1548
- $temp = explode('*:*w_attr_name*:*',$temp);
1549
- $attrs = array_slice($temp,0, count($temp)-1);
1550
- foreach($attrs as $attr)
1551
- $param['attributes'] = $param['attributes'].' '.$attr;
1552
- }
1553
-
1554
- $w_mini_labels = explode('***',$param['w_mini_labels']);
1555
- $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
1556
- $w_name_fields = explode('***', $param['w_name_fields']);
1557
- $element_value = explode('@@@', $element_value);
1558
-
1559
- if($w_name_fields[0]== 'no' && $w_name_fields[1]== 'no' ) {
1560
- $w_name_format = '
1561
- <div style="display: table-cell; width:50%">
1562
- <div><input type="text" class="" id="wdform_'.$id1.'_element_first'.$form_id.'" name="wdform_'.$id1.'_element_first'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[0] : $element_value[1]).'" style="width: 100%;"'.$param['attributes'].'></div>
1563
- <div><label class="mini_label">'.$w_mini_labels[1].'</label></div>
1564
- </div>
1565
- <div style="display:table-cell;"><div style="margin: 0px 8px; padding: 0px;"></div></div>
1566
- <div style="display: table-cell; width:50%">
1567
- <div><input type="text" class="" id="wdform_'.$id1.'_element_last'.$form_id.'" name="wdform_'.$id1.'_element_last'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[1] : $element_value[2]).'" style="width: 100%;" '.$param['attributes'].'></div>
1568
- <div><label class="mini_label">'.$w_mini_labels[2].'</label></div>
1569
- </div>
1570
- ';
1571
- $w_size=2*$param['w_size'];
1572
- }
1573
- else {
1574
- $first_last_size = $w_name_fields[0] == 'yes' && $w_name_fields[1] == 'no' ? 45 : 30;
1575
- $w_name_format = '
1576
- <div style="display: table-cell; width:30%">
1577
- <div><input type="text" class="" id="wdform_'.$id1.'_element_first'.$form_id.'" name="wdform_'.$id1.'_element_first'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[0] : $element_value[1]).'" style="width:100%;"></div>
1578
- <div><label class="mini_label">'.$w_mini_labels[1].'</label></div>
1579
- </div>
1580
- <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1581
- <div style="display: table-cell; width:30%">
1582
- <div><input type="text" class="" id="wdform_'.$id1.'_element_last'.$form_id.'" name="wdform_'.$id1.'_element_last'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[1] : $element_value[2]).'" style="width: 100%;"></div>
1583
- <div><label class="mini_label">'.$w_mini_labels[2].'</label></div>
1584
- </div>';
1585
- $w_size = 2*$param['w_size'];
1586
-
1587
- if($w_name_fields[0] == 'yes') {
1588
- $w_name_format = '
1589
- <div style="display: table-cell;">
1590
- <div><input type="text" class="" id="wdform_'.$id1.'_element_title'.$form_id.'" name="wdform_'.$id1.'_element_title'.$form_id.'" value="'.(count($element_value)==2 ? "" : $element_value[0]).'" style="width: 40px;"></div>
1591
- <div><label class="mini_label">'.$w_mini_labels[0].'</label></div>
1592
- </div>
1593
- <div style="display:table-cell;"><div style="margin: 0px 1px; padding: 0px;"></div></div>'.$w_name_format;
1594
- $w_size += 80;
1595
- }
1596
- if($w_name_fields[1] == 'yes') {
1597
- $w_name_format = $w_name_format.'
1598
- <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1599
- <div style="display: table-cell; width:30%">
1600
- <div><input type="text" class="" id="wdform_'.$id1.'_element_middle'.$form_id.'" name="wdform_'.$id1.'_element_middle'.$form_id.'" value="'.(count($element_value)==2 ? "" : $element_value[3]).'"style="width: 100%;"></div>
1601
- <div><label class="mini_label">'.$w_mini_labels[3].'</label></div>
1602
- </div>
1603
- ';
1604
- $w_size += $param['w_size'];
1605
- }
1606
- }
1607
-
1608
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$w_size) : max($param['w_field_label_size'],$w_size));
1609
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1610
-
1611
- $rep ='<div type="type_name" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1612
-
1613
- $rep.='</div>
1614
- <div class="wdform-element-section '.$param['w_class'].'" style="width: '.$w_size.'px;">'.$w_name_format.'</div></div>';
1615
-
1616
- break;
1617
- }
1618
-
1619
- case 'type_address': {
1620
- $params_names = array('w_field_label_size','w_field_label_pos','w_size','w_mini_labels','w_disabled_fields','w_required','w_class');
1621
- $temp = $params;
1622
- foreach($params_names as $params_name ) {
1623
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1624
- $param[$params_name] = $temp[0];
1625
- $temp=$temp[1];
1626
- }
1627
-
1628
- if($temp) {
1629
- $temp =explode('*:*w_attr_name*:*',$temp);
1630
- $attrs = array_slice($temp,0, count($temp)-1);
1631
- foreach($attrs as $attr)
1632
- $param['attributes'] = $param['attributes'].' '.$attr;
1633
- }
1634
-
1635
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1636
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1637
-
1638
- $w_mini_labels = explode('***',$param['w_mini_labels']);
1639
- $w_disabled_fields = explode('***',$param['w_disabled_fields']);
1640
-
1641
- $rep ='<div type="type_address" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1642
-
1643
- $address_fields ='';
1644
- $g=0;
1645
- if (isset($w_disabled_fields[0]) && $w_disabled_fields[0]=='no') {
1646
- $g+=2;
1647
- $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_'.$id1.'_street1'.$form_id.'" name="wdform_'.$id1.'_street1'.$form_id.'" value="'.$elements_of_address[0].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label" >'.$w_mini_labels[0].'</label></span>';
1648
- }
1649
- if (isset($w_disabled_fields[1]) && $w_disabled_fields[1]=='no') {
1650
- $g+=2;
1651
- $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_'.$id1.'_street2'.$form_id.'" name="wdform_'.($id1+1).'_street2'.$form_id.'" value="'.$elements_of_address[1].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label" >'.$w_mini_labels[1].'</label></span>';
1652
- }
1653
- if (isset($w_disabled_fields[2]) && $w_disabled_fields[2]=='no') {
1654
- $g++;
1655
- $address_fields .= '<span style="float: left; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_'.$id1.'_city'.$form_id.'" name="wdform_'.($id1+2).'_city'.$form_id.'" value="'.$elements_of_address[2].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label" >'.$w_mini_labels[2].'</label></span>';
1656
- }
1657
- if (isset($w_disabled_fields[3]) && $w_disabled_fields[3]=='no') {
1658
- $g++;
1659
- $w_states = array("","Alabama","Alaska", "Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
1660
- $w_state_options = '';
1661
- foreach($w_states as $w_state) {
1662
- if($w_state == $elements_of_address[3])
1663
- $selected = 'selected=\"selected\"';
1664
- else
1665
- $selected = '';
1666
- $w_state_options .= '<option value="'.$w_state.'" '.$selected.'>'.$w_state.'</option>';
1667
- }
1668
- if(isset($w_disabled_fields[5]) && $w_disabled_fields[5]=='yes' && isset($w_disabled_fields[6]) && $w_disabled_fields[6]=='yes') {
1669
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><select type="text" id="wdform_'.$id1.'_state'.$form_id.'" name="wdform_'.($id1+3).'_state'.$form_id.'" style="width: 100%;" '.$param['attributes'].'>'.$w_state_options.'</select><label class="mini_label" style="display: block;" id="'.$id1.'_mini_label_state">'.$w_mini_labels[3].'</label></span>';
1670
- }
1671
- else
1672
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_'.$id1.'_state'.$form_id.'" name="wdform_'.($id1+3).'_state'.$form_id.'" value="'.$elements_of_address[3].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label">'.$w_mini_labels[3].'</label></span>';
1673
- }
1674
- if (isset($w_disabled_fields[4]) && $w_disabled_fields[4]=='no') {
1675
- $g++;
1676
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_'.$id1.'_postal'.$form_id.'" name="wdform_'.($id1+4).'_postal'.$form_id.'" value="'.$elements_of_address[4].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label">'.$w_mini_labels[4].'</label></span>';
1677
- }
1678
- $w_countries = array("","Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo (Brazzaville)","Congo","Costa Rica","Cote d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor (Timor Timur)","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia, The","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea, North","Korea, South","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and Montenegro","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe");
1679
- $w_options = '';
1680
- foreach($w_countries as $w_country) {
1681
- if($w_country == $elements_of_address[5])
1682
- $selected = 'selected="selected"';
1683
- else
1684
- $selected = '';
1685
- $w_options .= '<option value="'.$w_country.'" '.$selected.'>'.$w_country.'</option>';
1686
- }
1687
-
1688
- if (isset($w_disabled_fields[5]) && $w_disabled_fields[5]=='no') {
1689
- $g++;
1690
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;display: inline-block;"><select type="text" id="wdform_'.$id1.'_country'.$form_id.'" name="wdform_'.($id1+5).'_country'.$form_id.'" style="width:100%" '.$param['attributes'].'>'.$w_options.'</select><label class="mini_label">'.$w_mini_labels[5].'</span>';
1691
- }
1692
-
1693
-
1694
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><div>
1695
- '.$address_fields.'</div></div></div>';
1696
- break;
1697
- }
1698
-
1699
- case 'type_submitter_mail': {
1700
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique', 'w_class');
1701
- $temp=$params;
1702
-
1703
- foreach($params_names as $params_name ) {
1704
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1705
- $param[$params_name] = $temp[0];
1706
- $temp=$temp[1];
1707
- }
1708
-
1709
-
1710
- if($temp) {
1711
- $temp =explode('*:*w_attr_name*:*',$temp);
1712
- $attrs = array_slice($temp,0, count($temp)-1);
1713
- foreach($attrs as $attr)
1714
- $param['attributes'] = $param['attributes'].' '.$attr;
1715
- }
1716
-
1717
-
1718
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1719
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1720
-
1721
- $rep ='<div type="type_submitter_mail" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1722
-
1723
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><input type="text" class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" title="'.$param['w_title'].'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1724
-
1725
-
1726
-
1727
- break;
1728
- }
1729
-
1730
- case 'type_checkbox':
1731
-
1732
- {
1733
-
1734
-
1735
-
1736
- $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num','w_class');
1737
-
1738
- $temp=$params;
1739
-
1740
- if(strpos($temp, 'w_field_option_pos') > -1)
1741
-
1742
- $params_names=array('w_field_label_size','w_field_label_pos','w_field_option_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num', 'w_value_disabled','w_choices_value', 'w_choices_params', 'w_class');
1743
-
1744
-
1745
-
1746
- foreach($params_names as $params_name )
1747
-
1748
- {
1749
-
1750
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1751
-
1752
- $param[$params_name] = $temp[0];
1753
-
1754
- $temp=$temp[1];
1755
-
1756
- }
1757
-
1758
-
1759
-
1760
- if($temp)
1761
-
1762
- {
1763
-
1764
- $temp =explode('*:*w_attr_name*:*',$temp);
1765
-
1766
- $attrs = array_slice($temp,0, count($temp)-1);
1767
-
1768
- foreach($attrs as $attr)
1769
-
1770
- $param['attributes'] = $param['attributes'].' '.$attr;
1771
-
1772
- }
1773
-
1774
-
1775
-
1776
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1777
-
1778
- if(!isset($param['w_value_disabled']))
1779
-
1780
- $param['w_value_disabled'] = 'no';
1781
-
1782
-
1783
-
1784
- if(!isset($param['w_field_option_pos']))
1785
-
1786
- $param['w_field_option_pos'] = 'left';
1787
-
1788
-
1789
-
1790
- $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
1791
-
1792
- $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
1793
-
1794
-
1795
-
1796
- $param['w_choices'] = explode('***',$param['w_choices']);
1797
-
1798
- if(isset($param['w_choices_value']))
1799
-
1800
- {
1801
-
1802
- $param['w_choices_value'] = explode('***',$param['w_choices_value']);
1803
-
1804
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1805
-
1806
- }
1807
-
1808
-
1809
-
1810
- $element_value = explode('***br***',$element_value);
1811
-
1812
- $element_value = array_slice($element_value,0, count($element_value)-1);
1813
-
1814
- $is_other=false;
1815
-
1816
- $other_value = '';
1817
-
1818
-
1819
-
1820
- foreach($element_value as $key => $value)
1821
-
1822
- {
1823
-
1824
- if(!in_array($value, ($param['w_value_disabled']=='no' ? $param['w_choices'] : (isset($param['w_choices_value']) ? $param['w_choices_value'] : array()))))
1825
-
1826
- {
1827
-
1828
- $other_value = $value;
1829
-
1830
- $is_other=true;
1831
-
1832
- break;
1833
-
1834
- }
1835
-
1836
- }
1837
-
1838
-
1839
-
1840
- $rep='<div type="type_checkbox" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1841
-
1842
-
1843
-
1844
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
1845
-
1846
-
1847
-
1848
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
1849
-
1850
- $total_queries = 0;
1851
-
1852
- foreach($param['w_choices'] as $key => $choice)
1853
-
1854
- {
1855
-
1856
- $key1 = $key + $total_queries;
1857
-
1858
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1859
-
1860
- {
1861
-
1862
- $choices_labels =array();
1863
- $choices_values = array();
1864
-
1865
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1866
- $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
1867
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1868
-
1869
- $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
1870
- $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
1871
-
1872
-
1873
-
1874
- $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
1875
-
1876
- $table = $label_table_and_column[0];
1877
-
1878
- $label_column = $label_table_and_column[1];
1879
-
1880
- if($label_column)
1881
-
1882
- {
1883
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1884
-
1885
- }
1886
-
1887
-
1888
-
1889
- $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_value'][$key]));
1890
-
1891
- $value_column = $value_table_and_column[1];
1892
-
1893
-
1894
-
1895
- if($value_column)
1896
-
1897
- {
1898
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1899
-
1900
- }
1901
-
1902
- $columns_count_checkbox = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
1903
-
1904
-
1905
-
1906
- if(array_filter($choices_labels) || array_filter($choices_values))
1907
-
1908
- {
1909
-
1910
- $total_queries = $total_queries + $columns_count_checkbox-1;
1911
-
1912
-
1913
-
1914
- if(!isset($post_value))
1915
-
1916
- $param['w_choices_checked'][$key]=($param['w_choices_checked'][$key]=='true' ? 'checked="checked"' : '');
1917
-
1918
-
1919
-
1920
- for($k=0; $k<$columns_count_checkbox; $k++)
1921
-
1922
- {
1923
-
1924
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1925
-
1926
- $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
1927
-
1928
- if(($key1+$k)%$param['w_rowcol']==0 && ($key1+$k)>0)
1929
-
1930
- $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
1931
-
1932
-
1933
-
1934
- $checked=(in_array($choice_value, $element_value) ? 'checked="checked"' : '');
1935
-
1936
-
1937
-
1938
- $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" '.$param['w_field_option_pos1'].'>'.$choice_label.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" value="'.htmlspecialchars($choice_value).'" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'onclick="if(set_checked(&quot;wdform_'.$id1.'&quot;,&quot;'.($key1+$k).'&quot;,&quot;'.$form_id.'&quot;)) show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);"' : '').' '.$param['attributes'].' '.$checked.'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
1939
-
1940
-
1941
-
1942
- }
1943
-
1944
- }
1945
-
1946
- }
1947
-
1948
- else
1949
-
1950
- {
1951
-
1952
- if($key1%$param['w_rowcol']==0 && $key1>0)
1953
-
1954
- $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
1955
-
1956
-
1957
-
1958
- $checked=(in_array($choice, $element_value) ? 'checked="checked"' : '');
1959
-
1960
-
1961
-
1962
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key && $is_other)
1963
-
1964
- $checked = 'checked="checked"';
1965
-
1966
-
1967
-
1968
-
1969
-
1970
- $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'" '.$param['w_field_option_pos1'].'>'.$choice.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.''.$key1.'" value="'.htmlspecialchars($choice).'" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'onclick="if(set_checked(&quot;wdform_'.$id1.'&quot;,&quot;'.$key1.'&quot;,&quot;'.$form_id.'&quot;)) show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);"' : '').' '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
1971
-
1972
-
1973
-
1974
- $param['w_allow_other_num'] = $param['w_allow_other_num']==$key ? $key1 : $param['w_allow_other_num'];
1975
-
1976
- }
1977
-
1978
- }
1979
-
1980
- $rep.='</div>';
1981
-
1982
-
1983
-
1984
- $rep.='</div></div>';
1985
-
1986
-
1987
-
1988
-
1989
-
1990
- if($is_other)
1991
-
1992
- $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.$other_value.'");';
1993
-
1994
-
1995
-
1996
- $onsubmit_js.='
1997
-
1998
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#adminForm");
1999
-
2000
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#adminForm");
2001
-
2002
- ';
2003
-
2004
-
2005
-
2006
- break;
2007
-
2008
- }
2009
-
2010
- case 'type_radio':
2011
-
2012
- {
2013
-
2014
-
2015
-
2016
-
2017
-
2018
- $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num','w_class');
2019
-
2020
- $temp=$params;
2021
-
2022
- if(strpos($temp, 'w_field_option_pos') > -1)
2023
-
2024
- $params_names=array('w_field_label_size','w_field_label_pos','w_field_option_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num','w_value_disabled','w_choices_value', 'w_choices_params','w_class');
2025
-
2026
-
2027
-
2028
- foreach($params_names as $params_name )
2029
-
2030
- {
2031
-
2032
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2033
-
2034
- $param[$params_name] = $temp[0];
2035
-
2036
- $temp=$temp[1];
2037
-
2038
- }
2039
-
2040
-
2041
-
2042
- if($temp)
2043
-
2044
- {
2045
-
2046
- $temp =explode('*:*w_attr_name*:*',$temp);
2047
-
2048
- $attrs = array_slice($temp,0, count($temp)-1);
2049
-
2050
- foreach($attrs as $attr)
2051
-
2052
- $param['attributes'] = $param['attributes'].' '.$attr;
2053
-
2054
- }
2055
-
2056
- if(!isset($param['w_value_disabled']))
2057
-
2058
- $param['w_value_disabled'] = 'no';
2059
-
2060
-
2061
-
2062
- if(!isset($param['w_field_option_pos']))
2063
-
2064
- $param['w_field_option_pos'] = 'left';
2065
-
2066
-
2067
-
2068
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2069
-
2070
- $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
2071
-
2072
- $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
2073
-
2074
-
2075
-
2076
- $param['w_choices'] = explode('***',$param['w_choices']);
2077
-
2078
- if(isset($param['w_choices_value']))
2079
-
2080
- {
2081
-
2082
- $param['w_choices_value'] = explode('***',$param['w_choices_value']);
2083
-
2084
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2085
-
2086
- }
2087
-
2088
-
2089
-
2090
- $is_other=true;
2091
-
2092
-
2093
-
2094
- foreach($param['w_choices'] as $key => $choice)
2095
-
2096
- {
2097
-
2098
- $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
2099
-
2100
- if($choice_value==$element_value)
2101
-
2102
- {
2103
-
2104
- $is_other=false;
2105
-
2106
- break;
2107
-
2108
- }
2109
-
2110
- }
2111
-
2112
-
2113
-
2114
- $rep='<div type="type_radio" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2115
-
2116
-
2117
-
2118
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
2119
-
2120
-
2121
-
2122
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
2123
-
2124
- $total_queries =0;
2125
-
2126
- foreach($param['w_choices'] as $key => $choice)
2127
-
2128
- {
2129
-
2130
- $key1 = $key + $total_queries;
2131
-
2132
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2133
-
2134
- {
2135
-
2136
- $choices_labels =array();
2137
- $choices_values =array();
2138
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2139
- $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
2140
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2141
- $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
2142
- $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
2143
-
2144
- $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
2145
-
2146
- $table = $label_table_and_column[0];
2147
-
2148
- $label_column = $label_table_and_column[1];
2149
-
2150
- if($label_column) {
2151
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
2152
- }
2153
-
2154
-
2155
-
2156
- $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_value'][$key]));
2157
-
2158
- $value_column = $value_table_and_column[1];
2159
-
2160
-
2161
-
2162
- if($value_column) {
2163
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
2164
- }
2165
-
2166
-
2167
-
2168
- $columns_count_radio = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
2169
-
2170
- if(array_filter($choices_labels) || array_filter($choices_values))
2171
-
2172
- {
2173
-
2174
- $total_queries = $total_queries + $columns_count_radio-1;
2175
-
2176
-
2177
-
2178
- for($k=0; $k<$columns_count_radio; $k++)
2179
-
2180
- {
2181
-
2182
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
2183
-
2184
- $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
2185
-
2186
-
2187
-
2188
- if(($key1+$k)%$param['w_rowcol']==0 && ($key1+$k)>0)
2189
-
2190
- $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
2191
-
2192
-
2193
-
2194
- $checked =($choice_value==$element_value ? 'checked="checked"' : '');
2195
-
2196
- if($choice_value==$element_value)
2197
-
2198
- $is_other=false;
2199
-
2200
-
2201
-
2202
- $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" '.$param['w_field_option_pos1'].'>'.$choice_label.'</label><div class="radio-div forlabs" '.$param['w_field_option_pos2'].'><input type="radio" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.htmlspecialchars($choice_value).'" onclick="set_default(&quot;wdform_'.$id1.'&quot;,&quot;'.($key1+$k).'&quot;,&quot;'.$form_id.'&quot;); '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);' : '').'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
2203
-
2204
-
2205
-
2206
- }
2207
-
2208
- }
2209
-
2210
- }
2211
-
2212
- else
2213
-
2214
- {
2215
-
2216
- if($key1%$param['w_rowcol']==0 && $key1>0)
2217
-
2218
- $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
2219
-
2220
-
2221
-
2222
- $checked =($choice==$element_value ? 'checked="checked"' : '');
2223
-
2224
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key && $is_other==true && $element_value!='')
2225
-
2226
- $checked = 'checked="checked"';
2227
-
2228
- $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
2229
-
2230
-
2231
-
2232
- $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'" '.$param['w_field_option_pos1'].'>'.$choice.'</label><div class="radio-div forlabs" '.$param['w_field_option_pos2'].'><input type="radio" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.htmlspecialchars($choice_value).'" onclick="set_default(&quot;wdform_'.$id1.'&quot;,&quot;'.$key1.'&quot;,&quot;'.$form_id.'&quot;); '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);' : '').'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
2233
-
2234
-
2235
-
2236
- $param['w_allow_other_num'] = $param['w_allow_other_num']==$key ? $key1 : $param['w_allow_other_num'];
2237
-
2238
- }
2239
-
2240
- }
2241
-
2242
- $rep.='</div>';
2243
-
2244
-
2245
-
2246
- $rep.='</div></div>';
2247
-
2248
-
2249
-
2250
-
2251
-
2252
- if($is_other && $element_value!='')
2253
-
2254
- $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.$element_value.'");';
2255
-
2256
-
2257
-
2258
- $onsubmit_js.='
2259
-
2260
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#form'.$form_id.'");
2261
-
2262
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#adminForm");
2263
-
2264
- ';
2265
-
2266
-
2267
-
2268
- break;
2269
-
2270
- }
2271
-
2272
- case 'type_own_select':
2273
-
2274
- {
2275
-
2276
-
2277
-
2278
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_checked', 'w_choices_disabled','w_required','w_class');
2279
-
2280
- $temp=$params;
2281
-
2282
- if(strpos($temp, 'w_choices_value') > -1)
2283
-
2284
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_checked', 'w_choices_disabled', 'w_required', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
2285
-
2286
-
2287
-
2288
- foreach($params_names as $params_name )
2289
-
2290
- {
2291
-
2292
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2293
-
2294
- $param[$params_name] = $temp[0];
2295
-
2296
- $temp=$temp[1];
2297
-
2298
- }
2299
-
2300
-
2301
-
2302
-
2303
-
2304
- if($temp)
2305
-
2306
- {
2307
-
2308
- $temp =explode('*:*w_attr_name*:*',$temp);
2309
-
2310
- $attrs = array_slice($temp,0, count($temp)-1);
2311
-
2312
- foreach($attrs as $attr)
2313
-
2314
- $param['attributes'] = $param['attributes'].' '.$attr;
2315
-
2316
- }
2317
-
2318
-
2319
-
2320
-
2321
-
2322
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
2323
-
2324
- $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
2325
-
2326
- $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
2327
-
2328
-
2329
-
2330
- $param['w_choices'] = explode('***',$param['w_choices']);
2331
-
2332
- $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
2333
-
2334
- if(isset($param['w_choices_value']))
2335
-
2336
- {
2337
-
2338
- $param['w_choices_value'] = explode('***',$param['w_choices_value']);
2339
-
2340
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2341
-
2342
- }
2343
-
2344
-
2345
-
2346
- if(!isset($param['w_value_disabled']))
2347
-
2348
- $param['w_value_disabled'] = 'no';
2349
-
2350
-
2351
-
2352
- $rep='<div type="type_own_select" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos1'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2353
-
2354
-
2355
-
2356
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos2'].' width: '.($param['w_size']).'px; "><select id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" style="width: 100%;" '.$param['attributes'].'>';
2357
-
2358
- foreach($param['w_choices'] as $key => $choice)
2359
-
2360
- {
2361
-
2362
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2363
-
2364
- {
2365
-
2366
- $choices_labels =array();
2367
- $choices_values = array();
2368
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2369
- $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
2370
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2371
- $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
2372
- $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
2373
-
2374
-
2375
- $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
2376
-
2377
- $table = $label_table_and_column[0];
2378
-
2379
- $label_column = $label_table_and_column[1];
2380
-
2381
- if($label_column)
2382
-
2383
- {
2384
-
2385
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
2386
-
2387
- }
2388
-
2389
-
2390
-
2391
- $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_value'][$key]));
2392
-
2393
- $value_column = $param['w_choices_disabled'][$key]=="true" ? '' : $value_table_and_column[1];
2394
-
2395
-
2396
-
2397
- if($value_column)
2398
-
2399
- {
2400
-
2401
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
2402
-
2403
- }
2404
-
2405
-
2406
-
2407
- $columns_count = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
2408
-
2409
- if(array_filter($choices_labels) || array_filter($choices_values))
2410
-
2411
- for($k=0; $k<$columns_count; $k++)
2412
-
2413
- {
2414
-
2415
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
2416
-
2417
- $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : ($param['w_choices_disabled'][$key]=="true" ? '' : $choice_label);
2418
-
2419
-
2420
-
2421
- $selected=($element_value && htmlspecialchars($choice_value)==htmlspecialchars($element_value) ? 'selected="selected"' : '');
2422
-
2423
-
2424
-
2425
- $rep.='<option value="'.htmlspecialchars($choice_value).'" '.$selected.'>'.$choice_label.'</option>';
2426
-
2427
-
2428
-
2429
- }
2430
-
2431
- }
2432
-
2433
- else
2434
-
2435
- {
2436
-
2437
- $choice_value = $param['w_choices_disabled'][$key]=="true" ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
2438
-
2439
-
2440
-
2441
- $selected=($element_value && htmlspecialchars($choice_value)==htmlspecialchars($element_value) ? 'selected="selected"' : '');
2442
-
2443
-
2444
-
2445
- $rep.='<option value="'.htmlspecialchars($choice_value).'" '.$selected.'>'.$choice.'</option>';
2446
-
2447
- }
2448
-
2449
- }
2450
-
2451
- $rep.='</select></div></div>';
2452
-
2453
-
2454
-
2455
-
2456
-
2457
- break;
2458
-
2459
- }
2460
-
2461
- case 'type_country': {
2462
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_countries','w_required','w_class');
2463
- $temp=$params;
2464
- foreach($params_names as $params_name ) {
2465
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2466
- $param[$params_name] = $temp[0];
2467
- $temp=$temp[1];
2468
- }
2469
-
2470
- if($temp) {
2471
- $temp =explode('*:*w_attr_name*:*',$temp);
2472
- $attrs = array_slice($temp,0, count($temp)-1);
2473
- foreach($attrs as $attr)
2474
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2475
- }
2476
-
2477
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
2478
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2479
-
2480
- $param['w_countries'] = explode('***',$param['w_countries']);
2481
-
2482
- $selected='';
2483
-
2484
- $rep='<div type="type_country" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2485
-
2486
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><select id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" style="width: 100%;" '.$param['attributes'].'>';
2487
- foreach($param['w_countries'] as $key => $choice) {
2488
-
2489
- $selected=(htmlspecialchars($choice)==htmlspecialchars($element_value) ? 'selected="selected"' : '');
2490
-
2491
- $choice_value=$choice;
2492
- $rep.='<option value="'.$choice_value.'" '.$selected.'>'.$choice.'</option>';
2493
- }
2494
- $rep.='</select></div></div>';
2495
-
2496
- break;
2497
- }
2498
-
2499
- case 'type_time': {
2500
- if($element_value =='')
2501
- $element_value = ':';
2502
-
2503
- $params_names=array('w_field_label_size','w_field_label_pos','w_time_type','w_am_pm','w_sec','w_hh','w_mm','w_ss','w_mini_labels','w_required','w_class');
2504
- $temp=$params;
2505
-
2506
- foreach($params_names as $params_name ) {
2507
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2508
- $param[$params_name] = $temp[0];
2509
- $temp=$temp[1];
2510
- }
2511
-
2512
- if($temp) {
2513
- $temp =explode('*:*w_attr_name*:*',$temp);
2514
- $attrs = array_slice($temp,0, count($temp)-1);
2515
- foreach($attrs as $attr)
2516
- $param['attributes'] = $param['attributes'].' '.$attr;
2517
- }
2518
-
2519
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2520
-
2521
- $w_mini_labels = explode('***',$param['w_mini_labels']);
2522
- $element_value = explode(':',$element_value);
2523
-
2524
-
2525
- $w_sec = '';
2526
- $w_sec_label='';
2527
-
2528
- if($param['w_sec']=='1') {
2529
- $w_sec = '<div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="'.(count($element_value)==2 ? '' : $element_value[2]).'" class="time_box" id="wdform_'.$id1.'_ss'.$form_id.'" name="wdform_'.$id1.'_ss'.$form_id.'" onkeypress="return check_second(event, &quot;wdform_'.$id1.'_ss'.$form_id.'&quot;)" '.$param['attributes'].'></div>';
2530
-
2531
- $w_sec_label='<div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[2].'</label></div>';
2532
- }
2533
-
2534
-
2535
- if($param['w_time_type']=='12') {
2536
- if(strpos($element_value[2],'pm')!==false) {
2537
- $am_ = "";
2538
- $pm_ = "selected=\"selected\"";
2539
- }
2540
- else {
2541
- $am_ = "selected=\"selected\"";
2542
- $pm_ = "";
2543
- }
2544
-
2545
- $w_time_type = '<div style="display: table-cell;"><select class="am_pm_select" name="wdform_'.$id1.'_am_pm'.$form_id.'" id="wdform_'.$id1.'_am_pm'.$form_id.'" '.$param['attributes'].'><option value="am" '.$am_.'>AM</option><option value="pm" '.$pm_.'>PM</option></select></div>';
2546
-
2547
- $w_time_type_label = '<div ><label class="mini_label">'.$w_mini_labels[3].'</label></div>';
2548
-
2549
- }
2550
- else {
2551
- $w_time_type='';
2552
- $w_time_type_label = '';
2553
- }
2554
-
2555
- $rep ='<div type="type_time" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2556
-
2557
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;"><input type="text" value="'.$element_value[0].'" class="time_box" id="wdform_'.$id1.'_hh'.$form_id.'" name="wdform_'.$id1.'_hh'.$form_id.'" onkeypress="return check_hour(event, &quot;wdform_'.$id1.'_hh'.$form_id.'&quot;, &quot;23&quot;)" '.$param['attributes'].'></div><div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="'.$element_value[1].'" class="time_box" id="wdform_'.$id1.'_mm'.$form_id.'" name="wdform_'.$id1.'_mm'.$form_id.'" onkeypress="return check_minute(event, &quot;wdform_'.$id1.'_mm'.$form_id.'&quot;)" '.$param['attributes'].'></div>'.$w_sec.$w_time_type.'</div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[0].'</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[1].'</label></div>'.$w_sec_label.$w_time_type_label.'</div></div></div></div>';
2558
-
2559
- break;
2560
- }
2561
-
2562
- case 'type_date': {
2563
- $params_names=array('w_field_label_size','w_field_label_pos','w_date','w_required','w_class','w_format','w_but_val');
2564
- $temp = $params;
2565
- if(strpos($temp, 'w_disable_past_days') > -1)
2566
- $params_names = array('w_field_label_size','w_field_label_pos','w_date','w_required','w_class','w_format','w_but_val', 'w_disable_past_days');
2567
-
2568
- foreach($params_names as $params_name ) {
2569
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2570
- $param[$params_name] = $temp[0];
2571
- $temp=$temp[1];
2572
- }
2573
-
2574
- if($temp) {
2575
- $temp =explode('*:*w_attr_name*:*',$temp);
2576
- $attrs = array_slice($temp,0, count($temp)-1);
2577
- foreach($attrs as $attr)
2578
- $param['attributes'] = $param['attributes'].' '.$attr;
2579
- }
2580
-
2581
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2582
-
2583
- $rep ='<div type="type_date" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2584
-
2585
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><input type="text" value="'.$element_value.'" class="wdform-date" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" maxlength="10" '.$param['attributes'].'><input id="wdform_'.$id1.'_button'.$form_id.'" class="wdform-calendar-button" type="reset" value="'.$param['w_but_val'].'" format="'.$param['w_format'].'" onclick="return showCalendar(\'wdform_'.$id1.'_element'.$form_id.'\' , \'%Y-%m-%d\')" '.$param['attributes'].' "></div></div>';
2586
-
2587
-
2588
- // $onload_js.= 'Calendar.setup({inputField: "wdform_'.$id1.'_element'.$form_id.'", ifFormat: "'.$param['w_format'].'",button: "wdform_'.$id1.'_button'.$form_id.'",align: "Tl",singleClick: true,firstDay: 0});';
2589
-
2590
- break;
2591
- }
2592
-
2593
- case 'type_date_fields': {
2594
- if($element_value=='')
2595
- $element_value='--';
2596
-
2597
- $params_names=array('w_field_label_size','w_field_label_pos','w_day','w_month','w_year','w_day_type','w_month_type','w_year_type','w_day_label','w_month_label','w_year_label','w_day_size','w_month_size','w_year_size','w_required','w_class','w_from','w_to','w_divider');
2598
-
2599
- $temp=$params;
2600
-
2601
- foreach($params_names as $params_name ) {
2602
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2603
- $param[$params_name] = $temp[0];
2604
- $temp=$temp[1];
2605
- }
2606
-
2607
-
2608
- if($temp) {
2609
- $temp =explode('*:*w_attr_name*:*',$temp);
2610
- $attrs = array_slice($temp,0, count($temp)-1);
2611
- foreach($attrs as $attr)
2612
- $param['attributes'] = $param['attributes'].' '.$attr;
2613
- }
2614
-
2615
- $element_value = explode('-',$element_value);
2616
-
2617
- $param['w_day'] = (isset($_POST['wdform_'.$id1."_day".$form_id]) ? esc_html(stripslashes( $_POST['wdform_'.$id1."_day".$form_id])) : $param['w_day']);
2618
- $param['w_month'] = (isset($_POST['wdform_'.$id1."_month".$form_id]) ? esc_html(stripslashes( $_POST['wdform_'.$id1."_month".$form_id])) : $element_value[1]);//??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
2619
- $param['w_year'] = (isset($_POST['wdform_'.$id1."w_year".$form_id]) ? esc_html(stripslashes( $_POST['wdform_'.$id1."_year".$form_id])) : $param['w_year']);
2620
-
2621
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2622
-
2623
- if($param['w_day_type']=="SELECT") {
2624
-
2625
- $w_day_type = '<select id="wdform_'.$id1.'_day'.$form_id.'" name="wdform_'.$id1.'_day'.$form_id.'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'><option value=""></option>';
2626
-
2627
- for($k=1; $k<=31; $k++) {
2628
-
2629
- if($k<10) {
2630
- if($element_value[0]=='0'.$k)
2631
- $selected = "selected=\"selected\"";
2632
- else
2633
- $selected = "";
2634
-
2635
- $w_day_type .= '<option value="0'.$k.'" '.$selected.'>0'.$k.'</option>';
2636
- }
2637
- else {
2638
- if($element_value[0]==''.$k)
2639
- $selected = "selected=\"selected\"";
2640
- else
2641
- $selected = "";
2642
-
2643
- $w_day_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
2644
- }
2645
-
2646
- }
2647
- $w_day_type .= '</select>';
2648
-
2649
- }
2650
- else {
2651
- $w_day_type = '<input type="text" value="'.$element_value[0].'" id="wdform_'.$id1.'_day'.$form_id.'" name="wdform_'.$id1.'_day'.$form_id.'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'>';
2652
- $onload_js .='jQuery("#wdform_'.$id1.'_day'.$form_id.'").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2653
- $onload_js .='jQuery("#wdform_'.$id1.'_day'.$form_id.'").keypress(function() {return check_day(event, this)});';
2654
- }
2655
-
2656
-
2657
- if($param['w_month_type']=="SELECT") {
2658
-
2659
- $w_month_type = '<select id="wdform_'.$id1.'_month'.$form_id.'" name="wdform_'.$id1.'_month'.$form_id.'" style="width: '.$param['w_month_size'].'px;" '.$param['attributes'].'><option value=""></option><option value="01" '.($param['w_month']=="01" ? "selected=\"selected\"": "").' >'.(__("January", 'form_maker')).'</option><option value="02" '.($param['w_month']=="02" ? "selected=\"selected\"": "").'>'.(__("February", 'form_maker')).'</option><option value="03" '.($param['w_month']=="03"? "selected=\"selected\"": "").'>'.(__("March", 'form_maker')).'</option><option value="04" '.($param['w_month']=="04" ? "selected=\"selected\"": "").' >'.(__("April", 'form_maker')).'</option><option value="05" '.($param['w_month']=="05" ? "selected=\"selected\"": "").' >'.(__("May", 'form_maker')).'</option><option value="06" '.($param['w_month']=="06" ? "selected=\"selected\"": "").' >'.(__("June", 'form_maker')).'</option><option value="07" '.($param['w_month']=="07" ? "selected=\"selected\"": "").' >'.(__("July", 'form_maker')).'</option><option value="08" '.($param['w_month']=="08" ? "selected=\"selected\"": "").' >'.(__("August", 'form_maker')).'</option><option value="09" '.($param['w_month']=="09" ? "selected=\"selected\"": "").' >'.(__("September", 'form_maker')).'</option><option value="10" '.($param['w_month']=="10" ? "selected=\"selected\"": "").' >'.(__("October", 'form_maker')).'</option><option value="11" '.($param['w_month']=="11" ? "selected=\"selected\"": "").'>'.(__("November", 'form_maker')).'</option><option value="12" '.($param['w_month']=="12" ? "selected=\"selected\"": "").' >'.(__("December", 'form_maker')).'</option></select>';
2660
- }
2661
- else {
2662
- $w_month_type = '<input type="text" value="'.$element_value[1].'" id="wdform_'.$id1.'_month'.$form_id.'" name="wdform_'.$id1.'_month'.$form_id.'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'>';
2663
- $onload_js .='jQuery("#wdform_'.$id1.'_month'.$form_id.'").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2664
- $onload_js .='jQuery("#wdform_'.$id1.'_month'.$form_id.'").keypress(function() {return check_month(event, this)});';
2665
- }
2666
-
2667
-
2668
- if($param['w_year_type']=="SELECT" ) {
2669
- $w_year_type = '<select id="wdform_'.$id1.'_year'.$form_id.'" name="wdform_'.$id1.'_year'.$form_id.'" from="'.$param['w_from'].'" to="'.$param['w_to'].'" style="width: '.$param['w_year_size'].'px;" '.$param['attributes'].'><option value=""></option>';
2670
-
2671
- for($k=$param['w_to']; $k>=$param['w_from']; $k--) {
2672
- if($element_value[2]==$k)
2673
- $selected = "selected=\"selected\"";
2674
- else
2675
- $selected = "";
2676
-
2677
- $w_year_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
2678
- }
2679
- $w_year_type .= '</select>';
2680
- }
2681
- else {
2682
- $w_year_type = '<input type="text" value="'.$element_value[2].'" 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'].'>';
2683
- $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").blur(function() {check_year2(this)});';
2684
- $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").keypress(function() {return check_year1(event, this)});';
2685
- $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").change(function() {change_year(this)});';
2686
- }
2687
-
2688
- $rep ='<div type="type_date_fields" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2689
-
2690
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;">'.$w_day_type.'</div><div style="display: table-cell;"><span class="wdform_separator">'.$param['w_divider'].'</span></div><div style="display: table-cell;">'.$w_month_type.'</div><div style="display: table-cell;"><span class="wdform_separator">'.$param['w_divider'].'</span></div><div style="display: table-cell;">'.$w_year_type.'</div></div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">'.$param['w_day_label'].'</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label" >'.$param['w_month_label'].'</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">'.$param['w_year_label'].'</label></div></div></div></div></div>';
2691
-
2692
- break;
2693
- }
2694
-
2695
-
2696
- case 'type_hidden': {
2697
- $params_names=array('w_name','w_value');
2698
- $temp=$params;
2699
-
2700
- foreach($params_names as $params_name ) {
2701
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2702
- $param[$params_name] = $temp[0];
2703
- $temp=$temp[1];
2704
- }
2705
-
2706
- if($temp) {
2707
- $temp =explode('*:*w_attr_name*:*',$temp);
2708
- $attrs = array_slice($temp,0, count($temp)-1);
2709
- foreach($attrs as $attr)
2710
- $param['attributes'] = $param['attributes'].' '.$attr;
2711
- }
2712
-
2713
- $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>';
2714
-
2715
- break;
2716
- }
2717
-
2718
-
2719
- case 'type_paypal_price': {
2720
-
2721
- $params_names=array('w_field_label_size','w_field_label_pos','w_first_val','w_title', 'w_mini_labels','w_size','w_required','w_hide_cents','w_class','w_range_min','w_range_max');
2722
- $temp=$params;
2723
-
2724
- foreach($params_names as $params_name ) {
2725
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2726
- $param[$params_name] = $temp[0];
2727
- $temp=$temp[1];
2728
- }
2729
-
2730
-
2731
- if($temp) {
2732
- $temp =explode('*:*w_attr_name*:*',$temp);
2733
- $attrs = array_slice($temp,0, count($temp)-1);
2734
- foreach($attrs as $attr)
2735
- $param['attributes'] = $param['attributes'].' '.$attr;
2736
- }
2737
-
2738
- if (strpos($element_value,'.')!== false)
2739
- $element = explode('.',$element_value);
2740
- else {
2741
- $element = Array();
2742
- $element[0] = preg_replace("/[^0-9]/","",$element_value);
2743
- $element[1] = '';
2744
- }
2745
-
2746
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2747
-
2748
- $hide_cents = ($param['w_hide_cents']=="yes" ? "none;" : "table-cell;");
2749
-
2750
- $w_mini_labels = explode('***',$param['w_mini_labels']);
2751
-
2752
- $rep ='<div type="type_paypal_price" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2753
-
2754
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><input type="hidden" value="'.$param['w_range_min'].'" name="wdform_'.$id1.'_range_min'.$form_id.'" id="wdform_'.$id1.'_range_min'.$form_id.'"><input type="hidden" value="'.$param['w_range_max'].'" name="wdform_'.$id1.'_range_max'.$form_id.'" id="wdform_'.$id1.'_range_max'.$form_id.'"><div id="wdform_'.$id1.'_table_price" style="display: table;"><div id="wdform_'.$id1.'_tr_price1" style="display: table-row;"><div id="wdform_'.$id1.'_td_name_currency" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;'.$form_currency.'&nbsp;<!--repend--></span></div><div id="wdform_'.$id1.'_td_name_dollars" style="display: table-cell;"><input type="text" class="" id="wdform_'.$id1.'_element_dollars'.$form_id.'" name="wdform_'.$id1.'_element_dollars'.$form_id.'" value="'.(strpos($element_value,'.') !== false ? preg_replace("/[^0-9]/","",$element[0]) : $element[0]).'" onkeypress="return check_isnum(event)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].'></div><div id="wdform_'.$id1.'_td_name_divider" style="display: '.$hide_cents.';"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;.&nbsp;</span></div><div id="wdform_'.$id1.'_td_name_cents" style="display: '.$hide_cents.'"><input type="text" class="" id="wdform_'.$id1.'_element_cents'.$form_id.'" name="wdform_'.$id1.'_element_cents'.$form_id.'" value="'.(strpos($element_value,'.') !== false ? preg_replace("/[^0-9]/","",$element[1]) : " ").'" style="width: 30px;" '.$param['attributes'].'></div></div><div id="wdform_'.$id1.'_tr_price2" style="display: table-row;"><div style="display: table-cell;"><label class="mini_label"></label></div><div align="left" style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[0].'</label></div><div id="wdform_'.$id1.'_td_name_label_divider" style="display: '.$hide_cents.'"><label class="mini_label"></label></div><div align="left" id="wdform_'.$id1.'_td_name_label_cents" style="display: '.$hide_cents.'"><label class="mini_label">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
2755
-
2756
- $onload_js .='jQuery("#wdform_'.$id1.'_element_cents'.$form_id.'").blur(function() {add_0(this)});';
2757
- $onload_js .='jQuery("#wdform_'.$id1.'_element_cents'.$form_id.'").keypress(function() {return check_isnum_interval(event,this,0,99)});';
2758
-
2759
- break;
2760
- }
2761
-
2762
- case 'type_paypal_select':
2763
-
2764
- {
2765
-
2766
-
2767
-
2768
- if($element_value=='')
2769
-
2770
- $element_value = ' :';
2771
-
2772
-
2773
-
2774
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_price','w_choices_checked', 'w_choices_disabled','w_required','w_quantity','w_class','w_property','w_property_values');
2775
-
2776
- $temp=$params;
2777
-
2778
-
2779
-
2780
- if(strpos($temp, 'w_choices_params') > -1)
2781
-
2782
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_price','w_choices_checked', 'w_choices_disabled','w_required','w_quantity', 'w_quantity_value', 'w_choices_params','w_class','w_property','w_property_values');
2783
-
2784
-
2785
-
2786
- foreach($params_names as $params_name )
2787
-
2788
- {
2789
-
2790
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2791
-
2792
- $param[$params_name] = $temp[0];
2793
-
2794
- $temp=$temp[1];
2795
-
2796
- }
2797
-
2798
-
2799
-
2800
-
2801
-
2802
- if($temp)
2803
-
2804
- {
2805
-
2806
- $temp =explode('*:*w_attr_name*:*',$temp);
2807
-
2808
- $attrs = array_slice($temp,0, count($temp)-1);
2809
-
2810
- foreach($attrs as $attr)
2811
-
2812
- $param['attributes'] = $param['attributes'].' '.$attr;
2813
-
2814
- }
2815
-
2816
-
2817
-
2818
-
2819
-
2820
- $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
2821
-
2822
- $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
2823
-
2824
- $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
2825
-
2826
-
2827
-
2828
- $param['w_choices'] = explode('***',$param['w_choices']);
2829
-
2830
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
2831
-
2832
-
2833
-
2834
- $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
2835
-
2836
- $param['w_property'] = explode('***',$param['w_property']);
2837
-
2838
- $param['w_property_values'] = explode('***',$param['w_property_values']);
2839
-
2840
- if(isset($param['w_choices_params']))
2841
-
2842
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2843
-
2844
-
2845
-
2846
-
2847
-
2848
- if(strpos($element_value,'***br***') !== false)
2849
-
2850
- {
2851
-
2852
- $element_value = explode('***br***',$element_value);
2853
-
2854
- if(count($element_value)==2)
2855
-
2856
- {
2857
-
2858
- if(strpos($element_value[1],'***quantity***') !== false)
2859
-
2860
- {
2861
-
2862
- $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
2863
-
2864
- $quantity_value = $quantity_value[1];
2865
-
2866
- $property_of_select = '';
2867
-
2868
- }
2869
-
2870
- else
2871
-
2872
- {
2873
-
2874
- $quantity_value = '' ;
2875
-
2876
- $property_of_select = explode(': ',str_replace("***property***","",$element_value[1]));
2877
-
2878
- $property_of_select = $property_of_select[1];
2879
-
2880
- }
2881
-
2882
-
2883
-
2884
- $element_value = explode(' :',$element_value[0]);
2885
-
2886
- $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
2887
-
2888
- }
2889
-
2890
- else
2891
-
2892
- {
2893
-
2894
- $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
2895
-
2896
- $quantity_value = $quantity_value[1];
2897
-
2898
- $property_of_select = explode(': ',str_replace("***property***","",$element_value[2]));
2899
-
2900
- $property_of_select = $property_of_select[1];
2901
-
2902
- $element_value = explode(' :',$element_value[0]);
2903
-
2904
- $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
2905
-
2906
- }
2907
-
2908
- }
2909
-
2910
- else
2911
-
2912
- {
2913
-
2914
- $element_value = explode(' :',$element_value);
2915
-
2916
- $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
2917
-
2918
- $quantity_value = '';
2919
-
2920
- $property_of_select = '';
2921
-
2922
- }
2923
-
2924
-
2925
-
2926
-
2927
-
2928
- $rep='<div type="type_paypal_select" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos1'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2929
-
2930
-
2931
-
2932
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos2'].'; width: '.$param['w_size'].'px;"><select id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" style="width:100%;" '.$param['attributes'].'>';
2933
-
2934
- foreach($param['w_choices'] as $key => $choice)
2935
-
2936
- {
2937
-
2938
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2939
-
2940
- {
2941
-
2942
- $choices_labels =array();
2943
- $choices_values =array();
2944
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2945
- $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
2946
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2947
- $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
2948
- $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
2949
-
2950
-
2951
- $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
2952
-
2953
- $table = $label_table_and_column[0];
2954
-
2955
- $label_column = $label_table_and_column[1];
2956
-
2957
- if($label_column)
2958
-
2959
- {
2960
-
2961
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
2962
-
2963
- }
2964
-
2965
-
2966
-
2967
- $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
2968
-
2969
- $value_column = $param['w_choices_disabled'][$key]=="true" ? '' : $value_table_and_column[1];
2970
-
2971
-
2972
-
2973
- if($value_column)
2974
-
2975
- {
2976
-
2977
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
2978
-
2979
- }
2980
-
2981
-
2982
-
2983
- $columns_count = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
2984
-
2985
-
2986
-
2987
- for($k=0; $k<$columns_count; $k++)
2988
-
2989
- {
2990
-
2991
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
2992
-
2993
- $choice_value = isset($choices_values[$k]) ? (float)$choices_values[$k] : '';
2994
-
2995
-
2996
-
2997
- if($element_value[0] == $choice_label && $choice_value == $choise_value)
2998
-
2999
- $selected = 'selected="selected"';
3000
-
3001
- else
3002
-
3003
- $selected = '';
3004
-
3005
-
3006
-
3007
- $rep.='<option value="'.$choice_value.'" '.$selected.'>'.$choice_label.'</option>';
3008
-
3009
- }
3010
-
3011
- }
3012
-
3013
- else
3014
-
3015
- {
3016
-
3017
- if($param['w_choices_disabled'][$key]=="true")
3018
-
3019
- $choice_value='';
3020
-
3021
- else
3022
-
3023
- $choice_value=$param['w_choices_price'][$key];
3024
-
3025
-
3026
-
3027
- if($element_value[0] == $choice && $param['w_choices_price'][$key] == $choise_value)
3028
-
3029
- $selected = 'selected="selected"';
3030
-
3031
- else
3032
-
3033
- $selected = '';
3034
-
3035
-
3036
-
3037
- $rep.='<option value="'.$choice_value.'" '.$selected.'>'.$choice.'</option>';
3038
-
3039
-
3040
-
3041
- }
3042
-
3043
- }
3044
-
3045
- $rep.='</select><div id="wdform_'.$id1.'_div'.$form_id.'">';
3046
-
3047
- if($param['w_quantity']=="yes")
3048
-
3049
- {
3050
-
3051
- $rep.='<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">Quantity</label><input type="text" id="wdform_'.$id1.'_element_quantity'.$form_id.'" name="wdform_'.$id1.'_element_quantity'.$form_id.'" value="'.($quantity_value=="" ? 1 : $quantity_value).'" class="wdform-quantity"></div>';
3052
-
3053
- }
3054
-
3055
- if($param['w_property'][0])
3056
-
3057
- foreach($param['w_property'] as $key => $property)
3058
-
3059
- {
3060
-
3061
-
3062
-
3063
- $rep.='
3064
-
3065
- <div id="wdform_'.$id1.'_property_'.$key.'" class="paypal-property">
3066
-
3067
- <div style="width:150px; display:inline-block;">
3068
-
3069
- <label class="mini_label" id="wdform_'.$id1.'_property_label_'.$form_id.''.$key.'" style="margin-right: 5px;">'.$property.'</label>
3070
-
3071
- <select id="wdform_'.$id1.'_property'.$form_id.''.$key.'" name="wdform_'.$id1.'_property'.$form_id.''.$key.'" style="width: 100%; margin: 2px 0px;">';
3072
-
3073
- $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
3074
-
3075
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
3076
-
3077
- foreach($param['w_property_values'][$key] as $subkey => $property_value)
3078
-
3079
- {
3080
-
3081
- $rep.='<option id="wdform_'.$id1.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'" '.($property_of_select==$property_value ? 'selected="selected"' : "").'>'.$property_value.'</option>';
3082
-
3083
- }
3084
-
3085
- $rep.='</select></div></div>';
3086
-
3087
- }
3088
-
3089
-
3090
-
3091
- $rep.='</div></div></div>';
3092
-
3093
-
3094
-
3095
-
3096
-
3097
- $onsubmit_js.='
3098
-
3099
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_label'.$form_id.'\" />").val(jQuery("#wdform_'.$id1.'_element'.$form_id.' option:selected").text()).appendTo("#adminForm");
3100
-
3101
- ';
3102
-
3103
- $onsubmit_js.='
3104
-
3105
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_quantity_label'.$form_id.'\" />").val("Quantity").appendTo("#adminForm");
3106
-
3107
- ';
3108
-
3109
- $onsubmit_js.='
3110
-
3111
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_property_label'.$form_id.'\" />").val("'.$param['w_property'][0].'").appendTo("#adminForm");
3112
-
3113
- ';
3114
-
3115
-
3116
-
3117
-
3118
-
3119
- break;
3120
-
3121
- }
3122
-
3123
- case 'type_paypal_checkbox':
3124
-
3125
- {
3126
-
3127
-
3128
-
3129
- if($element_value == '')
3130
-
3131
- $element_value =' :';
3132
-
3133
-
3134
-
3135
- $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_class','w_property','w_property_values','w_quantity');
3136
-
3137
- $temp=$params;
3138
-
3139
- if(strpos($temp, 'w_field_option_pos') > -1)
3140
-
3141
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_option_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num', 'w_choices_params', 'w_class','w_property','w_property_values','w_quantity');
3142
-
3143
- foreach($params_names as $params_name )
3144
-
3145
- {
3146
-
3147
- $temp=explode('*:*'.$params_name.'*:*',$temp);
3148
-
3149
- $param[$params_name] = $temp[0];
3150
-
3151
- $temp=$temp[1];
3152
-
3153
- }
3154
-
3155
-
3156
-
3157
-
3158
-
3159
- if($temp)
3160
-
3161
- {
3162
-
3163
- $temp =explode('*:*w_attr_name*:*',$temp);
3164
-
3165
- $attrs = array_slice($temp,0, count($temp)-1);
3166
-
3167
- foreach($attrs as $attr)
3168
-
3169
- $param['attributes'] = $param['attributes'].' '.$attr;
3170
-
3171
- }
3172
-
3173
-
3174
-
3175
-
3176
-
3177
- if(!isset($param['w_field_option_pos']))
3178
-
3179
- $param['w_field_option_pos'] = 'left';
3180
-
3181
-
3182
-
3183
- $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
3184
-
3185
- $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
3186
-
3187
- $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
3188
-
3189
- $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
3190
-
3191
-
3192
-
3193
-
3194
-
3195
- $param['w_choices'] = explode('***',$param['w_choices']);
3196
-
3197
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
3198
-
3199
-
3200
-
3201
- $param['w_property'] = explode('***',$param['w_property']);
3202
-
3203
- $param['w_property_values'] = explode('***',$param['w_property_values']);
3204
-
3205
- if(isset($param['w_choices_params']))
3206
-
3207
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
3208
-
3209
-
3210
-
3211
- $rep='<div type="type_paypal_checkbox" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
3212
-
3213
-
3214
-
3215
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
3216
-
3217
-
3218
-
3219
-
3220
-
3221
- if(strpos($element_value,'***br***') !== false)
3222
-
3223
- {
3224
-
3225
- $element_value = explode('***br***',$element_value);
3226
-
3227
- foreach($element_value as $key => $element)
3228
-
3229
- {
3230
-
3231
-
3232
-
3233
- if(strpos($element,'***quantity***') !== false)
3234
-
3235
- {
3236
-
3237
- $quantity_value = explode(': ',str_replace("***quantity***","",$element));
3238
-
3239
- $quantity_value = $quantity_value[1];
3240
-
3241
- unset($element_value[$key]);
3242
-
3243
- }
3244
-
3245
- else
3246
-
3247
- if(strpos($element,'***property***') !== false)
3248
-
3249
- {
3250
-
3251
- $property_of_check = explode(': ',str_replace("***property***","",$element));
3252
-
3253
- $property_of_check = $property_of_check[1];
3254
-
3255
- unset($element_value[$key]);
3256
-
3257
- }
3258
-
3259
- else
3260
-
3261
- {
3262
-
3263
- for($m=0; $m<strlen($element); $m++)
3264
-
3265
- {
3266
-
3267
- if(!ctype_digit($element[strlen($element)-1]))
3268
-
3269
- $element_value[$key] = substr($element,0,-1);
3270
-
3271
- else
3272
-
3273
- break;
3274
-
3275
- }
3276
-
3277
- $quantity_value = '';
3278
-
3279
- $property_of_check = '';
3280
-
3281
- }
3282
-
3283
-
3284
-
3285
- }
3286
-
3287
- }
3288
-
3289
- else
3290
-
3291
- {
3292
-
3293
- $element_value = explode(' :',$element_value);
3294
-
3295
- $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3296
-
3297
- $quantity_value = '';
3298
-
3299
- $property_of_check = '';
3300
-
3301
- }
3302
-
3303
-
3304
-
3305
- $total_queries = 0;
3306
-
3307
- foreach($param['w_choices'] as $key => $choice)
3308
-
3309
- {
3310
-
3311
- $key1 = $key + $total_queries;
3312
-
3313
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
3314
-
3315
- {
3316
-
3317
- $choices_labels = array();
3318
- $choices_values = array();
3319
-
3320
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
3321
- $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
3322
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
3323
-
3324
- $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
3325
- $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
3326
-
3327
- $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
3328
-
3329
- $table = $label_table_and_column[0];
3330
-
3331
- $label_column = $label_table_and_column[1];
3332
-
3333
- if($label_column)
3334
-
3335
- {
3336
-
3337
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3338
- }
3339
-
3340
-
3341
-
3342
- $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
3343
-
3344
- $value_column = $value_table_and_column[1];
3345
-
3346
-
3347
-
3348
- if($value_column)
3349
-
3350
- {
3351
-
3352
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3353
-
3354
- }
3355
-
3356
-
3357
-
3358
- $columns_count = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
3359
-
3360
-
3361
-
3362
- if(array_filter($choices_labels) || array_filter($choices_values))
3363
-
3364
- {
3365
-
3366
- $total_queries = $total_queries + $columns_count-1;
3367
-
3368
-
3369
-
3370
-
3371
-
3372
- for($k=0; $k<$columns_count; $k++)
3373
-
3374
- {
3375
-
3376
- $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
3377
-
3378
- $choice_value = isset($choices_values) ? (float)$choices_values[$k] : '';
3379
-
3380
-
3381
-
3382
- $checked=(in_array($choice_label.' - '.$choice_value, $element_value)=='true' ? 'checked="checked"' : '');
3383
-
3384
-
3385
-
3386
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" '.$param['w_field_option_pos1'].'>'.$choice_label.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" value="'.$choice_value.'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div><input type="hidden" name="wdform_'.$id1.'_element'.$form_id.($key1+$k).'_label" value="'.htmlspecialchars($choice_label).'" /></div>';
3387
-
3388
-
3389
-
3390
-
3391
-
3392
- }
3393
-
3394
- }
3395
-
3396
- }
3397
-
3398
- else
3399
-
3400
- {
3401
-
3402
- $checked=(in_array($choice.' - '.$param['w_choices_price'][$key], $element_value)=='true' ? 'checked="checked"' : '');
3403
-
3404
-
3405
-
3406
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'" '.$param['w_field_option_pos1'].'>'.$choice.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.''.$key1.'" value="'.$param['w_choices_price'][$key].'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div><input type="hidden" name="wdform_'.$id1.'_element'.$form_id.$key1.'_label" value="'.htmlspecialchars($choice).'" /></div>';
3407
-
3408
- }
3409
-
3410
- }
3411
-
3412
-
3413
-
3414
- $rep.='<div id="wdform_'.$id1.'_div'.$form_id.'">';
3415
-
3416
- if($param['w_quantity']=="yes")
3417
-
3418
- $rep.='<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">Quantity</label><input type="text" value="'.($quantity_value == '' ? 1 : $quantity_value).'" id="wdform_'.$id1.'_element_quantity'.$form_id.'" name="wdform_'.$id1.'_element_quantity'.$form_id.'" class="wdform-quantity"></div>';
3419
-
3420
-
3421
-
3422
- if($param['w_property'][0])
3423
-
3424
- foreach($param['w_property'] as $key => $property)
3425
-
3426
- {
3427
-
3428
-
3429
-
3430
- $rep.='
3431
-
3432
- <div class="paypal-property">
3433
-
3434
- <div style="width:150px; display:inline-block;">
3435
-
3436
- <label class="mini_label" id="wdform_'.$id1.'_property_label_'.$form_id.''.$key.'" style="margin-right: 5px;">'.$property.'</label>
3437
-
3438
- <select id="wdform_'.$id1.'_property'.$form_id.''.$key.'" name="wdform_'.$id1.'_property'.$form_id.''.$key.'" style="width: 100%; margin: 2px 0px;">';
3439
-
3440
- $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
3441
-
3442
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
3443
-
3444
- foreach($param['w_property_values'][$key] as $subkey => $property_value)
3445
-
3446
- {
3447
-
3448
- $rep.='<option id="wdform_'.$id1.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'" '.($property_of_check==$property_value ? 'selected="selected"' : "").'>'.$property_value.'</option>';
3449
-
3450
- }
3451
-
3452
- $rep.='</select></div></div>';
3453
-
3454
- }
3455
-
3456
-
3457
-
3458
- $rep.='</div></div></div>';
3459
-
3460
-
3461
-
3462
- $onsubmit_js.='
3463
-
3464
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_quantity_label'.$form_id.'\" />").val("Quantity").appendTo("#adminForm");
3465
-
3466
- ';
3467
-
3468
- $onsubmit_js.='
3469
-
3470
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_property_label'.$form_id.'\" />").val("'.$param['w_property'][0].'").appendTo("#adminForm");
3471
-
3472
- ';
3473
-
3474
-
3475
-
3476
- break;
3477
-
3478
- }
3479
-
3480
- case 'type_paypal_radio':
3481
-
3482
- {
3483
-
3484
-
3485
-
3486
- if($element_value=='')
3487
-
3488
- $element_value = ' :';
3489
-
3490
-
3491
-
3492
- $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_class','w_property','w_property_values','w_quantity');
3493
-
3494
- $temp=$params;
3495
-
3496
-
3497
-
3498
- if(strpos($temp, 'w_field_option_pos') > -1)
3499
-
3500
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_option_pos', 'w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num', 'w_choices_params', 'w_class', 'w_property','w_property_values','w_quantity');
3501
-
3502
-
3503
-
3504
- foreach($params_names as $params_name )
3505
-
3506
- {
3507
-
3508
- $temp=explode('*:*'.$params_name.'*:*',$temp);
3509
-
3510
- $param[$params_name] = $temp[0];
3511
-
3512
- $temp=$temp[1];
3513
-
3514
- }
3515
-
3516
-
3517
-
3518
- if($temp)
3519
-
3520
- {
3521
-
3522
- $temp =explode('*:*w_attr_name*:*',$temp);
3523
-
3524
- $attrs = array_slice($temp,0, count($temp)-1);
3525
-
3526
- foreach($attrs as $attr)
3527
-
3528
- $param['attributes'] = $param['attributes'].' '.$attr;
3529
-
3530
- }
3531
-
3532
- if(!isset($param['w_field_option_pos']))
3533
-
3534
- $param['w_field_option_pos'] = 'left';
3535
-
3536
-
3537
-
3538
- $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
3539
-
3540
- $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
3541
-
3542
- $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
3543
-
3544
- $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
3545
-
3546
-
3547
-
3548
- $param['w_choices'] = explode('***',$param['w_choices']);
3549
-
3550
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
3551
-
3552
-
3553
-
3554
- $param['w_property'] = explode('***',$param['w_property']);
3555
-
3556
- $param['w_property_values'] = explode('***',$param['w_property_values']);
3557
-
3558
- if(isset($param['w_choices_params']))
3559
-
3560
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
3561
-
3562
-
3563
-
3564
- $rep='<div type="type_paypal_radio" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
3565
-
3566
-
3567
-
3568
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
3569
-
3570
-
3571
-
3572
- if(strpos($element_value,'***br***') !== false)
3573
-
3574
- {
3575
-
3576
- $element_value = explode('***br***',$element_value);
3577
-
3578
- if(count($element_value)==2)
3579
-
3580
- {
3581
-
3582
- if(strpos($element_value[1],'***quantity***') !== false)
3583
-
3584
- {
3585
-
3586
- $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
3587
-
3588
- $quantity_value = $quantity_value[1];
3589
-
3590
- $property_of_radio = '';
3591
-
3592
- }
3593
-
3594
- else
3595
-
3596
- {
3597
-
3598
- $quantity_value = '' ;
3599
-
3600
- $property_of_radio = explode(': ',str_replace("***property***","",$element_value[1]));
3601
-
3602
- $property_of_radio = $property_of_radio[1];
3603
-
3604
- }
3605
-
3606
-
3607
-
3608
- $element_value = explode(' :',$element_value[0]);
3609
-
3610
- $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3611
-
3612
- }
3613
-
3614
- else
3615
-
3616
- {
3617
-
3618
- $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
3619
-
3620
- $quantity_value = $quantity_value[1];
3621
-
3622
- $property_of_radio = explode(': ',str_replace("***property***","",$element_value[2]));
3623
-
3624
- $property_of_radio = $property_of_radio[1];
3625
-
3626
-
3627
-
3628
- $element_value = explode(' :',$element_value[0]);
3629
-
3630
- $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3631
-
3632
- }
3633
-
3634
- }
3635
-
3636
- else
3637
-
3638
- {
3639
-
3640
- $element_value = explode(' :',$element_value);
3641
-
3642
- $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3643
-
3644
- $quantity_value = '';
3645
-
3646
- $property_of_radio = '';
3647
-
3648
- }
3649
-
3650
- $total_queries = 0;
3651
-
3652
- foreach($param['w_choices'] as $key => $choice)
3653
-
3654
- {
3655
-
3656
- $key1 = $key + $total_queries;
3657
-
3658
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
3659
-
3660
- {
3661
-
3662
- $choices_labels =array();
3663
- $choices_values =array();
3664
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
3665
- $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
3666
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
3667
-
3668
- $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
3669
- $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
3670
-
3671
-
3672
- $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
3673
-
3674
- $table = $label_table_and_column[0];
3675
-
3676
- $label_column = $label_table_and_column[1];
3677
-
3678
- if($label_column)
3679
-
3680
- {
3681
-
3682
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3683
- }
3684
-
3685
-
3686
-
3687
- $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
3688
-
3689
- $value_column = $value_table_and_column[1];
3690
-
3691
-
3692
-
3693
- if($value_column)
3694
-
3695
- {
3696
-
3697
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3698
-
3699
- }
3700
-
3701
-
3702
-
3703
- $columns_count_radio = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
3704
-
3705
-
3706
-
3707
- if(array_filter($choices_labels) || array_filter($choices_values))
3708
-
3709
- {
3710
-
3711
- $total_queries = $total_queries + $columns_count_radio-1;
3712
-
3713
- for($k=0; $k<$columns_count_radio; $k++)
3714
-
3715
- {
3716
-
3717
- $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
3718
-
3719
- $choice_value = isset($choices_values) ? (float)$choices_values[$k] : '';
3720
-
3721
-
3722
-
3723
- if($element_value[0] == $choice_label && $choice_value == $choise_value)
3724
-
3725
- $checked = 'checked="checked"';
3726
-
3727
- else
3728
-
3729
- $checked = '';
3730
-
3731
-
3732
-
3733
-
3734
-
3735
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'">'.$choice_label.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$choice_value.'" title="'.htmlspecialchars($choice_label).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
3736
-
3737
-
3738
-
3739
- }
3740
-
3741
- }
3742
-
3743
- }
3744
-
3745
- else
3746
-
3747
- {
3748
-
3749
- if($element_value[0] == $choice && $param['w_choices_price'][$key] == $choise_value)
3750
-
3751
- $checked = 'checked="checked"';
3752
-
3753
- else
3754
-
3755
- $checked = '';
3756
-
3757
-
3758
-
3759
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'">'.$choice.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$param['w_choices_price'][$key].'" title="'.htmlspecialchars($choice).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
3760
-
3761
- }
3762
-
3763
-
3764
-
3765
- }
3766
-
3767
-
3768
-
3769
- $rep.='<div id="wdform_'.$id1.'_div'.$form_id.'">';
3770
-
3771
- if($param['w_quantity']=="yes")
3772
-
3773
- $rep.='<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">Quantity</label><input type="text" value="'.($quantity_value=='' ? 1 : $quantity_value).'" id="wdform_'.$id1.'_element_quantity'.$form_id.'" name="wdform_'.$id1.'_element_quantity'.$form_id.'" class="wdform-quantity"></div>';
3774
-
3775
-
3776
-
3777
- if($param['w_property'][0])
3778
-
3779
- foreach($param['w_property'] as $key => $property)
3780
-
3781
- {
3782
-
3783
-
3784
-
3785
- $rep.='
3786
-
3787
- <div class="paypal-property">
3788
-
3789
- <div style="width:150px; display:inline-block;">
3790
-
3791
- <label class="mini_label" id="wdform_'.$id1.'_property_label_'.$form_id.''.$key.'" style="margin-right: 5px;">'.$property.'</label>
3792
-
3793
- <select id="wdform_'.$id1.'_property'.$form_id.''.$key.'" name="wdform_'.$id1.'_property'.$form_id.''.$key.'" style="width: 100%; margin: 2px 0px;">';
3794
-
3795
- $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
3796
-
3797
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
3798
-
3799
- foreach($param['w_property_values'][$key] as $subkey => $property_value)
3800
-
3801
- {
3802
-
3803
- $rep.='<option id="wdform_'.$id1.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'" '.($property_of_radio==$property_value ? 'selected="selected"' : "").'>'.$property_value.'</option>';
3804
-
3805
- }
3806
-
3807
- $rep.='</select></div></div>';
3808
-
3809
- }
3810
-
3811
-
3812
-
3813
- $rep.='</div></div></div>';
3814
-
3815
-
3816
-
3817
-
3818
-
3819
- $onsubmit_js.='
3820
-
3821
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_label'.$form_id.'\" />").val(
3822
-
3823
- jQuery("label[for=\'"+jQuery("input[name^=\'wdform_'.$id1.'_element'.$form_id.'\']:checked").prop("id")+"\']").eq(0).text()
3824
-
3825
- ).appendTo("#adminForm");
3826
-
3827
-
3828
-
3829
- ';
3830
-
3831
- $onsubmit_js.='
3832
-
3833
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_quantity_label'.$form_id.'\" />").val("Quantity").appendTo("#adminForm");
3834
-
3835
- ';
3836
-
3837
- $onsubmit_js.='
3838
-
3839
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_property_label'.$form_id.'\" />").val("'.$param['w_property'][0].'").appendTo("#adminForm");
3840
-
3841
- ';
3842
-
3843
- break;
3844
-
3845
- }
3846
-
3847
-
3848
- case 'type_paypal_shipping':
3849
-
3850
- {
3851
-
3852
-
3853
-
3854
- if($element_value=='')
3855
-
3856
- $element_value =' - ';
3857
-
3858
-
3859
-
3860
- $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_class');
3861
-
3862
- $temp=$params;
3863
-
3864
-
3865
-
3866
- if(strpos($temp, 'w_field_option_pos') > -1)
3867
-
3868
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_option_pos', 'w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_choices_params', 'w_class');
3869
-
3870
- foreach($params_names as $params_name )
3871
-
3872
- {
3873
-
3874
- $temp=explode('*:*'.$params_name.'*:*',$temp);
3875
-
3876
- $param[$params_name] = $temp[0];
3877
-
3878
- $temp=$temp[1];
3879
-
3880
- }
3881
-
3882
-
3883
-
3884
- if($temp)
3885
-
3886
- {
3887
-
3888
- $temp =explode('*:*w_attr_name*:*',$temp);
3889
-
3890
- $attrs = array_slice($temp,0, count($temp)-1);
3891
-
3892
- foreach($attrs as $attr)
3893
-
3894
- $param['attributes'] = $param['attributes'].' '.$attr;
3895
-
3896
- }
3897
-
3898
-
3899
-
3900
- if(!isset($param['w_field_option_pos']))
3901
-
3902
- $param['w_field_option_pos'] = 'left';
3903
-
3904
-
3905
-
3906
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
3907
-
3908
- $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
3909
-
3910
- $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
3911
-
3912
-
3913
-
3914
-
3915
-
3916
- $param['w_choices'] = explode('***',$param['w_choices']);
3917
-
3918
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
3919
-
3920
- if(isset($param['w_choices_params']))
3921
-
3922
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
3923
-
3924
-
3925
-
3926
-
3927
-
3928
-
3929
-
3930
- $element_value = explode(' - ',$element_value);
3931
-
3932
- $element_value[1] = preg_replace("/[^0-9]/","",$element_value[1]);
3933
-
3934
-
3935
-
3936
- $rep='<div type="type_paypal_shipping" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
3937
-
3938
-
3939
-
3940
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
3941
-
3942
-
3943
-
3944
- $total_queries = 0;
3945
-
3946
- foreach($param['w_choices'] as $key => $choice)
3947
-
3948
- {
3949
-
3950
- $key1 = $key + $total_queries;
3951
-
3952
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
3953
-
3954
- {
3955
-
3956
- $choices_labels =array();
3957
- $choices_values =array();
3958
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
3959
- $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
3960
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
3961
-
3962
- $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
3963
- $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
3964
-
3965
-
3966
- $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
3967
-
3968
- $table = $label_table_and_column[0];
3969
-
3970
- $label_column = $label_table_and_column[1];
3971
-
3972
- if($label_column)
3973
-
3974
- {
3975
-
3976
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3977
- }
3978
-
3979
-
3980
-
3981
- $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
3982
-
3983
- $value_column = $value_table_and_column[1];
3984
-
3985
-
3986
-
3987
- if($value_column)
3988
-
3989
- {
3990
-
3991
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3992
-
3993
- }
3994
-
3995
-
3996
-
3997
- $columns_count_shipping = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
3998
-
3999
-
4000
-
4001
- if(array_filter($choices_labels) || array_filter($choices_values))
4002
-
4003
- {
4004
-
4005
- $total_queries = $total_queries + $columns_count_shipping-1;
4006
-
4007
- for($k=0; $k<$columns_count_shipping; $k++)
4008
-
4009
- {
4010
-
4011
- $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
4012
-
4013
- $choice_value = isset($choices_values) ? (float)$choices_values[$k] : '';
4014
-
4015
-
4016
-
4017
- $checked =(($choice_label==$element_value[0] && $choice_value== $element_value[1]) ? 'checked="checked"' : '');
4018
-
4019
-
4020
-
4021
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'">'.$choice_label.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$choice_value.'" title="'.htmlspecialchars($choice_label).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
4022
-
4023
- }
4024
-
4025
- }
4026
-
4027
- }
4028
-
4029
- else
4030
-
4031
- {
4032
-
4033
- $checked =(($choice==$element_value[0] && $param['w_choices_price'][$key]== $element_value[1]) ? 'checked="checked"' : '');
4034
-
4035
-
4036
-
4037
- $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'">'.$choice.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$param['w_choices_price'][$key].'" title="'.htmlspecialchars($choice).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
4038
-
4039
- }
4040
-
4041
- }
4042
-
4043
-
4044
-
4045
- $rep.='</div></div>';
4046
-
4047
-
4048
-
4049
-
4050
-
4051
- $onsubmit_js.='
4052
-
4053
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_label'.$form_id.'\" />").val(
4054
-
4055
- jQuery("label[for=\'"+jQuery("input[name^=\'wdform_'.$id1.'_element'.$form_id.'\']:checked").prop("id")+"\']").eq(0).text()
4056
-
4057
- ).appendTo("#adminForm");
4058
-
4059
-
4060
-
4061
- ';
4062
-
4063
-
4064
-
4065
- break;
4066
-
4067
- }
4068
-
4069
- case 'type_star_rating': {
4070
- if($element_value=='')
4071
- $element_value = '/';
4072
-
4073
- $params_names = array('w_field_label_size','w_field_label_pos','w_field_label_col','w_star_amount','w_required','w_class');
4074
- $temp = $params;
4075
- foreach($params_names as $params_name ) {
4076
- $temp=explode('*:*'.$params_name.'*:*',$temp);
4077
- $param[$params_name] = $temp[0];
4078
- $temp=$temp[1];
4079
- }
4080
-
4081
- if($temp) {
4082
- $temp =explode('*:*w_attr_name*:*',$temp);
4083
- $attrs = array_slice($temp,0, count($temp)-1);
4084
- foreach($attrs as $attr)
4085
- $param['attributes'] = $param['attributes'].' add_'.$attr;
4086
- }
4087
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4088
-
4089
- $element_value = explode('/', $element_value);
4090
-
4091
- $images = '';
4092
- for($i=0; $i<$element_value[1]; $i++) {
4093
- $images .= '<img id="wdform_'.$id1.'_star_'.$i.'_'.$form_id.'" src="' . WD_FMC_URL . '/images/star.png" >';
4094
-
4095
- $onload_js .='jQuery("#wdform_'.$id1.'_star_'.$i.'_'.$form_id.'").mouseover(function() {change_src('.$i.',"wdform_'.$id1.'", "'.$form_id.'", "'.$param['w_field_label_col'].'");});';
4096
- $onload_js .='jQuery("#wdform_'.$id1.'_star_'.$i.'_'.$form_id.'").mouseout(function() {reset_src('.$i.',"wdform_'.$id1.'", "'.$form_id.'");});';
4097
- $onload_js .='jQuery("#wdform_'.$id1.'_star_'.$i.'_'.$form_id.'").click(function() {select_star_rating('.$i.',"wdform_'.$id1.'", "'.$form_id.'","'.$param['w_field_label_col'].'", "'.$element_value[1].'");});';
4098
- $onload_js .='select_star_rating('.($element_value[0]-1).',"wdform_'.$id1.'", "'.$form_id.'","'.$param['w_field_label_col'].'", "'.$element_value[1].'");';
4099
- }
4100
-
4101
- $rep ='<div type="type_star_rating" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4102
-
4103
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div id="wdform_'.$id1.'_element'.$form_id.'" '.$param['attributes'].'>'.$images.'</div><input type="hidden" value="" id="wdform_'.$id1.'_selected_star_amount'.$form_id.'" name="wdform_'.$id1.'_selected_star_amount'.$form_id.'"></div></div>';
4104
-
4105
-
4106
- $onsubmit_js.='
4107
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_star_amount'.$form_id.'\" value = \"'.$param['w_star_amount'].'\" />").appendTo("#form'.$form_id.'");
4108
- ';
4109
-
4110
- break;
4111
- }
4112
- case 'type_scale_rating': {
4113
-
4114
- if($element_value=='')
4115
- $element_value = '/';
4116
-
4117
- $params_names=array('w_field_label_size','w_field_label_pos','w_mini_labels','w_scale_amount','w_required','w_class');
4118
- $temp=$params;
4119
- foreach($params_names as $params_name ) {
4120
- $temp=explode('*:*'.$params_name.'*:*',$temp);
4121
- $param[$params_name] = $temp[0];
4122
- $temp=$temp[1];
4123
- }
4124
-
4125
- if($temp) {
4126
- $temp =explode('*:*w_attr_name*:*',$temp);
4127
- $attrs = array_slice($temp,0, count($temp)-1);
4128
- foreach($attrs as $attr)
4129
- $param['attributes'] = $param['attributes'].' add_'.$attr;
4130
- }
4131
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4132
-
4133
- $element_value = explode('/',$element_value);
4134
- $w_mini_labels = explode('***',$param['w_mini_labels']);
4135
-
4136
- $numbers = '';
4137
- $radio_buttons = '';
4138
- $to_check=0;
4139
- $to_check=$element_value[0];
4140
-
4141
- for($i=1; $i<=$element_value[1]; $i++) {
4142
- $numbers.= '<div style="text-align: center; display: table-cell;"><span>'.$i.'</span></div>';
4143
- $radio_buttons.= '<div style="text-align: center; display: table-cell;"><div class="radio-div"><input id="wdform_'.$id1.'_scale_radio'.$form_id.'_'.$i.'" name="wdform_'.$id1.'_scale_radio'.$form_id.'" value="'.$i.'" type="radio" '.( $to_check==$i ? 'checked="checked"' : '' ).'><label for="wdform_'.$id1.'_scale_radio'.$form_id.'_'.$i.'"></label></div></div>';
4144
- }
4145
-
4146
- $rep ='<div type="type_scale_rating" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4147
-
4148
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div id="wdform_'.$id1.'_element'.$form_id.'" style="float: left;" '.$param['attributes'].'><label class="mini_label">'.$w_mini_labels[0].'</label><div style="display: inline-table; vertical-align: middle;border-spacing: 7px;"><div style="display: table-row;">'.$numbers.'</div><div style="display: table-row;">'.$radio_buttons.'</div></div><label class="mini_label" >'.$w_mini_labels[1].'</label></div></div></div>';
4149
-
4150
- $onsubmit_js.='
4151
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_scale_amount'.$form_id.'\" value = \"'.$param['w_scale_amount'].'\" />").appendTo("#form'.$form_id.'");
4152
- ';
4153
-
4154
- break;
4155
- }
4156
-
4157
- case 'type_spinner': {
4158
-
4159
- $params_names=array('w_field_label_size','w_field_label_pos','w_field_width','w_field_min_value','w_field_max_value', 'w_field_step', 'w_field_value', 'w_required','w_class');
4160
- $temp=$params;
4161
- foreach($params_names as $params_name ) {
4162
- $temp=explode('*:*'.$params_name.'*:*',$temp);
4163
- $param[$params_name] = $temp[0];
4164
- $temp=$temp[1];
4165
- }
4166
-
4167
- if($temp) {
4168
- $temp =explode('*:*w_attr_name*:*',$temp);
4169
- $attrs = array_slice($temp,0, count($temp)-1);
4170
- foreach($attrs as $attr)
4171
- $param['attributes'] = $param['attributes'].' add_'.$attr;
4172
- }
4173
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4174
-
4175
-
4176
- $rep ='<div type="type_spinner" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4177
-
4178
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><input type="text" value="'.($element_value!= 'null' ? $element_value : '').'" name="wdform_'.$id1.'_element'.$form_id.'" id="wdform_'.$id1.'_element'.$form_id.'" style="width: '.$param['w_field_width'].'px;" '.$param['attributes'].'></div></div>';
4179
-
4180
- $onload_js .='
4181
- jQuery("#wdform_'.$id1.'_element'.$form_id.'")[0].spin = null;
4182
- spinner = jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner();
4183
- spinner.spinner( "value", "'.($element_value!= 'null' ? $element_value : '').'");
4184
- jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ min: "'.$param['w_field_min_value'].'"});
4185
- jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ max: "'.$param['w_field_max_value'].'"});
4186
- jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ step: "'.$param['w_field_step'].'"});
4187
- ';
4188
-
4189
- break;
4190
- }
4191
-
4192
- case 'type_slider': {
4193
-
4194
- $params_names=array('w_field_label_size','w_field_label_pos','w_field_width','w_field_min_value','w_field_max_value', 'w_field_value', 'w_required','w_class');
4195
- $temp=$params;
4196
- foreach($params_names as $params_name ) {
4197
- $temp=explode('*:*'.$params_name.'*:*',$temp);
4198
- $param[$params_name] = $temp[0];
4199
- $temp=$temp[1];
4200
- }
4201
-
4202
- if($temp) {
4203
- $temp =explode('*:*w_attr_name*:*',$temp);
4204
- $attrs = array_slice($temp,0, count($temp)-1);
4205
- foreach($attrs as $attr)
4206
- $param['attributes'] = $param['attributes'].' add_'.$attr;
4207
- }
4208
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4209
-
4210
-
4211
- $rep ='<div type="type_slider" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4212
-
4213
-
4214
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><input type="hidden" value="'.$element_value.'" id="wdform_'.$id1.'_slider_value'.$form_id.'" name="wdform_'.$id1.'_slider_value'.$form_id.'"><div name="'.$id1.'_element'.$form_id.'" id="wdform_'.$id1.'_element'.$form_id.'" style="width: '.$param['w_field_width'].'px;" '.$param['attributes'].'"></div><div align="left" style="display: inline-block; width: 33.3%; text-align: left;"><span id="wdform_'.$id1.'_element_min'.$form_id.'" class="label">'.$param['w_field_min_value'].'</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: center;"><span id="wdform_'.$id1.'_element_value'.$form_id.'" class="label">'.$element_value.'</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: right;"><span id="wdform_'.$id1.'_element_max'.$form_id.'" class="label">'.$param['w_field_max_value'].'</span></div></div></div>';
4215
-
4216
-
4217
- $onload_js .='
4218
- jQuery("#wdform_'.$id1.'_element'.$form_id.'")[0].slide = null;
4219
- jQuery("#wdform_'.$id1.'_element'.$form_id.'").slider({
4220
- range: "min",
4221
- value: eval('.$element_value.'),
4222
- min: eval('.$param['w_field_min_value'].'),
4223
- max: eval('.$param['w_field_max_value'].'),
4224
- slide: function( event, ui ) {
4225
-
4226
- jQuery("#wdform_'.$id1.'_element_value'.$form_id.'").html("" + ui.value)
4227
- jQuery("#wdform_'.$id1.'_slider_value'.$form_id.'").val("" + ui.value)
4228
-
4229
- }
4230
- });
4231
- ';
4232
-
4233
- break;
4234
- }
4235
-
4236
-
4237
- case 'type_range': {
4238
-
4239
- if($element_value=='')
4240
- $element_value = '-';
4241
-
4242
- $params_names=array('w_field_label_size','w_field_label_pos','w_field_range_width','w_field_range_step','w_field_value1', 'w_field_value2', 'w_mini_labels', 'w_required','w_class');
4243
- $temp=$params;
4244
- foreach($params_names as $params_name ) {
4245
- $temp=explode('*:*'.$params_name.'*:*',$temp);
4246
- $param[$params_name] = $temp[0];
4247
- $temp=$temp[1];
4248
- }
4249
-
4250
- if($temp) {
4251
- $temp =explode('*:*w_attr_name*:*',$temp);
4252
- $attrs = array_slice($temp,0, count($temp)-1);
4253
- foreach($attrs as $attr)
4254
- $param['attributes'] = $param['attributes'].' add_'.$attr;
4255
- }
4256
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4257
-
4258
- $element_value = explode('-',$element_value);
4259
-
4260
- $w_mini_labels = explode('***',$param['w_mini_labels']);
4261
-
4262
- $rep ='<div type="type_range" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4263
-
4264
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div style="display: table;"><div style="display: table-row;"><div valign="middle" align="left" style="display: table-cell;"><input type="text" value="'.($element_value[0]!= 'null' ? $element_value[0] : '').'" name="wdform_'.$id1.'_element'.$form_id.'0" id="wdform_'.$id1.'_element'.$form_id.'0" style="width: '.$param['w_field_range_width'].'px;" '.$param['attributes'].'></div><div valign="middle" align="left" style="display: table-cell; padding-left: 4px;"><input type="text" value="'.($element_value[1]!= 'null' ? $element_value[1] : '').'" name="wdform_'.$id1.'_element'.$form_id.'1" id="wdform_'.$id1.'_element'.$form_id.'1" style="width: '.$param['w_field_range_width'].'px;" '.$param['attributes'].'></div></div><div style="display: table-row;"><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_'.$id1.'_mini_label_from">'.$w_mini_labels[0].'</label></div><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_'.$id1.'_mini_label_to">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
4265
-
4266
- $onload_js .='
4267
- jQuery("#wdform_'.$id1.'_element'.$form_id.'0")[0].spin = null;
4268
- jQuery("#wdform_'.$id1.'_element'.$form_id.'1")[0].spin = null;
4269
-
4270
- spinner0 = jQuery("#wdform_'.$id1.'_element'.$form_id.'0").spinner();
4271
- spinner0.spinner( "value", "'.($element_value[0]!= 'null' ? $element_value[0] : '').'");
4272
- jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ step: '.$param['w_field_range_step'].'});
4273
-
4274
- spinner1 = jQuery("#wdform_'.$id1.'_element'.$form_id.'1").spinner();
4275
- spinner1.spinner( "value", "'.($element_value[1]!= 'null' ? $element_value[1] : '').'");
4276
- jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ step: '.$param['w_field_range_step'].'});
4277
- ';
4278
-
4279
- break;
4280
- }
4281
-
4282
- case 'type_grading': {
4283
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_items', 'w_total', 'w_required','w_class');
4284
- $temp=$params;
4285
- foreach($params_names as $params_name ) {
4286
- $temp=explode('*:*'.$params_name.'*:*',$temp);
4287
- $param[$params_name] = $temp[0];
4288
- $temp=$temp[1];
4289
- }
4290
-
4291
- if($temp) {
4292
- $temp =explode('*:*w_attr_name*:*',$temp);
4293
- $attrs = array_slice($temp,0, count($temp)-1);
4294
- foreach($attrs as $attr)
4295
- $param['attributes'] = $param['attributes'].' add_'.$attr;
4296
- }
4297
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4298
-
4299
-
4300
- $element_value = explode(':', $element_value);
4301
-
4302
- $w_items = explode('***',$param['w_items']);
4303
-
4304
- $w_items_labels =implode(':',$w_items);
4305
-
4306
- $grading_items ='';
4307
-
4308
-
4309
- for($i=0; $i<(count($element_value))/2-1; $i++) {
4310
- $value=$element_value[$i];
4311
-
4312
- $grading_items .= '<div class="wdform_grading"><input type="text" id="wdform_'.$id1.'_element'.$form_id.'_'.$i.'" name="wdform_'.$id1.'_element'.$form_id.'_'.$i.'" value="'.$value.'" '.$param['attributes'].'><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.'_'.$i.'">'.$w_items[$i].'</label></div>';
4313
-
4314
- }
4315
-
4316
- $rep ='<div type="type_grading" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4317
-
4318
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><input type="hidden" value="'.$param['w_total'].'" name="wdform_'.$id1.'_grading_total'.$form_id.'" id="wdform_'.$id1.'_grading_total'.$form_id.'"><div id="wdform_'.$id1.'_element'.$form_id.'">'.$grading_items.'<div id="wdform_'.$id1.'_element_total_div'.$form_id.'" class="grading_div">Total: <span id="wdform_'.$id1.'_sum_element'.$form_id.'">0</span>/<span id="wdform_'.$id1.'_total_element'.$form_id.'">'.$param['w_total'].'</span><span id="wdform_'.$id1.'_text_element'.$form_id.'"></span></div></div></div></div>';
4319
-
4320
- $onload_js.='
4321
- jQuery("#wdform_'.$id1.'_element'.$form_id.' input").change(function() {sum_grading_values("wdform_'.$id1.'","'.$form_id.'");});';
4322
-
4323
- $onload_js.='
4324
- jQuery("#wdform_'.$id1.'_element'.$form_id.' input").keyup(function() {sum_grading_values("wdform_'.$id1.'","'.$form_id.'");});';
4325
-
4326
-
4327
- $onload_js.='
4328
- sum_grading_values("wdform_'.$id1.'","'.$form_id.'");';
4329
-
4330
- $onsubmit_js.='
4331
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_hidden_item'.$form_id.'\" value = \"'.$w_items_labels.':'.$param['w_total'].'\" />").appendTo("#form'.$form_id.'");
4332
- ';
4333
-
4334
- break;
4335
- }
4336
- case 'type_matrix': {
4337
-
4338
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_input_type', 'w_rows', 'w_columns', 'w_required','w_class');
4339
- $temp=$params;
4340
- foreach($params_names as $params_name ) {
4341
- $temp=explode('*:*'.$params_name.'*:*',$temp);
4342
- $param[$params_name] = $temp[0];
4343
- $temp=$temp[1];
4344
- }
4345
-
4346
- if($temp) {
4347
- $temp =explode('*:*w_attr_name*:*',$temp);
4348
- $attrs = array_slice($temp,0, count($temp)-1);
4349
- foreach($attrs as $attr)
4350
- $param['attributes'] = $param['attributes'].' add_'.$attr;
4351
- }
4352
-
4353
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4354
- $w_rows = explode('***',$param['w_rows']);
4355
- $w_columns = explode('***',$param['w_columns']);
4356
- $element_value = str_replace("******matrix***","",$element_value);
4357
- $element_value = explode($param['w_field_input_type'].'***', $element_value);
4358
- $element_value = explode('***', $element_value[1]);
4359
- $column_labels ='';
4360
-
4361
- for($i=1; $i<count($w_columns); $i++) {
4362
- $column_labels .= '<div><label class="wdform-ch-rad-label">'.$w_columns[$i].'</label></div>';
4363
- }
4364
-
4365
- $rows_columns = '';
4366
- $for_matrix =0;
4367
- for($i=1; $i<count($w_rows); $i++) {
4368
-
4369
- $rows_columns .= '<div class="wdform-matrix-row'.($i%2).'"><div class="wdform-matrix-column"><label class="wdform-ch-rad-label" >'.$w_rows[$i].'</label></div>';
4370
-
4371
-
4372
- for($k=1; $k<count($w_columns); $k++) {
4373
- $rows_columns .= '<div class="wdform-matrix-cell">';
4374
- if($param['w_field_input_type']=='radio') {
4375
- if (array_key_exists($i-1,$element_value))
4376
- $to_check=$element_value[$i-1];
4377
- else
4378
- $to_check= '' ;
4379
-
4380
- $rows_columns .= '<div class="radio-div"><input id="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" type="radio" name="wdform_'.$id1.'_input_element'.$form_id.''.$i.'" value="'.$i.'_'.$k.'" '.($to_check==$i.'_'.$k ? 'checked="checked"' : '').'><label for="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'"></label></div>';
4381
-
4382
- }
4383
- else
4384
- if($param['w_field_input_type']=='checkbox') {
4385
-
4386
- if (array_key_exists($for_matrix,$element_value))
4387
- $to_check=$element_value[$for_matrix];
4388
- else
4389
- $to_check= '' ;
4390
-
4391
- $rows_columns .= '<div class="checkbox-div"><input id="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" type="checkbox" name="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" value="1" '.($to_check=="1" ? 'checked="checked"' : '').'><label for="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'"></label></div>';
4392
-
4393
- $for_matrix++;
4394
- }
4395
- else
4396
- if($param['w_field_input_type']=='text') {
4397
- $rows_columns .= '<input id="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" type="text" name="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" value="'.(array_key_exists($for_matrix,$element_value) ? $element_value[$for_matrix] : '').'">';
4398
-
4399
- $for_matrix++;
4400
- }
4401
- else
4402
- if($param['w_field_input_type']=='select') {
4403
- $rows_columns .= '<select id="wdform_'.$id1.'_select_yes_no'.$form_id.''.$i.'_'.$k.'" name="wdform_'.$id1.'_select_yes_no'.$form_id.''.$i.'_'.$k.'" ><option value="" '.(array_key_exists($for_matrix,$element_value) ? ($element_value[$for_matrix]=="" ? "selected=\"selected\"": "") : '').'> </option><option value="yes" '.(array_key_exists($for_matrix,$element_value) ? ($element_value[$for_matrix]=="yes" ? "selected=\"selected\"": "") : '').'>Yes</option><option value="no" '.(array_key_exists($for_matrix,$element_value) ? ($element_value[$for_matrix]=="no" ? "selected=\"selected\"": "") : '').'>No</option></select>';
4404
-
4405
- $for_matrix++;
4406
- }
4407
- $rows_columns.='</div>';
4408
- }
4409
-
4410
- $rows_columns .= '</div>';
4411
- }
4412
-
4413
- $rep ='<div type="type_matrix" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4414
-
4415
- $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div id="wdform_'.$id1.'_element'.$form_id.'" class="wdform-matrix-table" '.$param['attributes'].'><div style="display: table-row-group;"><div class="wdform-matrix-head"><div style="display: table-cell;"></div>'.$column_labels.'</div>'.$rows_columns.'</div></div></div></div>';
4416
-
4417
- $onsubmit_js.='
4418
- jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_input_type'.$form_id.'\" value = \"'.$param['w_field_input_type'].'\" /><input type=\"hidden\" name=\"wdform_'.$id1.'_hidden_row'.$form_id.'\" value = \"'.$param['w_rows'].'\" /><input type=\"hidden\" name=\"wdform_'.$id1.'_hidden_column'.$form_id.'\" value = \"'.$param['w_columns'].'\" />").appendTo("#form'.$form_id.'");
4419
- ';
4420
-
4421
- break;
4422
- }
4423
- }
4424
- $form = str_replace('%'.$id1.' - '.$labels[$id1s_key].'%', $rep, $form);
4425
- }
4426
- }
4427
- echo $form;
4428
- ?>
4429
-
4430
- </div>
4431
- <input type="hidden" name="option" value="com_formmaker"/>
4432
- <input type="hidden" id="current_id" name="current_id" value="<?php echo $rows[0]->group_id; ?>" />
4433
- <input type="hidden" name="form_id" value="<?php echo $rows[0]->form_id; ?>" />
4434
- <input type="hidden" name="date" value="<?php echo $rows[0]->date; ?>" />
4435
- <input type="hidden" name="ip" value="<?php echo $rows[0]->ip; ?>" />
4436
- <input type="hidden" id="task" name="task" value="" />
4437
- <input type="hidden" value="<?php echo WD_FMC_URL; ?>" id="form_plugins_url" />
4438
- <script type="text/javascript">
4439
- function pressbutton() {
4440
- <?php echo $onsubmit_js; ?>;
4441
- }
4442
- jQuery("div[type='type_number'] input, div[type='type_phone'] input, div[type='type_spinner'] input, div[type='type_range'] input, .wdform-quantity").keypress(function(evt) {
4443
- return check_isnum(evt);
4444
- });
4445
- jQuery("div[type='type_grading'] input").keypress(function() {
4446
- return check_isnum_or_minus(event);
4447
- });
4448
- plugin_url = '<?php echo WD_FMC_URL; ?>';
4449
- <?php
4450
- if ($onload_js) {
4451
- ?>
4452
- jQuery(window).load(function () {
4453
- <?php echo $onload_js; ?>;
4454
- });
4455
- <?php
4456
- }
4457
- ?>
4458
- </script>
4459
- </form>
4460
- <?php
4461
- }
4462
- }
4463
-
4464
- ?>
 
 
1
+ <?php
2
+
3
+ class FMViewSubmissions_fmc {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ private $model;
14
+
15
+ ////////////////////////////////////////////////////////////////////////////////////////
16
+ // Constructor & Destructor //
17
+ ////////////////////////////////////////////////////////////////////////////////////////
18
+ public function __construct($model) {
19
+ $this->model = $model;
20
+ }
21
+
22
+ ////////////////////////////////////////////////////////////////////////////////////////
23
+ // Public Methods //
24
+ ////////////////////////////////////////////////////////////////////////////////////////
25
+ public function display($form_id) {
26
+
27
+
28
+ global $wpdb;
29
+ $forms = $this->model->get_form_titles();
30
+ $statistics = $this->model->get_statistics($form_id);
31
+ $labels_parameters = $this->model->get_labels_parameters($form_id);
32
+
33
+ $sorted_labels_id = $labels_parameters[0];
34
+ $sorted_label_types = $labels_parameters[1];
35
+ $lists = $labels_parameters[2];
36
+ $sorted_label_names = $labels_parameters[3];
37
+ $sorted_label_names_original = $labels_parameters[4];
38
+ $rows = ((isset($labels_parameters[5])) ? $labels_parameters[5] : NULL);
39
+ $group_ids = ((isset($labels_parameters[6])) ? $labels_parameters[6] : NULL);
40
+ $where_choices = $labels_parameters[7];
41
+ $searched_ids = $labels_parameters[8] ? implode(',', $labels_parameters[8]) : '';
42
+ $order_by = (isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
43
+ $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc');
44
+ $style_id = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
45
+ $style_date = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
46
+ $style_ip = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
47
+
48
+ $style_username = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
49
+ $style_useremail = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
50
+
51
+ $oder_class_default = "manage-column column-autor sortable desc";
52
+ $oder_class = "manage-column column-title sorted " . $asc_or_desc;
53
+ $ispaypal = FALSE;
54
+ $temp = array();
55
+ $m = count($sorted_label_names);
56
+ $n = count($rows);
57
+ $group_id_s = array();
58
+ $group_id_s = $this->model->sort_group_ids(count($sorted_label_names),$group_ids);
59
+ $ka_fielderov_search = (($lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] || $lists['id_search']) ? TRUE : FALSE);
60
+ $is_stats = false;
61
+ $blocked_ips = $this->model->blocked_ips();
62
+
63
+ if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
64
+ require_once(WD_FM_PDF_DIR.'/model.php');
65
+ $pdf_data = WD_FM_PDF_model::get_pdf_data($form_id);
66
+ }
67
+ $subs_count = $this->model->get_subs_count($form_id);
68
+ $chosen_form_title = '';
69
+ if ($forms) {
70
+ foreach($forms as $form) {
71
+ if ($form_id == $form->id) {
72
+ $chosen_form_title = $form->title;
73
+ }
74
+ }
75
+ }
76
+ ?>
77
+ <script type="text/javascript">
78
+ function export_submissions(type, limit) {
79
+ var progressbar = jQuery( "#fm-progressbar" );
80
+ var progressLabel = jQuery( ".fm-progress-label" );
81
+
82
+ progressbar.progressbar({
83
+ max: <?php echo $subs_count; ?>
84
+ });
85
+
86
+ jQuery.ajax({
87
+ type: "POST",
88
+ url:"<?php echo add_query_arg(array('form_id' => $form_id, 'send_header' => 0), admin_url('admin-ajax.php')); ?>&action=generete_"+type+"_fmc&limitstart="+limit,
89
+ data: {search_labels : '<?php echo $searched_ids; ?>'},
90
+ beforeSend: function() {
91
+ if(<?php echo $subs_count; ?> >= 1000 )
92
+ jQuery('.fm_modal').show();
93
+ },
94
+ success: function(data) {
95
+ if(limit < <?php echo $subs_count; ?>) {
96
+ limit += 1000;
97
+ export_submissions(type, limit);
98
+ progressbar.progressbar( "value", limit);
99
+ loaded_percent = Math.round((progressbar.progressbar( "value" ) * 100)/ parseInt(<?php echo $subs_count; ?>));
100
+ progressLabel.text( loaded_percent + ' %');
101
+ progressbarValue = progressbar.find( ".fm-progress-label" );
102
+ if( loaded_percent >= 46 ) {
103
+ progressbarValue.css({
104
+ "color": '#fff',
105
+ });
106
+ }
107
+ else {
108
+ progressbarValue.css({
109
+ "color": '#444',
110
+ });
111
+ }
112
+ }
113
+ else{
114
+ jQuery('.fm_modal').hide();
115
+ progressbar.progressbar( "value", 0);
116
+ progressLabel.text( 'Loading ...' );
117
+ progressbarValue = progressbar.find( ".fm-progress-label" );
118
+ progressbarValue.css({
119
+ "color": '#444',
120
+ });
121
+ window.location = "<?php echo add_query_arg(array('form_id' => $form_id, 'send_header' => 1), admin_url('admin-ajax.php')); ?>&action=generete_"+type+"_fmc&limitstart="+limit;
122
+ }
123
+ }
124
+ });
125
+ }
126
+
127
+ function clickLabChBAll(ChBAll) {
128
+ <?php
129
+ if (isset($sorted_label_names)) {
130
+ $templabels = array_merge(array(
131
+ 'submitid',
132
+ 'submitdate',
133
+ 'submitterip',
134
+ 'submitterusername',
135
+ 'submitteremail'
136
+ ), $sorted_labels_id);
137
+ $sorted_label_names_for_check = array_merge(array(
138
+ 'ID',
139
+ 'Submit date',
140
+ "Submitter's IP",
141
+ "Submitter's Username",
142
+ "Submitter's Email Address"
143
+ ), $sorted_label_names_original);
144
+ }
145
+ else {
146
+ $templabels = array(
147
+ 'submitid',
148
+ 'submitdate',
149
+ 'submitterip',
150
+ 'submitterusername',
151
+ 'submitteremail'
152
+ );
153
+ $sorted_label_names_for_check = array(
154
+ 'ID',
155
+ 'Submit date',
156
+ "Submitter's IP",
157
+ 'Submitter\'s Username',
158
+ 'Submitter\'s Email Address'
159
+ );
160
+ }
161
+ ?>
162
+ if (ChBAll.checked) {
163
+ document.forms.admin_form.hide_label_list.value = '';
164
+ for (i = 0; i <= ChBAll.form.length; i++) {
165
+ if (typeof(ChBAll.form[i]) != "undefined") {
166
+ if (ChBAll.form[i].type == "checkbox") {
167
+ ChBAll.form[i].checked = true;
168
+ }
169
+ }
170
+ }
171
+ }
172
+ else {
173
+ document.forms.admin_form.hide_label_list.value = '@<?php echo implode($templabels, '@@') ?>@' + '@payment_info@';
174
+ for (i = 0; i <= ChBAll.form.length; i++) {
175
+ if (typeof(ChBAll.form[i]) != "undefined") {
176
+ if (ChBAll.form[i].type == "checkbox") {
177
+ ChBAll.form[i].checked = false;
178
+ }
179
+ }
180
+ }
181
+ }
182
+ renderColumns();
183
+ }
184
+
185
+ function remove_all() {
186
+ if(document.getElementById('startdate'))
187
+ document.getElementById('startdate').value='';
188
+ if(document.getElementById('enddate'))
189
+ document.getElementById('enddate').value='';
190
+ if(document.getElementById('id_search'))
191
+ document.getElementById('id_search').value='';
192
+ if(document.getElementById('ip_search'))
193
+ document.getElementById('ip_search').value='';
194
+ if(document.getElementById('username_search'))
195
+ document.getElementById('username_search').value='';
196
+ if(document.getElementById('useremail_search'))
197
+ document.getElementById('useremail_search').value='';
198
+ <?php
199
+ $n = count($rows);
200
+ for ($i = 0; $i < count($sorted_label_names); $i++) {
201
+ if ($sorted_label_types[$i] != "type_mark_map") { ?>
202
+ document.getElementById('<?php echo $form_id . '_' . $sorted_labels_id[$i] . '_search'; ?>').value='';
203
+ <?php
204
+ }
205
+ }
206
+ ?>
207
+ }
208
+ function show_hide_filter() {
209
+ if (document.getElementById('fields_filter').style.display == "none") {
210
+ document.getElementById('fields_filter').style.display = '';
211
+ }
212
+ else {
213
+ document.getElementById('fields_filter').style.display = "none";
214
+ }
215
+ return false;
216
+ }
217
+ jQuery(document).ready(function () {
218
+ jQuery('.theme-detail').click(function () {
219
+ jQuery(this).siblings('.themedetaildiv').toggle();
220
+ return false;
221
+ });
222
+ });
223
+ </script>
224
+ <div class="fm_modal">
225
+ <div id="fm-progressbar" >
226
+ <div class="fm-progress-label">Loading...</div>
227
+ </div>
228
+ </div>
229
+ <div class="export_progress">
230
+ <span class="exp_count"><?php echo $subs_count; ?></span> left from <?php echo $subs_count; ?>
231
+ </div>
232
+ <div id="sbox-overlay" onclick="toggleChBDiv(false);">
233
+ </div>
234
+ <div id="ChBDiv">
235
+ <form action="#">
236
+ <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
237
+ <p style="font-weight: bold; font-size: 18px; margin-top: 0px;">Select Columns</p>
238
+ <div class="fm_check_labels"><input type="checkbox" <?php echo ($lists['hide_label_list'] === '') ? 'checked="checked"' : ''; ?> onclick="clickLabChBAll(this)" id="ChBAll"/><label for="ChBAll"> All</label></div>
239
+ <?php
240
+ foreach ($templabels as $key => $curlabel) {
241
+ if (strpos($lists['hide_label_list'], '@' . $curlabel . '@') === FALSE) {
242
+ ?>
243
+ <div class="fm_check_labels"><input type="checkbox" checked="checked" onclick="clickLabChB('<?php echo $curlabel; ?>', this)" id="fm_check_id_<?php echo $curlabel; ?>" /><label for="fm_check_id_<?php echo $curlabel; ?>"> <?php echo stripslashes($sorted_label_names_for_check[$key]); ?></label></div>
244
+ <?php
245
+ }
246
+ else {
247
+ ?>
248
+ <div class="fm_check_labels"><input type="checkbox" onclick="clickLabChB('<?php echo $curlabel; ?>', this)" id="fm_check_id_<?php echo $curlabel; ?>"/><label for="fm_check_id_<?php echo $curlabel; ?>"> <?php echo stripslashes($sorted_label_names_for_check[$key]); ?></label></div>
249
+ <?php
250
+ }
251
+ }
252
+ $ispaypal = FALSE;
253
+ for ($i = 0; $i < count($sorted_label_names); $i++) {
254
+ if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
255
+ $ispaypal = TRUE;
256
+ }
257
+ }
258
+ if ($ispaypal) {
259
+ ?>
260
+ <div class="fm_check_labels">
261
+ <input type="checkbox" onclick="clickLabChB('payment_info', this)" id="fm_check_payment_info" <?php echo (strpos($lists['hide_label_list'], '@payment_info@') === FALSE) ? 'checked="checked"' : ''; ?> />
262
+ <label for="fm_check_payment_info"> Payment Info</label>
263
+ </div>
264
+ <?php
265
+ }
266
+ ?>
267
+ <div style="text-align: center; padding-top: 20px;">
268
+ <button onclick="toggleChBDiv(false); return false;" style="background: #4EC0D9; width: 78px; height: 32px; border: 1px solid #4EC0D9; border-radius: 0px; color: #fff; cursor: pointer;">Done</button>
269
+ </div>
270
+ </form>
271
+ </div>
272
+ <div class="fm-user-manual">
273
+ This section allows you to view and manage form submissions.
274
+ <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-7.html">Read More in User Manual</a>
275
+ </div>
276
+ <div class="fm-upgrade-pro">
277
+ <a target="_blank" href="https://web-dorado.com/files/fromContactForm.php">
278
+ <div class="fm-upgrade-img">
279
+ UPGRADE TO PRO VERSION
280
+ <span></span>
281
+ </div>
282
+ </a>
283
+ </div>
284
+ <div class="fm-clear"></div>
285
+ <form action="admin.php?page=submissions_fmc" method="post" id="admin_form" name="admin_form">
286
+ <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
287
+ <input type="hidden" name="option" value="com_formmaker" />
288
+ <input type="hidden" id="task" name="task" value="" />
289
+ <input type="hidden" id="current_id" name="current_id" value="" />
290
+ <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php echo $asc_or_desc; ?>" />
291
+ <input type="hidden" name="order_by" id="order_by" value="<?php echo $order_by; ?>" />
292
+
293
+ <div class="fm-submissions-page">
294
+ <div class="submissions-actions">
295
+ <div class="fm-form-title">
296
+ <?php echo $chosen_form_title; ?>
297
+ </div>
298
+ <div class="fm-page-actions">
299
+ <button class="fm-button block-button small" onclick="fm_set_input_value('task', 'block_ip'); fm_form_submit(event, 'admin_form');">
300
+ <span></span>
301
+ Block IP
302
+ </button>
303
+ <button class="fm-button unblock-button medium" onclick="fm_set_input_value('task', 'unblock_ip'); fm_form_submit(event, 'admin_form');">
304
+ <span></span>
305
+ Unblock IP
306
+ </button>
307
+ <button class="fm-button delete-button small" onclick="if (confirm('Do you want to delete selected items?')) { fm_set_input_value('task', 'delete_all'); fm_form_submit(event, 'admin_form'); } else { return false; }">
308
+ <span></span>
309
+ Delete
310
+ </button>
311
+ </div>
312
+ </div>
313
+ <div class="submissions-toolbar">
314
+ <div class="submissions-tools">
315
+ <select name="form_id" id="form_id" onchange="document.admin_form.submit();">
316
+ <option value="0" selected="selected"> - Select a Form - </option>
317
+ <?php if ($forms) {
318
+ foreach($forms as $form) {
319
+ ?>
320
+ <option value="<?php echo $form->id; ?>" <?php if ($form_id == $form->id) { echo 'selected="selected"'; }?>> <?php echo $form->title ?> </option>
321
+ <?php
322
+ }
323
+ } ?>
324
+ </select>
325
+ <div class="fm-reports">
326
+ <div class="fm-tools-button"><div class="fm-total_entries"><?php echo $statistics["total_entries"]; ?></div>Entries</div>
327
+ <div class="fm-tools-button"><div class="fm-total_rate"><?php echo $statistics["conversion_rate"]; ?></div>Conversion Rate</div>
328
+ <div class="fm-tools-button"><div class="fm-total_views"><?php echo $statistics["total_views"] ? $statistics["total_views"] : 0; ?></div>Views</div>
329
+ </div>
330
+
331
+ <div class="fm-export-tools">
332
+ <span class="exp_but_span">Export to</span>
333
+ &nbsp;
334
+ <button class="fm-tools-button" onclick="export_submissions('csv', 0); return false;">
335
+ CSV
336
+ </button>
337
+ <button class="fm-tools-button" onclick="export_submissions('xml', 0); return false;">
338
+ XML
339
+ </button>
340
+ </div>
341
+ </div>
342
+ </div>
343
+ <div class="tablenav top">
344
+ <div class="fm-filters">
345
+ <div class="fm-search-tools">
346
+ <input type="hidden" name="hide_label_list" value="<?php echo $lists['hide_label_list']; ?>">
347
+ <button class="fm-icon show-filter-icon" onclick="show_hide_filter(); return false;" title="Show Filters">
348
+ <span></span>
349
+ </button>
350
+ <button class="fm-icon search-icon" onclick="fm_form_submit(event, 'admin_form'); return false;" title="Search">
351
+ </button>
352
+ <button class="fm-icon reset-icon" onclick="remove_all(); fm_form_submit(event, 'admin_form'); return false;" title="Reset">
353
+ </button>
354
+ </div>
355
+ <div class="fm-add-remove">
356
+ <?php if (isset($sorted_label_names)) { ?>
357
+ <button class="fm-button" onclick="toggleChBDiv(true); return false;">
358
+ Add/Remove Columns
359
+ </button>
360
+ <?php WDW_FMC_Library::html_page_nav($lists['total'], $lists['limit'], 'admin_form'); ?>
361
+ <?php } ?>
362
+ <input type="hidden" name="pagination_clicked" id="pagination_clicked" value=""/>
363
+ </div>
364
+ </div>
365
+ <div class="fm-clear"></div>
366
+ </div>
367
+
368
+ <div class="fm-loading-container" style="display:none;">
369
+ <div class="fm-loading-content">
370
+ </div>
371
+ </div>
372
+ <div class="submit_content" id="fm-scroll" style="width: 100%;">
373
+ <table class="wp-list-table widefat fixed posts table_content">
374
+ <thead>
375
+ <tr>
376
+ <?php if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))): ?>
377
+ <th class="table_small_col count_col sub-align">PDF</th>
378
+ <?php endif; ?>
379
+ <th class="table_small_col count_col sub-align">#</th>
380
+ <th scope="col" id="cb" class="manage-column column-cb check-column table_small_col sub-align form_check"><input id="check_all" type="checkbox"></th>
381
+ <th scope="col" id="submitid_fc" class="table_small_col sub-align submitid_fc <?php if ($order_by == "group_id") echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_id;?>>
382
+ <a href="" class="sub_id" onclick="fm_set_input_value('order_by', 'group_id');
383
+ fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'group_id' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
384
+ fm_form_submit(event, 'admin_form')">
385
+ <span>ID</span>
386
+ <span class="sorting-indicator" style="margin-top: 8px;"></span>
387
+ </a>
388
+ </th>
389
+ <th class="table_small_col sub-align">Edit</th>
390
+ <th class="table_small_col sub-align">Delete</th>
391
+ <th scope="col" id="submitdate_fc" class="table_large_col submitdate_fc <?php if ($order_by == "date") echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_date;?>>
392
+ <a href="" onclick="fm_set_input_value('order_by', 'date');
393
+ fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'date' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
394
+ fm_form_submit(event, 'admin_form')">
395
+ <span>Submit date</span>
396
+ <span class="sorting-indicator"></span>
397
+ </a>
398
+ </th>
399
+ <th scope="col" id="submitterip_fc" class="table_medium_col_uncenter submitterip_fc <?php if ($order_by == "ip")echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_ip;?>>
400
+ <a href="" onclick="fm_set_input_value('order_by', 'ip');
401
+ fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'ip' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
402
+ fm_form_submit(event, 'admin_form')">
403
+ <span>Submitter's IP</span>
404
+ <span class="sorting-indicator"></span>
405
+ </a>
406
+ </th>
407
+ <th scope="col" id="submitterusername_fc" class="table_medium_col_uncenter submitterusername_fc <?php if ($order_by == "display_name")echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_username;?>>
408
+ <a href="" onclick="fm_set_input_value('order_by', 'display_name');
409
+ fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'display_name' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
410
+ fm_form_submit(event, 'admin_form')">
411
+ <span>Submitter's Username</span>
412
+ <span class="sorting-indicator"></span>
413
+ </a>
414
+ </th>
415
+ <th scope="col" id="submitteremail_fc" class="table_medium_col_uncenter submitteremail_fc <?php if ($order_by == "user_email")echo $oder_class; else echo $oder_class_default; ?>" <?php echo $style_useremail ;?>>
416
+ <a href="" onclick="fm_set_input_value('order_by', 'user_email');
417
+ fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'user_email' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>');
418
+ fm_form_submit(event, 'admin_form')">
419
+ <span>Submitter's Email Address</span>
420
+ <span class="sorting-indicator"></span>
421
+ </a>
422
+ </th>
423
+ <?php
424
+ for ($i = 0; $i < count($sorted_label_names); $i++) {
425
+ $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
426
+ $styleStr2 = $this->model->hide_or_not($lists['hide_label_list'] , '@payment_info@');
427
+ $field_title = $this->model->get_type_address($sorted_label_types[$i], $sorted_label_names_original[$i]);
428
+ if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
429
+ $ispaypal = TRUE;
430
+ ?>
431
+ <th <?php echo $styleStr; ?> id="<?php echo $sorted_labels_id[$i] . '_fc'; ?>" class="table_large_col <?php echo $sorted_labels_id[$i] . '_fc'; if ($order_by == $sorted_labels_id[$i] . "_field") echo $oder_class . '"';else echo $oder_class_default . '"'; ?>">
432
+ <a href="" onclick="fm_set_input_value('order_by', '<?php echo $sorted_labels_id[$i] . '_field'; ?>'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'admin_form')">
433
+ <span><?php echo $field_title; ?></span>
434
+ <span class="sorting-indicator"></span>
435
+ </a>
436
+ </th>
437
+ <th class="table_large_col payment_info_fc" <?php echo $styleStr2; ?>>Payment Info</th>
438
+ <?php
439
+ }
440
+ else {
441
+ ?>
442
+ <th <?php echo $styleStr; ?> id="<?php echo $sorted_labels_id[$i] . '_fc';?>" class="<?php echo ($sorted_label_types[$i] == 'type_mark_map' || $sorted_label_types[$i] == 'type_matrix') ? 'table_large_col ' : ''; echo $sorted_labels_id[$i] . '_fc'; if ($order_by == $sorted_labels_id[$i] . "_field") echo $oder_class . '"';else echo $oder_class_default . '"'; ?>">
443
+ <a href="" onclick="fm_set_input_value('order_by', '<?php echo $sorted_labels_id[$i] . '_field'; ?>'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'admin_form')">
444
+ <span><?php echo $field_title; ?></span>
445
+ <span class="sorting-indicator"></span>
446
+ </a>
447
+ </th>
448
+ <?php
449
+ }
450
+ }
451
+ ?>
452
+ </tr>
453
+ <tr id="fields_filter" style="display: none;">
454
+ <th></th>
455
+ <th></th>
456
+ <th class="submitid_fc" <?php echo $style_id; ?> >
457
+ <input type="text" name="id_search" id="id_search" value="<?php echo $lists['id_search'] ?>" onChange="this.form.submit();" style="width:30px"/>
458
+ </th>
459
+ <th></th>
460
+ <th></th>
461
+ <th width="150" class="submitdate_fc" <?php echo $style_date; ?>>
462
+ <table align="center" style="margin:auto" class="simple_table">
463
+ <tr class="simple_table">
464
+ <td class="simple_table" style="text-align: left;">From:</td>
465
+ <td style="text-align: center;" class="simple_table">
466
+ <input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php echo $lists['startdate']; ?>" />
467
+ </td>
468
+ <td style="text-align: center;" class="simple_table">
469
+ <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
470
+ </td>
471
+ </tr>
472
+ <tr class="simple_table">
473
+ <td style="text-align: left;" class="simple_table">To:</td>
474
+ <td style="text-align: center;" class="simple_table">
475
+ <input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php echo $lists['enddate']; ?>" />
476
+ </td>
477
+ <td style="text-align: center;" class="simple_table">
478
+ <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
479
+ </td>
480
+ </tr>
481
+ </table>
482
+ </th>
483
+ <th class="table_medium_col_uncenter submitterip_fc" <?php echo $style_ip; ?>>
484
+ <input type="text" name="ip_search" id="ip_search" value="<?php echo $lists['ip_search']; ?>" onChange="this.form.submit();" />
485
+ </th>
486
+ <th class="table_medium_col_uncenter submitterusername_fc" <?php echo $style_username; ?>>
487
+ <input type="text" name="username_search" id="username_search" value="<?php echo $lists['username_search']; ?>" onChange="this.form.submit();" />
488
+ </th>
489
+ <th class="table_medium_col_uncenter submitteremail_fc" <?php echo $style_useremail; ?>>
490
+ <input type="text" name="useremail_search" id="useremail_search" value="<?php echo $lists['useremail_search']; ?>" onChange="this.form.submit();" />
491
+ </th>
492
+ <?php
493
+ for ($i = 0; $i < count($sorted_label_names); $i++) {
494
+ $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
495
+ if (!$ka_fielderov_search) {
496
+ if ($lists[$form_id . '_' . $sorted_labels_id[$i] . '_search']) {
497
+ $ka_fielderov_search = TRUE;
498
+ }
499
+ }
500
+ switch ($sorted_label_types[$i]) {
501
+ case 'type_mark_map': ?>
502
+ <th class="table_large_col <?php echo $sorted_labels_id[$i]; ?>_fc" <?php echo $styleStr; ?>></th>
503
+ <?php
504
+ break;
505
+ case 'type_paypal_payment_status': ?>
506
+ <th class="table_large_col <?php echo $sorted_labels_id[$i]; ?>_fc" <?php echo $styleStr; ?>>
507
+ <select style="font-size: 11px; margin: 0; padding: 0; height: inherit;" name="<?php echo $form_id . '_' . $sorted_labels_id[$i]; ?>_search" id="<?php echo $form_id.'_'.$sorted_labels_id[$i]; ?>_search" onChange="this.form.submit();" value="<?php echo $lists[$form_id.'_'.$sorted_labels_id[$i].'_search']; ?>" >
508
+ <option value="" ></option>
509
+ <option value="canceled" >Canceled</option>
510
+ <option value="cleared" >Cleared</option>
511
+ <option value="cleared by payment review" >Cleared by payment review</option>
512
+ <option value="completed" >Completed</option>
513
+ <option value="denied" >Denied</option>
514
+ <option value="failed" >Failed</option>
515
+ <option value="held" >Held</option>
516
+ <option value="in progress" >In progress</option>
517
+ <option value="on hold" >On hold</option>
518
+ <option value="paid" >Paid</option>
519
+ <option value="partially refunded" >Partially refunded</option>
520
+ <option value="pending verification" >Pending verification</option>
521
+ <option value="placed" >Placed</option>
522
+ <option value="processing" >Processing</option>
523
+ <option value="refunded" >Refunded</option>
524
+ <option value="refused" >Refused</option>
525
+ <option value="removed" >Removed</option>
526
+ <option value="returned" >Returned</option>
527
+ <option value="reversed" >Reversed</option>
528
+ <option value="temporary hold" >Temporary hold</option>
529
+ <option value="unclaimed" >Unclaimed</option>
530
+ </select>
531
+ <script>
532
+ var element = document.getElementById('<?php echo $form_id.'_'.$sorted_labels_id[$i]; ?>_search');
533
+ element.value = '<?php echo $lists[$form_id.'_'.$sorted_labels_id[$i].'_search']; ?>';
534
+ </script>
535
+ </th>
536
+ <th class="table_large_col payment_info_fc" <?php echo $styleStr2; ?>></th>
537
+ <?php
538
+ break;
539
+ default: ?>
540
+ <th class="<?php echo $sorted_labels_id[$i]; ?>_fc" <?php echo $styleStr; ?>>
541
+ <input name="<?php echo $form_id .'_' . $sorted_labels_id[$i].'_search'; ?>" id="<?php echo $form_id .'_' . $sorted_labels_id[$i].'_search'; ?>" type="text" value="<?php echo $lists[$form_id.'_'.$sorted_labels_id[$i].'_search']; ?>" onChange="this.form.submit();" >
542
+ </th>
543
+ <?php
544
+ break;
545
+ }
546
+ }
547
+ ?>
548
+ </tr>
549
+ </thead>
550
+ <?php
551
+ $k = 0;
552
+ for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
553
+ $i = $group_id_s[$www];
554
+ $alternate = (!isset($alternate) || $alternate == 'class="alternate"') ? '' : 'class="alternate"';
555
+ $temp = $this->model->array_for_group_id($group_id_s[$www], $rows);
556
+ $data = $temp[0];
557
+ $userinfo=get_userdata($data->user_id_wd);
558
+ $useremail=$userinfo ? $userinfo->user_email : "";
559
+ $username=$userinfo ? $userinfo->display_name : "";
560
+ ?>
561
+ <tr <?php echo $alternate; ?>>
562
+ <?php if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))): ?>
563
+ <td class="table_small_col pdf_col sub-align">
564
+ <?php if($pdf_data && isset($pdf_data[$group_id_s[$www]])): ?>
565
+ <a href="<?php echo site_url().'/'.$pdf_data[$group_id_s[$www]]; ?>" style="display: block;" download><img src="<?php echo WD_FM_PDF_URL . '/images/pdf-icon.png'; ?>" /></a>
566
+ <?php endif; ?>
567
+ </td>
568
+ <?php endif; ?>
569
+ <td class="table_small_col count_col sub-align"><?php echo $www + 1; ?></td>
570
+ <td class="check-column table_small_col sub-align" style="padding: 0;">
571
+ <input type="checkbox" name="post[]" value="<?php echo $data->group_id; ?>">
572
+ </td>
573
+ <td class="table_small_col sub-align submitid_fc" id="submitid_fc" <?php echo $style_id; ?>>
574
+ <a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form');" >
575
+ <?php echo $data->group_id; ?>
576
+ </a>
577
+ </td>
578
+ <td class="table_small_col sub-align">
579
+ <a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form');">Edit
580
+ </a>
581
+ </td>
582
+ <td class="table_small_col sub-align">
583
+ <a href="" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form'); } else { return false; }">Delete
584
+ </a>
585
+ </td>
586
+ <td class="table_large_col submitdate_fc sub-align" id="submitdate_fc" <?php echo $style_date; ?>>
587
+ <a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php echo $data->group_id; ?>); fm_form_submit(event, 'admin_form');" ><?php echo $data->date ;?>
588
+ </a>
589
+ </td>
590
+ <td class="table_medium_col_uncenter submitterip_fc sub-align" id="submitterip_fc" <?php echo $style_ip; ?>>
591
+ <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'fromipinfoinpopup_fmc', 'data_ip' => $data->ip, 'width' => '400', 'height' => '300', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>" title="Show submitter information" <?php echo (!in_array($data->ip, $blocked_ips)) ? '' : 'style="color: #FF0000;"'; ?>><?php echo $data->ip; ?></a>
592
+ </td>
593
+ <td class="table_large_col submitterusername_fc sub-align" id="submitterusername_fc" <?php echo $style_username; ?>>
594
+ <?php echo $username; ?>
595
+ </td>
596
+ <td class="table_large_col submitteremail_fc sub-align" id="submitteremail_fc" <?php echo $style_useremail; ?>>
597
+ <?php echo $useremail; ?>
598
+ </td>
599
+ <?php
600
+ for ($h = 0; $h < $m; $h++) {
601
+ $not_label = TRUE;
602
+ for ($g = 0; $g < count($temp); $g++) {
603
+ $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$h]);
604
+ if ($temp[$g]->element_label == $sorted_labels_id[$h]) {
605
+ if (strpos($temp[$g]->element_value, "***map***")) {
606
+ $map_params = explode('***map***', $temp[$g]->element_value);
607
+ ?>
608
+ <td class="table_large_col <?php echo $sorted_labels_id[$h]; ?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
609
+ <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'frommapeditinpopup_fmc', 'long' => $map_params[0], 'lat' => $map_params[1], 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>" title="Show on Map">Show on Map</a>
610
+ </td>
611
+ <?php
612
+ }
613
+ elseif (strpos($temp[$g]->element_value, "*@@url@@*")) {
614
+ ?>
615
+ <td class="<?php echo $sorted_labels_id[$h]; ?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
616
+ <?php
617
+ $new_files = explode("*@@url@@*", $temp[$g]->element_value);
618
+ foreach ($new_files as $new_file) {
619
+ if ($new_file) {
620
+ $new_filename = explode('/', $new_file);
621
+ $new_filename = $new_filename[count($new_filename) - 1];
622
+ ?>
623
+ <a target="_blank" class="fm_fancybox" rel="group_<?php echo $www; ?>" href="<?php echo $new_file; ?>"><?php echo $new_filename; ?></a><br />
624
+ <?php
625
+ }
626
+ }
627
+ ?>
628
+ </td>
629
+ <?php
630
+ }
631
+ elseif (strpos($temp[$g]->element_value, "***star_rating***")) {
632
+ $view_star_rating_array = $this->model->view_for_star_rating($temp[$g]->element_value, $temp[$g]->element_label);
633
+ $stars = $view_star_rating_array[0];
634
+ ?>
635
+ <td align="center" class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>><?php echo $stars; ?></td>
636
+ <?php
637
+ }
638
+ elseif (strpos($temp[$g]->element_value, "***matrix***")) {
639
+ ?>
640
+ <td class="table_large_col <?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
641
+ <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'show_matrix', 'matrix_params' => $temp[$g]->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>" title="Show Matrix">Show Matrix</a>
642
+ </td>
643
+ <?php
644
+ }
645
+ elseif (strpos($temp[$g]->element_value, "@@@") !== FALSE || $temp[$g]->element_value == "@@@" || $temp[$g]->element_value == "@@@@@@@@@") {
646
+ ?>
647
+ <td class="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
648
+ <p><?php echo str_replace("@@@", " ", $temp[$g]->element_value); ?></p>
649
+ </td>
650
+ <?php
651
+ }
652
+ elseif (strpos($temp[$g]->element_value, "***grading***")) {
653
+ $view_grading_array = $this->model->view_for_grading($temp[$g]->element_value);
654
+ $items = $view_grading_array[0];
655
+ ?>
656
+ <td class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
657
+ <p><?php echo $items; ?></p>
658
+ </td>
659
+ <?php
660
+ }
661
+ else {
662
+ if (strpos($temp[$g]->element_value, "***quantity***")) {
663
+ $temp[$g]->element_value = str_replace("***quantity***", " ", $temp[$g]->element_value);
664
+ }
665
+ if (strpos($temp[$g]->element_value, "***property***")) {
666
+ $temp[$g]->element_value = str_replace("***property***", " ", $temp[$g]->element_value);
667
+ }
668
+
669
+ if($sorted_label_types[$h]=="type_submitter_mail"){
670
+ $query = $wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d" AND group_id="%d" AND element_value="verified**%d"', $form_id, $i, $sorted_labels_id[$h]);
671
+ $isverified = $wpdb->get_var($query);
672
+
673
+ if($isverified) { ?>
674
+ <td class="<?php echo $sorted_labels_id[$h];?>_fc" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
675
+ <p><?php echo $temp[$g]->element_value; ?> <span style="color:#2DA068;">( Verified <img src="<?php echo WD_FMC_URL . '/images/verified.png'; ?>" /> )</span></p>
676
+ </td>
677
+ <?php }
678
+ else {?>
679
+ <td class="<?php echo $sorted_labels_id[$h];?>_fc" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
680
+ <p><?php echo $temp[$g]->element_value; ?></p>
681
+ </td>
682
+ <?php }
683
+ }
684
+ else{
685
+ ?>
686
+ <td class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>>
687
+ <p><?php echo str_replace("***br***", '<br>', stripslashes($temp[$g]->element_value)) ; ?></p>
688
+ </td>
689
+ <?php
690
+ }
691
+ }
692
+ $not_label = FALSE;
693
+ }
694
+ }
695
+ if ($not_label) {
696
+ ?>
697
+ <td class="<?php echo $sorted_labels_id[$h];?>_fc sub-align" id="<?php echo $sorted_labels_id[$h]; ?>_fc" <?php echo $styleStr; ?>><p>&nbsp;</p></td>
698
+ <?php
699
+ }
700
+ }
701
+ if ($ispaypal) {
702
+ $styleStr = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
703
+ ?>
704
+ <td class="table_large_col payment_info_fc sub-align" id="payment_info_fc" <?php echo $styleStr; ?>>
705
+ <a class="thickbox-preview" href="<?php echo add_query_arg(array('action' => 'paypal_info', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>">
706
+ <img src="<?php echo WD_FMC_URL . '/images/info.png'; ?>" />
707
+ </a>
708
+ </td>
709
+ <?php
710
+ }
711
+ ?>
712
+ </tr>
713
+ <?php
714
+ $k = 1 - $k;
715
+ }
716
+ ?>
717
+ </table>
718
+ </div>
719
+ <?php
720
+ if ($sorted_label_types) {
721
+ foreach ($sorted_label_types as $key => $sorted_label_type) {
722
+ if ($this->model->check_radio_type($sorted_label_type)) {
723
+ $is_stats = true;
724
+ break;
725
+ }
726
+ }
727
+ if ($is_stats) {
728
+ $ajax_nonce = wp_create_nonce( "nonce_fmc_ajax" );
729
+ ?>
730
+ <br/>
731
+ <div class="fm-statistics">
732
+ <h1>Statistics</h1>
733
+ <table class="stats">
734
+ <tr>
735
+ <td>
736
+ <label for="sorted_label_key">Select a Field:</label>
737
+ </td>
738
+ <td>
739
+ <select id="sorted_label_key">
740
+ <option value="">Select a Field</option>
741
+ <?php
742
+ foreach ($sorted_label_types as $key => $sorted_label_type) {
743
+ if ($sorted_label_type=="type_checkbox" || $sorted_label_type=="type_radio" || $sorted_label_type=="type_own_select" || $sorted_label_type=="type_country" || $sorted_label_type=="type_paypal_select" || $sorted_label_type=="type_paypal_radio" || $sorted_label_type=="type_paypal_checkbox" || $sorted_label_type=="type_paypal_shipping") {
744
+ ?>
745
+ <option value="<?php echo $key; ?>"><?php echo $sorted_label_names_original[$key]; ?></option>
746
+ <?php
747
+ }
748
+ }
749
+ ?>
750
+ </select>
751
+ </td>
752
+ <td></td>
753
+ </tr>
754
+ <tr>
755
+ <td>
756
+ <label>Select a Date:</label>
757
+ </td>
758
+ <td>
759
+ From: <input class="inputbox" type="text" name="startstats" id="startstats" size="9" maxlength="9" />
760
+ <input type="reset" class="button" style="width: 22px;" value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');" />
761
+
762
+ To: <input class="inputbox" type="text" name="endstats" id="endstats" size="9" maxlength="9" />
763
+ <input type="reset" class="button" style="width: 22px;" value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');" />
764
+ </td>
765
+ <td>
766
+ <button onclick="show_stats(); return false;">Show</button>
767
+ </td>
768
+ </tr>
769
+ </table>
770
+
771
+ <div id="div_stats"></div>
772
+ </div>
773
+ <script>
774
+ function show_stats() {
775
+ jQuery('#div_stats').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
776
+ if(jQuery('#sorted_label_key').val()!="") {
777
+ jQuery('#div_stats').load('<?php echo add_query_arg(array('action' => 'get_stats_fmc', 'page' => 'submissions_fmc'), admin_url('admin-ajax.php')); ?>', {
778
+ 'task': 'show_stats',
779
+ 'form_id' : '<?php echo $form_id; ?>',
780
+ 'sorted_label_key' : jQuery('#sorted_label_key').val(),
781
+ 'startdate' : jQuery('#startstats').val(),
782
+ 'enddate' : jQuery('#endstats').val(),
783
+ 'nonce_fmc_ajax': '<?php echo $ajax_nonce; ?>'
784
+ });
785
+ }
786
+ else {
787
+ jQuery('#div_stats').html("<div style='padding:10px 5px; color:red; font-size:14px;'>Please select the field!</div>");
788
+ }
789
+ jQuery("#div_stats").removeClass("fm_loading");
790
+ }
791
+ </script>
792
+ <?php
793
+ }
794
+ }
795
+ ?>
796
+ </div>
797
+ </form>
798
+ <script>
799
+ function fm_scroll(element) {
800
+ var scrollbar= document.createElement('div');
801
+ scrollbar.appendChild(document.createElement('div'));
802
+ scrollbar.style.overflow= 'auto';
803
+ scrollbar.style.overflowY= 'hidden';
804
+ scrollbar.firstChild.style.width= element.scrollWidth+'px';
805
+ scrollbar.firstChild.style.paddingTop= '1px';
806
+ scrollbar.firstChild.appendChild(document.createTextNode('\xA0'));
807
+ scrollbar.onscroll= function() {
808
+ element.scrollLeft= scrollbar.scrollLeft;
809
+ };
810
+ element.onscroll= function() {
811
+ scrollbar.scrollLeft= element.scrollLeft;
812
+ };
813
+ element.parentNode.insertBefore(scrollbar, element);
814
+ }
815
+ jQuery(window).load(function() {
816
+ fm_popup();
817
+ fm_scroll(document.getElementById('fm-scroll'));
818
+ if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
819
+ jQuery(".fm_fancybox").fancybox({
820
+ 'maxWidth ' : 600,
821
+ 'maxHeight' : 500
822
+ });
823
+ }
824
+ });
825
+ <?php if ($ka_fielderov_search) { ?>
826
+ document.getElementById('fields_filter').style.display = '';
827
+ <?php } ?>
828
+ </script>
829
+ <?php
830
+ }
831
+
832
+ public function show_stats($form_id) {
833
+ $key = (isset($_POST['sorted_label_key']) ? esc_html(stripslashes($_POST['sorted_label_key'])) : '');
834
+ $labels_parameters = $this->model->get_labels_parameters($form_id);
835
+ $where_choices = $labels_parameters[7];
836
+ $sorted_label_names_original = $labels_parameters[4];
837
+ $sorted_labels_id = $labels_parameters[0];
838
+ if(count($sorted_labels_id)!=0 && $key < count($sorted_labels_id) ) {
839
+ $choices_params = $this->model->statistic_for_radio($where_choices, $sorted_labels_id[$key]);
840
+ $sorted_label_name_original = $sorted_label_names_original[$key];
841
+ $choices_count = $choices_params[0];
842
+ $choices_labels = $choices_params[1];
843
+ $unanswered = $choices_params[2];
844
+ $all = $choices_params[3];
845
+ $colors = $choices_params[4];
846
+ $choices_colors = $choices_params[5];
847
+ }
848
+ else {
849
+ $choices_labels = array();
850
+ $sorted_label_name_original = '';
851
+ $unanswered = NULL;
852
+ $all = 0;
853
+ }
854
+ ?>
855
+ <br/>
856
+ <br/>
857
+ <div class="field-label"><?php echo stripslashes($sorted_label_name_original); ?></div>
858
+ <table class="adminlist">
859
+ <thead>
860
+ <tr>
861
+ <th width="20%">Choices</th>
862
+ <th>Percentage</th>
863
+ <th width="10%">Count</th>
864
+ </tr>
865
+ </thead>
866
+ <?php
867
+ $k=0;
868
+ foreach ($choices_labels as $key => $choices_label) {
869
+ if (strpos($choices_label, "***quantity***")) {
870
+ $choices_label = str_replace("***quantity***", " ", $choices_label);
871
+ }
872
+ if (strpos($choices_label, "***property***")) {
873
+ $choices_label = str_replace("***property***", " ", $choices_label);
874
+ }
875
+ ?>
876
+ <tr>
877
+ <td class="label<?php echo $k; ?>"><?php echo str_replace("***br***",'<br>', $choices_label)?></td>
878
+ <td>
879
+ <div class="bordered" style="width:<?php echo ($choices_count[$key]/($all-$unanswered))*100; ?>%; height:16px; background-color:<?php echo $colors[$key % 2]; ?>; float: left;">
880
+ </div>
881
+ <div <?php echo ($choices_count[$key]/($all-$unanswered)!=1 ? 'class="bordered'.$k.'"' : "") ?> style="width:<?php echo 100-($choices_count[$key]/($all-$unanswered))*100; ?>%; height:16px; background-color:#F2F0F1; float: left;">
882
+ </div>
883
+ </td>
884
+ <td>
885
+ <div>
886
+ <div style="width: 0; height: 0; border-top: 8px solid transparent;border-bottom: 8px solid transparent; border-right:8px solid <?php echo $choices_colors[$key % 2]; ?>; float:left;">
887
+ </div>
888
+ <div style="background-color:<?php echo $choices_colors[$key % 2]; ?>; height:16px; width:16px; text-align: center; margin-left:8px; color: #fff;">
889
+ <?php echo $choices_count[$key]?>
890
+ </div>
891
+ </div>
892
+ </td>
893
+ </tr>
894
+ <tr>
895
+ <td colspan="3">
896
+ </td>
897
+ </tr>
898
+ <?php
899
+ $k = 1 - $k;
900
+ }
901
+ if($unanswered){
902
+ ?>
903
+ <tr>
904
+ <td colspan="2" style="text-align:right; color: #000;">Unanswered</th>
905
+ <td><strong style="margin-left:10px;"><?php echo $unanswered;?></strong></th>
906
+ </tr>
907
+ <?php
908
+ }
909
+ ?>
910
+ <tr>
911
+ <td colspan="2" style="text-align:right; color: #000;"><strong>Total</strong></th>
912
+ <td><strong style="margin-left:10px;"><?php echo $all;?></strong></th>
913
+ </tr>
914
+ </table>
915
+ <?php
916
+ die();
917
+ }
918
+
919
+ public function edit($id) {
920
+ $current_id = ((isset($id)) ? $id : 0);
921
+ $params = $this->model->get_data_of_group_id($current_id);
922
+ $rows = $params[0];
923
+ $labels_id = $params[1];
924
+ $labels_name = $params[2];
925
+ $labels_type = $params[3];
926
+ $ispaypal = $params[4];
927
+ $userinfo = get_userdata($rows[0]->user_id_wd);
928
+ $username = $userinfo ? $userinfo->display_name : "";
929
+ $useremail = $userinfo ? $userinfo->user_email : "";
930
+
931
+ ?>
932
+ <form action="admin.php?page=submissions_fmc" method="post" id="adminForm" name="adminForm">
933
+ <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
934
+ <table width="99%">
935
+ <tbody>
936
+ <tr>
937
+ <td width="100%"><h2>Edit Submission</h2></td>
938
+ <td align="right">
939
+ <input type="button" onclick="fm_set_input_value('task', 'save');
940
+ fm_set_input_value('current_id', <?php echo $current_id; ?>);
941
+ fm_form_submit(event, 'adminForm');" value="Save" class="button-secondary action">
942
+ </td>
943
+ <td align="right">
944
+ <input type="button" onclick="fm_set_input_value('task', 'apply');
945
+ fm_set_input_value('current_id', <?php echo $current_id ;?>);
946
+ fm_form_submit(event, 'adminForm');" value="Apply" class="button-secondary action">
947
+ </td>
948
+ <td align="right">
949
+ <input type="button" onclick="fm_set_input_value('task', '');fm_form_submit(event, 'adminForm');" value="Cancel" class="button-secondary action">
950
+ </td>
951
+ </tr>
952
+ </tbody>
953
+ </table>
954
+ <table class="admintable">
955
+ <tr>
956
+ <td class="key"><label for="ID">ID: </label></td>
957
+ <td><?php echo $rows[0]->group_id; ?></td>
958
+ </tr>
959
+ <tr>
960
+ <td class="key"><label for="Date">Date: </label></td>
961
+ <td><?php echo $rows[0]->date; ?></td>
962
+ </tr>
963
+ <tr>
964
+ <td class="key"><label for="IP">IP: </label></td>
965
+ <td><?php echo $rows[0]->ip; ?></td>
966
+ </tr>
967
+
968
+
969
+ <tr>
970
+ <td class="key"><label for="Submitter's Username">Submitter's Username: </label></td>
971
+ <td><?php echo $username; ?></td>
972
+ </tr>
973
+ <tr>
974
+ <td class="key"><label for="Submitter's Email Address">Submitter's Email Address: </label></td>
975
+ <td><?php echo $useremail; ?></td>
976
+ </tr>
977
+ <?php
978
+ foreach ($labels_id as $key => $label_id) {
979
+ if ($this->model->check_type_for_edit_function($labels_type[$key])) {
980
+ $element_value = $this->model->check_for_submited_label($rows, $label_id);
981
+ if ($element_value == "continue") {
982
+ continue;
983
+ }
984
+ switch ($labels_type[$key]) {
985
+ case 'type_checkbox':
986
+ $choices = explode('***br***', $element_value);
987
+ $choices = array_slice($choices, 0, count($choices) - 1);
988
+ ?>
989
+ <tr>
990
+ <td class="key" rowspan="<?php echo count($choices); ?>">
991
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
992
+ </td>
993
+ <?php
994
+ foreach ($choices as $choice_key => $choice) {
995
+ ?>
996
+ <td>
997
+ <input type="text" name="submission_<?php echo $label_id.'_'.$choice_key; ?>" id="submission_<?php echo $label_id.'_'.$choice_key; ?>" value="<?php echo $choice; ?>" size="80" />
998
+ </td>
999
+ </tr>
1000
+ <?php
1001
+ }
1002
+ break;
1003
+ case 'type_paypal_payment_status':
1004
+ ?>
1005
+ <tr>
1006
+ <td class="key">
1007
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1008
+ </td>
1009
+ <td>
1010
+ <select name="submission_0" id="submission_0" >
1011
+ <option value=""></option>
1012
+ <option value="Canceled" >Canceled</option>
1013
+ <option value="Cleared" >Cleared</option>
1014
+ <option value="Cleared by payment review" >Cleared by payment review</option>
1015
+ <option value="Completed" >Completed</option>
1016
+ <option value="Denied" >Denied</option>
1017
+ <option value="Failed" >Failed</option>
1018
+ <option value="Held" >Held</option>
1019
+ <option value="In progress" >In progress</option>
1020
+ <option value="On hold" >On hold</option>
1021
+ <option value="Paid" >Paid</option>
1022
+ <option value="Partially refunded" >Partially refunded</option>
1023
+ <option value="Pending verification" >Pending verification</option>
1024
+ <option value="Placed" >Placed</option>
1025
+ <option value="Processing" >Processing</option>
1026
+ <option value="Refunded" >Refunded</option>
1027
+ <option value="Refused" >Refused</option>
1028
+ <option value="Removed" >Removed</option>
1029
+ <option value="Returned" >Returned</option>
1030
+ <option value="Reversed" >Reversed</option>
1031
+ <option value="Temporary hold" >Temporary hold</option>
1032
+ <option value="Unclaimed" >Unclaimed</option>
1033
+ </select>
1034
+ <script>
1035
+ var element = document.getElementById("submission_0");
1036
+ element.value = "<?php echo $element_value; ?>";
1037
+ </script>
1038
+ </td>
1039
+ </tr>
1040
+ <?php
1041
+ break;
1042
+ case 'type_star_rating':
1043
+ $star_rating_array = $this->model->images_for_star_rating($element_value, $label_id);
1044
+ $edit_stars = $star_rating_array[0];
1045
+ $stars_value = $star_rating_array[1];
1046
+ ?>
1047
+ <tr>
1048
+ <td class="key">
1049
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1050
+ </td>
1051
+ <td>
1052
+ <input type="hidden" id="<?php echo $label_id; ?>_star_amountform_id_temp" name="<?php echo $label_id; ?>_star_amountform_id_temp" value="<?php echo $stars_value[0]; ?>">
1053
+ <input type="hidden" name="<?php echo $label_id; ?>_star_colorform_id_temp" id="<?php echo $label_id; ?>_star_colorform_id_temp" value="<?php echo $stars_value[2]; ?>">
1054
+ <input type="hidden" id="<?php echo $label_id; ?>_selected_star_amountform_id_temp" name="<?php echo $label_id; ?>_selected_star_amountform_id_temp" value="<?php echo $stars_value[1]; ?>">
1055
+ <?php echo $edit_stars; ?>
1056
+ <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1057
+ </td>
1058
+ </tr>
1059
+ <?php
1060
+ break;
1061
+ case "type_scale_rating":
1062
+ $scale_rating_array = $this->model->params_for_scale_rating($element_value, $label_id);
1063
+ $scale = $scale_rating_array[0];
1064
+ $scale_radio = $scale_rating_array[1];
1065
+ $checked = $scale_rating_array[2];
1066
+ ?>
1067
+ <tr>
1068
+ <td class="key">
1069
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1070
+ </td>
1071
+ <td>
1072
+ <input type="hidden" id="<?php echo $label_id; ?>_scale_checkedform_id_temp" name="<?php echo $label_id; ?>_scale_checkedform_id_temp" value="<?php echo $scale_radio[1]; ?>">
1073
+ <?php echo $scale; ?>
1074
+ <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1075
+ </td>
1076
+ </tr>
1077
+ <?php
1078
+ break;
1079
+ case 'type_range':
1080
+ $range = $this->model->params_for_type_range($element_value, $label_id);
1081
+ ?>
1082
+ <tr>
1083
+ <td class="key">
1084
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1085
+ </td>
1086
+ <td>
1087
+ <?php echo $range; ?>
1088
+ <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1089
+ </td>
1090
+ </tr>
1091
+ <?php
1092
+ break;
1093
+ case 'type_spinner':
1094
+ ?>
1095
+ <tr>
1096
+ <td class="key">
1097
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1098
+ </td>
1099
+ <td>
1100
+ <input type="text" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo str_replace("*@@url@@*", '', $element_value); ?>" size="20" />
1101
+ </td>
1102
+ </tr>
1103
+ <?php
1104
+ break;
1105
+ case 'type_grading':
1106
+ $type_grading_array = $this->model->params_for_type_grading($element_value, $label_id);
1107
+ $garding = $type_grading_array[0];
1108
+ $garding_value = $type_grading_array[1];
1109
+ $sum = $type_grading_array[2];
1110
+ $items_count = $type_grading_array[3];
1111
+ $element_value1 = $type_grading_array[4];
1112
+ ?>
1113
+ <tr>
1114
+ <td class="key">
1115
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1116
+ </td>
1117
+ <td>
1118
+ <?php echo $garding; ?>
1119
+ <span id="<?php echo $label_id; ?>_grading_sumform_id_temp"><?php echo $sum; ?></span>/<span id="<?php echo $label_id; ?>_grading_totalform_id_temp"><?php echo $garding_value[$items_count]; ?></span><span id="<?php echo $label_id; ?>_text_elementform_id_temp"></span>
1120
+ <input type="hidden" id="<?php echo $label_id; ?>_element_valueform_id_temp" name="<?php echo $label_id; ?>_element_valueform_id_temp" value="<?php echo $element_value1; ?>" />
1121
+ <input type="hidden" id="<?php echo $label_id; ?>_grading_totalform_id_temp" name="<?php echo $label_id; ?>_grading_totalform_id_temp" value="<?php echo $garding_value[$items_count]; ?>" />
1122
+ <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1123
+ </td>
1124
+ </tr>
1125
+ <?php
1126
+ break;
1127
+ case 'type_matrix':
1128
+ $type_matrix_array = $this->model->params_for_type_matrix($element_value, $label_id);
1129
+ $matrix = $type_matrix_array[0];
1130
+ $new_filename = $type_matrix_array[1];
1131
+ ?>
1132
+ <tr>
1133
+ <td class="key">
1134
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1135
+ </td>
1136
+ <td>
1137
+ <input type="hidden" id="<?php echo $label_id; ?>_matrixform_id_temp" name="<?php echo $label_id; ?>_matrixform_id_temp" value="<?php echo $new_filename; ?>">
1138
+ <?php echo $matrix; ?>
1139
+ <input type="hidden" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo $element_value; ?>" size="80" />
1140
+ </td>
1141
+ </tr>
1142
+ <?php
1143
+ break;
1144
+ default:
1145
+ ?>
1146
+ <tr>
1147
+ <td class="key">
1148
+ <label for="title"><?php echo $labels_name[$key]; ?></label>
1149
+ </td>
1150
+ <td>
1151
+ <input type="text" name="submission_<?php echo $label_id; ?>" id="submission_<?php echo $label_id; ?>" value="<?php echo str_replace("*@@url@@*", '', $element_value); ?>" size="80" />
1152
+ </td>
1153
+ </tr>
1154
+ <?php
1155
+ break;
1156
+ }
1157
+ }
1158
+ }
1159
+ ?>
1160
+ </table>
1161
+ <input type="hidden" name="option" value="com_formmaker"/>
1162
+ <input type="hidden" id="current_id" name="current_id" value="<?php echo $rows[0]->group_id; ?>" />
1163
+ <input type="hidden" name="form_id" value="<?php echo $rows[0]->form_id; ?>" />
1164
+ <input type="hidden" name="date" value="<?php echo $rows[0]->date; ?>" />
1165
+ <input type="hidden" name="ip" value="<?php echo $rows[0]->ip; ?>" />
1166
+ <input type="hidden" id="task" name="task" value="" />
1167
+ <input type="hidden" value="<?php echo WD_FMC_URL; ?>" id="form_plugins_url" />
1168
+ <script>
1169
+ plugin_url = document.getElementById('form_plugins_url').value;
1170
+ </script>
1171
+ </form>
1172
+ <?php
1173
+ }
1174
+
1175
+ public function new_edit($id) {
1176
+ $current_id = ((isset($id)) ? $id : 0);
1177
+ $params = $this->model->get_data_of_group_id($current_id);
1178
+ $rows = $params[0];
1179
+ $labels_id = $params[1];
1180
+ $labels_name = $params[2];
1181
+ $labels_type = $params[3];
1182
+ $ispaypal = $params[4];
1183
+ $form = $params[5];
1184
+ $form_theme = $params[6];
1185
+ $userinfo = get_userdata($rows[0]->user_id_wd);
1186
+ $username = $userinfo ? $userinfo->display_name : "";
1187
+ $useremail = $userinfo ? $userinfo->user_email : "";
1188
+ ?>
1189
+ <div class="fm-user-manual">
1190
+ This section allows you to edit form submissions.
1191
+ <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-6.html">Read More in User Manual</a>
1192
+ </div>
1193
+ <div class="fm-upgrade-pro">
1194
+ <a target="_blank" href="https://web-dorado.com/files/fromContactForm.php">
1195
+ <div class="fm-upgrade-img">
1196
+ UPGRADE TO PRO VERSION
1197
+ <span></span>
1198
+ </div>
1199
+ </a>
1200
+ </div>
1201
+ <div class="fm-clear"></div>
1202
+ <form action="admin.php?page=submissions_fmc" method="post" id="formform_id_temp" name="formform_id_temp">
1203
+ <?php wp_nonce_field('nonce_fmc', 'nonce_fmc'); ?>
1204
+ <div class="fm-page-header">
1205
+ <div class="fm-page-title">Edit Submission</div>
1206
+ <div class="fm-page-actions">
1207
+ <button class="fm-button save-button small" onclick="pressbutton(); fm_set_input_value('task', 'save'); fm_set_input_value('current_id', <?php echo $current_id ;?>); fm_form_submit(event, 'formform_id_temp');">
1208
+ <span></span>
1209
+ Save
1210
+ </button>
1211
+ <button class="fm-button apply-button small" onclick="pressbutton(); fm_set_input_value('task', 'apply'); fm_set_input_value('current_id', <?php echo $current_id ;?>); fm_form_submit(event, 'formform_id_temp');">
1212
+ <span></span>
1213
+ Apply
1214
+ </button>
1215
+ <button class="fm-button cancel-button small" onclick="fm_set_input_value('task', '');fm_form_submit(event, 'formform_id_temp');">
1216
+ <span></span>
1217
+ Cancel
1218
+ </button>
1219
+ </div>
1220
+ <div class="fm-clear"></div>
1221
+ </div>
1222
+ <div class="fm-submissins-edit">
1223
+ <table>
1224
+ <tr>
1225
+ <td class="fm-key"><label for="ID">ID: </label></td>
1226
+ <td><?php echo $rows[0]->group_id; ?></td>
1227
+ </tr>
1228
+ <tr>
1229
+ <td class="fm-key"><label for="Date">Date: </label></td>
1230
+ <td><?php echo $rows[0]->date; ?></td>
1231
+ </tr>
1232
+ <tr>
1233
+ <td class="fm-key"><label for="IP">IP: </label></td>
1234
+ <td><?php echo $rows[0]->ip; ?></td>
1235
+ </tr>
1236
+ <tr>
1237
+ <td class="fm-key"><label for="Submitter's Username">Submitter's Username: </label></td>
1238
+ <td><?php echo $username; ?></td>
1239
+ </tr>
1240
+ <tr>
1241
+ <td class="fm-key"><label for="Submitter's Email Address">Submitter's Email Address: </label></td>
1242
+ <td><?php echo $useremail; ?></td>
1243
+ </tr>
1244
+ </table>
1245
+ <?php
1246
+ $css_rep1 = array("[SITE_ROOT]");
1247
+ $css_rep2 = array(WD_FMC_URL);
1248
+ $order = array("\r\n", "\n", "\r");
1249
+ $form_theme = str_replace($order, '', $form_theme);
1250
+ $form_theme = str_replace($css_rep1, $css_rep2, $form_theme);
1251
+ $form_theme = "#form" . $form->id . ' ' . $form_theme;
1252
+ ?>
1253
+ <style>
1254
+ <?php
1255
+ echo $form_theme;
1256
+ ?>
1257
+ .wdform-page-and-images{
1258
+ width: 50%;
1259
+ }
1260
+ .wdform-page-and-images div {
1261
+ background-color: rgba(0, 0, 0, 0);
1262
+ }
1263
+ </style>
1264
+ <?php
1265
+ $form_currency = '$';
1266
+ $check_js = '';
1267
+ $onload_js = '';
1268
+ $onsubmit_js = '';
1269
+ $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
1270
+ $currency_sign = array('$' , '€' , '£' , '¥' , 'C$', 'Mex$', 'HK$', 'Ft' , 'kr' , 'NZ$', 'S$' , 'kr' , 'zl' , 'A$' , 'kr' , 'CHF' , 'Kc', '?' , 'R$' , 'NT$', 'RM' , '?' , '?' );
1271
+ $is_type = array();
1272
+ $id1s = array();
1273
+ $types = array();
1274
+ $labels = array();
1275
+ $paramss = array();
1276
+ $fields = explode('*:*new_field*:*', $form->form_fields);
1277
+ $fields = array_slice($fields, 0, count($fields) - 1);
1278
+ foreach ($fields as $field) {
1279
+ $temp = explode('*:*id*:*',$field);
1280
+ array_push($id1s, $temp[0]);
1281
+ $temp = explode('*:*type*:*', $temp[1]);
1282
+ array_push($types, $temp[0]);
1283
+ $temp = explode('*:*w_field_label*:*', $temp[1]);
1284
+ array_push($labels, $temp[0]);
1285
+ array_push($paramss, $temp[1]);
1286
+ }
1287
+ $form = $form->form_front;
1288
+ $form_id = 'form_id_temp';
1289
+ $start = 0;
1290
+ foreach ($id1s as $id1s_key => $id1) {
1291
+ $label = $labels[$id1s_key];
1292
+ $type = $types[$id1s_key];
1293
+ $params = $paramss[$id1s_key];
1294
+ if ($type != 'type_address') {
1295
+ foreach ($rows as $row) {
1296
+ if ($row->element_label == $id1) {
1297
+ $element_value = $row->element_value;
1298
+ break;
1299
+ }
1300
+ else {
1301
+ $element_value = '';
1302
+ }
1303
+ }
1304
+ }
1305
+ else {
1306
+ for ($i = 0; $i < 6; $i++) {
1307
+ $address_value = '';
1308
+ foreach ($rows as $row) {
1309
+ if ($row->element_label == (string)((int) $id1 + $i)) {
1310
+ $address_value = $row->element_value;
1311
+ }
1312
+ }
1313
+ $elements_of_address[$i] = $address_value;
1314
+ }
1315
+ }
1316
+ if (strpos($form, '%' . $id1 . ' - ' . $label . '%')) {
1317
+ $rep = '';
1318
+ $param = array();
1319
+ $param['attributes'] = '';
1320
+ $is_type[$type] = TRUE;
1321
+ switch ($type) {
1322
+ case 'type_section_break':
1323
+ case 'type_editor':
1324
+ case 'type_file_upload':
1325
+ case 'type_captcha':
1326
+ case 'type_recaptcha':
1327
+ case 'type_mark_map':
1328
+ case 'type_map':
1329
+ case 'type_submit_reset':
1330
+ case 'type_button':
1331
+ case 'type_paypal_total':
1332
+ break;
1333
+
1334
+ case 'type_text': {
1335
+ $params_names = array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique');
1336
+ $temp = $params;
1337
+ foreach ($params_names as $params_name ) {
1338
+ $temp = explode('*:*'.$params_name.'*:*', $temp);
1339
+ $param[$params_name] = $temp[0];
1340
+ $temp = $temp[1];
1341
+ }
1342
+ if ($temp) {
1343
+ $temp = explode('*:*w_attr_name*:*', $temp);
1344
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1345
+ foreach ($attrs as $attr) {
1346
+ $param['attributes'] = $param['attributes'].' '.$attr;
1347
+ }
1348
+ }
1349
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size']+$param['w_size'] : max($param['w_field_label_size'],$param['w_size']));
1350
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "display:block;");
1351
+ $rep ='<div type="type_text" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1352
+ $rep.='</div><div class="wdform-element-section" style="width: '.$param['w_size'].'px;" ><input type="text" class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1353
+ break;
1354
+ }
1355
+
1356
+ case 'type_number': {
1357
+ $params_names = array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique','w_class');
1358
+ $temp = $params;
1359
+ foreach ($params_names as $params_name ) {
1360
+ $temp = explode('*:*'.$params_name.'*:*', $temp);
1361
+ $param[$params_name] = $temp[0];
1362
+ $temp = $temp[1];
1363
+ }
1364
+ if ($temp) {
1365
+ $temp =explode('*:*w_attr_name*:*',$temp);
1366
+ $attrs = array_slice($temp,0, count($temp)-1);
1367
+ foreach($attrs as $attr)
1368
+ $param['attributes'] = $param['attributes'].' '.$attr;
1369
+ }
1370
+
1371
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size'] : max($param['w_field_label_size'],$param['w_size']));
1372
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1373
+
1374
+ $rep ='<div type="type_number" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" class="'.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1375
+
1376
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><input type="text" class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1377
+
1378
+ break;
1379
+ }
1380
+
1381
+ case 'type_password': {
1382
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_required','w_unique','w_class');
1383
+ $temp=$params;
1384
+
1385
+ foreach($params_names as $params_name ) {
1386
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1387
+ $param[$params_name] = $temp[0];
1388
+ $temp=$temp[1];
1389
+ }
1390
+
1391
+ if($temp) {
1392
+ $temp =explode('*:*w_attr_name*:*',$temp);
1393
+ $attrs = array_slice($temp,0, count($temp)-1);
1394
+ foreach($attrs as $attr)
1395
+ $param['attributes'] = $param['attributes'].' '.$attr;
1396
+ }
1397
+
1398
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size'] : max($param['w_field_label_size'],$param['w_size']));
1399
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1400
+
1401
+
1402
+ $rep ='<div type="type_password" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" class="'.$param['w_class'].'" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1403
+
1404
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><input type="password" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1405
+
1406
+
1407
+ break;
1408
+ }
1409
+
1410
+ case 'type_textarea': {
1411
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size_w','w_size_h','w_first_val','w_title','w_required','w_unique','w_class');
1412
+ $temp=$params;
1413
+
1414
+ foreach($params_names as $params_name ) {
1415
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1416
+ $param[$params_name] = $temp[0];
1417
+ $temp=$temp[1];
1418
+ }
1419
+
1420
+
1421
+ if($temp) {
1422
+ $temp =explode('*:*w_attr_name*:*',$temp);
1423
+ $attrs = array_slice($temp,0, count($temp)-1);
1424
+ foreach($attrs as $attr)
1425
+ $param['attributes'] = $param['attributes'].' '.$attr;
1426
+ }
1427
+
1428
+
1429
+
1430
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size_w'] : max($param['w_field_label_size'],$param['w_size_w']));
1431
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1432
+
1433
+
1434
+ $rep ='<div type="type_textarea" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1435
+
1436
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size_w'].'px"><textarea class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" title="'.$param['w_title'].'" style="width: 100%; height: '.$param['w_size_h'].'px;" '.$param['attributes'].'>'.$element_value.'</textarea></div></div>';
1437
+
1438
+
1439
+
1440
+ break;
1441
+ }
1442
+
1443
+ case 'type_wdeditor': {
1444
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size_w','w_size_h','w_title','w_required','w_class');
1445
+ $temp=$params;
1446
+
1447
+ foreach($params_names as $params_name ) {
1448
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1449
+ $param[$params_name] = $temp[0];
1450
+ $temp=$temp[1];
1451
+ }
1452
+
1453
+ if($temp) {
1454
+ $temp =explode('*:*w_attr_name*:*',$temp);
1455
+ $attrs = array_slice($temp,0, count($temp)-1);
1456
+ foreach($attrs as $attr)
1457
+ $param['attributes'] = $param['attributes'].' '.$attr;
1458
+ }
1459
+
1460
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? $param['w_field_label_size']+$param['w_size_w']+10 : max($param['w_field_label_size'],$param['w_size_w']));
1461
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1462
+
1463
+ $rep ='<div type="type_wdeditor" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1464
+
1465
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size_w'].'px">';
1466
+
1467
+ if(user_can_richedit()) {
1468
+ ob_start();
1469
+ wp_editor($element_value, 'wdform_'.$id1.'_wd_editor'.$form_id, array('teeny' => FALSE, 'media_buttons' => FALSE, 'textarea_rows' => 5));
1470
+ $wd_editor = ob_get_clean();
1471
+ }
1472
+ else {
1473
+ $wd_editor='
1474
+ <textarea class="'.$param['w_class'].'" name="wdform_'.$id1.'_wd_editor'.$form_id.'" id="wdform_'.$id1.'_wd_editor'.$form_id.'" style="width: '.$param['w_size_w'].'px; height: '.$param['w_size_h'].'px; " class="mce_editable" aria-hidden="true">'.$element_value.'</textarea>';
1475
+ }
1476
+
1477
+ $rep.= $wd_editor.'</div></div>';
1478
+
1479
+ break;
1480
+ }
1481
+
1482
+ case 'type_phone': {
1483
+
1484
+ if($element_value=='')
1485
+ $element_value = ' ';
1486
+
1487
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_mini_labels','w_required','w_unique', 'w_class');
1488
+ $temp=$params;
1489
+
1490
+ foreach($params_names as $params_name ) {
1491
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1492
+ $param[$params_name] = $temp[0];
1493
+ $temp=$temp[1];
1494
+ }
1495
+
1496
+ if($temp) {
1497
+ $temp =explode('*:*w_attr_name*:*',$temp);
1498
+ $attrs = array_slice($temp,0, count($temp)-1);
1499
+ foreach($attrs as $attr)
1500
+ $param['attributes'] = $param['attributes'].' '.$attr;
1501
+ }
1502
+
1503
+ $element_value = explode(' ',$element_value);
1504
+
1505
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']+65) : max($param['w_field_label_size'],($param['w_size']+65)));
1506
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1507
+
1508
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
1509
+
1510
+ $rep ='<div type="type_phone" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label" >'.$label.'</span>';
1511
+
1512
+ $rep.='
1513
+ </div>
1514
+ <div class="wdform-element-section '.$param['w_class'].'" style="width: '.($param['w_size']+65).'px;">
1515
+ <div style="display: table-cell;vertical-align: middle;">
1516
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_first'.$form_id.'" name="wdform_'.$id1.'_element_first'.$form_id.'" value="'.$element_value[0].'" style="width: 50px;" '.$param['attributes'].'></div>
1517
+ <div><label class="mini_label">'.$w_mini_labels[0].'</label></div>
1518
+ </div>
1519
+ <div style="display: table-cell;vertical-align: middle;">
1520
+ <div class="wdform_line" style="margin: 0px 4px 10px 4px; padding: 0px;">-</div>
1521
+ </div>
1522
+ <div style="display: table-cell;vertical-align: middle; width:100%;">
1523
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_last'.$form_id.'" name="wdform_'.$id1.'_element_last'.$form_id.'" value="'.$element_value[1].'" style="width: 100%;" '.$param['attributes'].'></div>
1524
+ <div><label class="mini_label">'.$w_mini_labels[1].'</label></div>
1525
+ </div>
1526
+ </div>
1527
+ </div>';
1528
+
1529
+ break;
1530
+ }
1531
+
1532
+ case 'type_name': {
1533
+
1534
+ if($element_value =='')
1535
+ $element_value = '@@@';
1536
+
1537
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
1538
+ $temp = $params;
1539
+ if(strpos($temp, 'w_name_fields') > -1)
1540
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields');
1541
+
1542
+ foreach($params_names as $params_name ) {
1543
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1544
+ $param[$params_name] = $temp[0];
1545
+ $temp=$temp[1];
1546
+ }
1547
+
1548
+
1549
+ if($temp) {
1550
+ $temp = explode('*:*w_attr_name*:*',$temp);
1551
+ $attrs = array_slice($temp,0, count($temp)-1);
1552
+ foreach($attrs as $attr)
1553
+ $param['attributes'] = $param['attributes'].' '.$attr;
1554
+ }
1555
+
1556
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
1557
+ $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
1558
+ $w_name_fields = explode('***', $param['w_name_fields']);
1559
+ $element_value = explode('@@@', $element_value);
1560
+
1561
+ if($w_name_fields[0]== 'no' && $w_name_fields[1]== 'no' ) {
1562
+ $w_name_format = '
1563
+ <div style="display: table-cell; width:50%">
1564
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_first'.$form_id.'" name="wdform_'.$id1.'_element_first'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[0] : $element_value[1]).'" style="width: 100%;"'.$param['attributes'].'></div>
1565
+ <div><label class="mini_label">'.$w_mini_labels[1].'</label></div>
1566
+ </div>
1567
+ <div style="display:table-cell;"><div style="margin: 0px 8px; padding: 0px;"></div></div>
1568
+ <div style="display: table-cell; width:50%">
1569
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_last'.$form_id.'" name="wdform_'.$id1.'_element_last'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[1] : $element_value[2]).'" style="width: 100%;" '.$param['attributes'].'></div>
1570
+ <div><label class="mini_label">'.$w_mini_labels[2].'</label></div>
1571
+ </div>
1572
+ ';
1573
+ $w_size=2*$param['w_size'];
1574
+ }
1575
+ else {
1576
+ $first_last_size = $w_name_fields[0] == 'yes' && $w_name_fields[1] == 'no' ? 45 : 30;
1577
+ $w_name_format = '
1578
+ <div style="display: table-cell; width:30%">
1579
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_first'.$form_id.'" name="wdform_'.$id1.'_element_first'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[0] : $element_value[1]).'" style="width:100%;"></div>
1580
+ <div><label class="mini_label">'.$w_mini_labels[1].'</label></div>
1581
+ </div>
1582
+ <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1583
+ <div style="display: table-cell; width:30%">
1584
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_last'.$form_id.'" name="wdform_'.$id1.'_element_last'.$form_id.'" value="'.(count($element_value)==2 ? $element_value[1] : $element_value[2]).'" style="width: 100%;"></div>
1585
+ <div><label class="mini_label">'.$w_mini_labels[2].'</label></div>
1586
+ </div>';
1587
+ $w_size = 2*$param['w_size'];
1588
+
1589
+ if($w_name_fields[0] == 'yes') {
1590
+ $w_name_format = '
1591
+ <div style="display: table-cell;">
1592
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_title'.$form_id.'" name="wdform_'.$id1.'_element_title'.$form_id.'" value="'.(count($element_value)==2 ? "" : $element_value[0]).'" style="width: 40px;"></div>
1593
+ <div><label class="mini_label">'.$w_mini_labels[0].'</label></div>
1594
+ </div>
1595
+ <div style="display:table-cell;"><div style="margin: 0px 1px; padding: 0px;"></div></div>'.$w_name_format;
1596
+ $w_size += 80;
1597
+ }
1598
+ if($w_name_fields[1] == 'yes') {
1599
+ $w_name_format = $w_name_format.'
1600
+ <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1601
+ <div style="display: table-cell; width:30%">
1602
+ <div><input type="text" class="" id="wdform_'.$id1.'_element_middle'.$form_id.'" name="wdform_'.$id1.'_element_middle'.$form_id.'" value="'.(count($element_value)==2 ? "" : $element_value[3]).'"style="width: 100%;"></div>
1603
+ <div><label class="mini_label">'.$w_mini_labels[3].'</label></div>
1604
+ </div>
1605
+ ';
1606
+ $w_size += $param['w_size'];
1607
+ }
1608
+ }
1609
+
1610
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$w_size) : max($param['w_field_label_size'],$w_size));
1611
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1612
+
1613
+ $rep ='<div type="type_name" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1614
+
1615
+ $rep.='</div>
1616
+ <div class="wdform-element-section '.$param['w_class'].'" style="width: '.$w_size.'px;">'.$w_name_format.'</div></div>';
1617
+
1618
+ break;
1619
+ }
1620
+
1621
+ case 'type_address': {
1622
+ $params_names = array('w_field_label_size','w_field_label_pos','w_size','w_mini_labels','w_disabled_fields','w_required','w_class');
1623
+ $temp = $params;
1624
+ foreach($params_names as $params_name ) {
1625
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1626
+ $param[$params_name] = $temp[0];
1627
+ $temp=$temp[1];
1628
+ }
1629
+
1630
+ if($temp) {
1631
+ $temp =explode('*:*w_attr_name*:*',$temp);
1632
+ $attrs = array_slice($temp,0, count($temp)-1);
1633
+ foreach($attrs as $attr)
1634
+ $param['attributes'] = $param['attributes'].' '.$attr;
1635
+ }
1636
+
1637
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1638
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1639
+
1640
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
1641
+ $w_disabled_fields = explode('***',$param['w_disabled_fields']);
1642
+
1643
+ $rep ='<div type="type_address" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1644
+
1645
+ $address_fields ='';
1646
+ $g=0;
1647
+ if (isset($w_disabled_fields[0]) && $w_disabled_fields[0]=='no') {
1648
+ $g+=2;
1649
+ $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_'.$id1.'_street1'.$form_id.'" name="wdform_'.$id1.'_street1'.$form_id.'" value="'.$elements_of_address[0].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label" >'.$w_mini_labels[0].'</label></span>';
1650
+ }
1651
+ if (isset($w_disabled_fields[1]) && $w_disabled_fields[1]=='no') {
1652
+ $g+=2;
1653
+ $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_'.$id1.'_street2'.$form_id.'" name="wdform_'.($id1+1).'_street2'.$form_id.'" value="'.$elements_of_address[1].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label" >'.$w_mini_labels[1].'</label></span>';
1654
+ }
1655
+ if (isset($w_disabled_fields[2]) && $w_disabled_fields[2]=='no') {
1656
+ $g++;
1657
+ $address_fields .= '<span style="float: left; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_'.$id1.'_city'.$form_id.'" name="wdform_'.($id1+2).'_city'.$form_id.'" value="'.$elements_of_address[2].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label" >'.$w_mini_labels[2].'</label></span>';
1658
+ }
1659
+ if (isset($w_disabled_fields[3]) && $w_disabled_fields[3]=='no') {
1660
+ $g++;
1661
+ $w_states = array("","Alabama","Alaska", "Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
1662
+ $w_state_options = '';
1663
+ foreach($w_states as $w_state) {
1664
+ if($w_state == $elements_of_address[3])
1665
+ $selected = 'selected=\"selected\"';
1666
+ else
1667
+ $selected = '';
1668
+ $w_state_options .= '<option value="'.$w_state.'" '.$selected.'>'.$w_state.'</option>';
1669
+ }
1670
+ if(isset($w_disabled_fields[5]) && $w_disabled_fields[5]=='yes' && isset($w_disabled_fields[6]) && $w_disabled_fields[6]=='yes') {
1671
+ $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><select type="text" id="wdform_'.$id1.'_state'.$form_id.'" name="wdform_'.($id1+3).'_state'.$form_id.'" style="width: 100%;" '.$param['attributes'].'>'.$w_state_options.'</select><label class="mini_label" style="display: block;" id="'.$id1.'_mini_label_state">'.$w_mini_labels[3].'</label></span>';
1672
+ }
1673
+ else
1674
+ $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_'.$id1.'_state'.$form_id.'" name="wdform_'.($id1+3).'_state'.$form_id.'" value="'.$elements_of_address[3].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label">'.$w_mini_labels[3].'</label></span>';
1675
+ }
1676
+ if (isset($w_disabled_fields[4]) && $w_disabled_fields[4]=='no') {
1677
+ $g++;
1678
+ $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_'.$id1.'_postal'.$form_id.'" name="wdform_'.($id1+4).'_postal'.$form_id.'" value="'.$elements_of_address[4].'" style="width: 100%;" '.$param['attributes'].'><label class="mini_label">'.$w_mini_labels[4].'</label></span>';
1679
+ }
1680
+ $w_countries = array("","Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo (Brazzaville)","Congo","Costa Rica","Cote d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor (Timor Timur)","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia, The","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea, North","Korea, South","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and Montenegro","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe");
1681
+ $w_options = '';
1682
+ foreach($w_countries as $w_country) {
1683
+ if($w_country == $elements_of_address[5])
1684
+ $selected = 'selected="selected"';
1685
+ else
1686
+ $selected = '';
1687
+ $w_options .= '<option value="'.$w_country.'" '.$selected.'>'.$w_country.'</option>';
1688
+ }
1689
+
1690
+ if (isset($w_disabled_fields[5]) && $w_disabled_fields[5]=='no') {
1691
+ $g++;
1692
+ $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;display: inline-block;"><select type="text" id="wdform_'.$id1.'_country'.$form_id.'" name="wdform_'.($id1+5).'_country'.$form_id.'" style="width:100%" '.$param['attributes'].'>'.$w_options.'</select><label class="mini_label">'.$w_mini_labels[5].'</span>';
1693
+ }
1694
+
1695
+
1696
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><div>
1697
+ '.$address_fields.'</div></div></div>';
1698
+ break;
1699
+ }
1700
+
1701
+ case 'type_submitter_mail': {
1702
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique', 'w_class');
1703
+ $temp=$params;
1704
+
1705
+ foreach($params_names as $params_name ) {
1706
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1707
+ $param[$params_name] = $temp[0];
1708
+ $temp=$temp[1];
1709
+ }
1710
+
1711
+
1712
+ if($temp) {
1713
+ $temp =explode('*:*w_attr_name*:*',$temp);
1714
+ $attrs = array_slice($temp,0, count($temp)-1);
1715
+ foreach($attrs as $attr)
1716
+ $param['attributes'] = $param['attributes'].' '.$attr;
1717
+ }
1718
+
1719
+
1720
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1721
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1722
+
1723
+ $rep ='<div type="type_submitter_mail" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1724
+
1725
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><input type="text" class="" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" title="'.$param['w_title'].'" style="width: 100%;" '.$param['attributes'].'></div></div>';
1726
+
1727
+
1728
+
1729
+ break;
1730
+ }
1731
+
1732
+ case 'type_checkbox':
1733
+
1734
+ {
1735
+
1736
+
1737
+
1738
+ $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num','w_class');
1739
+
1740
+ $temp=$params;
1741
+
1742
+ if(strpos($temp, 'w_field_option_pos') > -1)
1743
+
1744
+ $params_names=array('w_field_label_size','w_field_label_pos','w_field_option_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num', 'w_value_disabled','w_choices_value', 'w_choices_params', 'w_class');
1745
+
1746
+
1747
+
1748
+ foreach($params_names as $params_name )
1749
+
1750
+ {
1751
+
1752
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1753
+
1754
+ $param[$params_name] = $temp[0];
1755
+
1756
+ $temp=$temp[1];
1757
+
1758
+ }
1759
+
1760
+
1761
+
1762
+ if($temp)
1763
+
1764
+ {
1765
+
1766
+ $temp =explode('*:*w_attr_name*:*',$temp);
1767
+
1768
+ $attrs = array_slice($temp,0, count($temp)-1);
1769
+
1770
+ foreach($attrs as $attr)
1771
+
1772
+ $param['attributes'] = $param['attributes'].' '.$attr;
1773
+
1774
+ }
1775
+
1776
+
1777
+
1778
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
1779
+
1780
+ if(!isset($param['w_value_disabled']))
1781
+
1782
+ $param['w_value_disabled'] = 'no';
1783
+
1784
+
1785
+
1786
+ if(!isset($param['w_field_option_pos']))
1787
+
1788
+ $param['w_field_option_pos'] = 'left';
1789
+
1790
+
1791
+
1792
+ $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
1793
+
1794
+ $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
1795
+
1796
+
1797
+
1798
+ $param['w_choices'] = explode('***',$param['w_choices']);
1799
+
1800
+ if(isset($param['w_choices_value']))
1801
+
1802
+ {
1803
+
1804
+ $param['w_choices_value'] = explode('***',$param['w_choices_value']);
1805
+
1806
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1807
+
1808
+ }
1809
+
1810
+
1811
+
1812
+ $element_value = explode('***br***',$element_value);
1813
+
1814
+ $element_value = array_slice($element_value,0, count($element_value)-1);
1815
+
1816
+ $is_other=false;
1817
+
1818
+ $other_value = '';
1819
+
1820
+
1821
+
1822
+ foreach($element_value as $key => $value)
1823
+
1824
+ {
1825
+
1826
+ if(!in_array($value, ($param['w_value_disabled']=='no' ? $param['w_choices'] : (isset($param['w_choices_value']) ? $param['w_choices_value'] : array()))))
1827
+
1828
+ {
1829
+
1830
+ $other_value = $value;
1831
+
1832
+ $is_other=true;
1833
+
1834
+ break;
1835
+
1836
+ }
1837
+
1838
+ }
1839
+
1840
+
1841
+
1842
+ $rep='<div type="type_checkbox" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
1843
+
1844
+
1845
+
1846
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
1847
+
1848
+
1849
+
1850
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
1851
+
1852
+ $total_queries = 0;
1853
+
1854
+ foreach($param['w_choices'] as $key => $choice)
1855
+
1856
+ {
1857
+
1858
+ $key1 = $key + $total_queries;
1859
+
1860
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1861
+
1862
+ {
1863
+
1864
+ $choices_labels =array();
1865
+ $choices_values = array();
1866
+
1867
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1868
+ $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
1869
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1870
+
1871
+ $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
1872
+ $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
1873
+
1874
+
1875
+
1876
+ $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
1877
+
1878
+ $table = $label_table_and_column[0];
1879
+
1880
+ $label_column = $label_table_and_column[1];
1881
+
1882
+ if($label_column)
1883
+
1884
+ {
1885
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1886
+
1887
+ }
1888
+
1889
+
1890
+
1891
+ $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_value'][$key]));
1892
+
1893
+ $value_column = $value_table_and_column[1];
1894
+
1895
+
1896
+
1897
+ if($value_column)
1898
+
1899
+ {
1900
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1901
+
1902
+ }
1903
+
1904
+ $columns_count_checkbox = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
1905
+
1906
+
1907
+
1908
+ if(array_filter($choices_labels) || array_filter($choices_values))
1909
+
1910
+ {
1911
+
1912
+ $total_queries = $total_queries + $columns_count_checkbox-1;
1913
+
1914
+
1915
+
1916
+ if(!isset($post_value))
1917
+
1918
+ $param['w_choices_checked'][$key]=($param['w_choices_checked'][$key]=='true' ? 'checked="checked"' : '');
1919
+
1920
+
1921
+
1922
+ for($k=0; $k<$columns_count_checkbox; $k++)
1923
+
1924
+ {
1925
+
1926
+ $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1927
+
1928
+ $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
1929
+
1930
+ if(($key1+$k)%$param['w_rowcol']==0 && ($key1+$k)>0)
1931
+
1932
+ $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
1933
+
1934
+
1935
+
1936
+ $checked=(in_array($choice_value, $element_value) ? 'checked="checked"' : '');
1937
+
1938
+
1939
+
1940
+ $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" '.$param['w_field_option_pos1'].'>'.$choice_label.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" value="'.htmlspecialchars($choice_value).'" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'onclick="if(set_checked(&quot;wdform_'.$id1.'&quot;,&quot;'.($key1+$k).'&quot;,&quot;'.$form_id.'&quot;)) show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);"' : '').' '.$param['attributes'].' '.$checked.'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
1941
+
1942
+
1943
+
1944
+ }
1945
+
1946
+ }
1947
+
1948
+ }
1949
+
1950
+ else
1951
+
1952
+ {
1953
+
1954
+ if($key1%$param['w_rowcol']==0 && $key1>0)
1955
+
1956
+ $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
1957
+
1958
+
1959
+
1960
+ $checked=(in_array($choice, $element_value) ? 'checked="checked"' : '');
1961
+
1962
+
1963
+
1964
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key && $is_other)
1965
+
1966
+ $checked = 'checked="checked"';
1967
+
1968
+
1969
+
1970
+
1971
+
1972
+ $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'" '.$param['w_field_option_pos1'].'>'.$choice.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.''.$key1.'" value="'.htmlspecialchars($choice).'" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'onclick="if(set_checked(&quot;wdform_'.$id1.'&quot;,&quot;'.$key1.'&quot;,&quot;'.$form_id.'&quot;)) show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);"' : '').' '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
1973
+
1974
+
1975
+
1976
+ $param['w_allow_other_num'] = $param['w_allow_other_num']==$key ? $key1 : $param['w_allow_other_num'];
1977
+
1978
+ }
1979
+
1980
+ }
1981
+
1982
+ $rep.='</div>';
1983
+
1984
+
1985
+
1986
+ $rep.='</div></div>';
1987
+
1988
+
1989
+
1990
+
1991
+
1992
+ if($is_other)
1993
+
1994
+ $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.$other_value.'");';
1995
+
1996
+
1997
+
1998
+ $onsubmit_js.='
1999
+
2000
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#adminForm");
2001
+
2002
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#adminForm");
2003
+
2004
+ ';
2005
+
2006
+
2007
+
2008
+ break;
2009
+
2010
+ }
2011
+
2012
+ case 'type_radio':
2013
+
2014
+ {
2015
+
2016
+
2017
+
2018
+
2019
+
2020
+ $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num','w_class');
2021
+
2022
+ $temp=$params;
2023
+
2024
+ if(strpos($temp, 'w_field_option_pos') > -1)
2025
+
2026
+ $params_names=array('w_field_label_size','w_field_label_pos','w_field_option_pos','w_flow','w_choices','w_choices_checked','w_rowcol', 'w_required','w_randomize','w_allow_other','w_allow_other_num','w_value_disabled','w_choices_value', 'w_choices_params','w_class');
2027
+
2028
+
2029
+
2030
+ foreach($params_names as $params_name )
2031
+
2032
+ {
2033
+
2034
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2035
+
2036
+ $param[$params_name] = $temp[0];
2037
+
2038
+ $temp=$temp[1];
2039
+
2040
+ }
2041
+
2042
+
2043
+
2044
+ if($temp)
2045
+
2046
+ {
2047
+
2048
+ $temp =explode('*:*w_attr_name*:*',$temp);
2049
+
2050
+ $attrs = array_slice($temp,0, count($temp)-1);
2051
+
2052
+ foreach($attrs as $attr)
2053
+
2054
+ $param['attributes'] = $param['attributes'].' '.$attr;
2055
+
2056
+ }
2057
+
2058
+ if(!isset($param['w_value_disabled']))
2059
+
2060
+ $param['w_value_disabled'] = 'no';
2061
+
2062
+
2063
+
2064
+ if(!isset($param['w_field_option_pos']))
2065
+
2066
+ $param['w_field_option_pos'] = 'left';
2067
+
2068
+
2069
+
2070
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2071
+
2072
+ $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
2073
+
2074
+ $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
2075
+
2076
+
2077
+
2078
+ $param['w_choices'] = explode('***',$param['w_choices']);
2079
+
2080
+ if(isset($param['w_choices_value']))
2081
+
2082
+ {
2083
+
2084
+ $param['w_choices_value'] = explode('***',$param['w_choices_value']);
2085
+
2086
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2087
+
2088
+ }
2089
+
2090
+
2091
+
2092
+ $is_other=true;
2093
+
2094
+
2095
+
2096
+ foreach($param['w_choices'] as $key => $choice)
2097
+
2098
+ {
2099
+
2100
+ $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
2101
+
2102
+ if($choice_value==$element_value)
2103
+
2104
+ {
2105
+
2106
+ $is_other=false;
2107
+
2108
+ break;
2109
+
2110
+ }
2111
+
2112
+ }
2113
+
2114
+
2115
+
2116
+ $rep='<div type="type_radio" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2117
+
2118
+
2119
+
2120
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
2121
+
2122
+
2123
+
2124
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
2125
+
2126
+ $total_queries =0;
2127
+
2128
+ foreach($param['w_choices'] as $key => $choice)
2129
+
2130
+ {
2131
+
2132
+ $key1 = $key + $total_queries;
2133
+
2134
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2135
+
2136
+ {
2137
+
2138
+ $choices_labels =array();
2139
+ $choices_values =array();
2140
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2141
+ $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
2142
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2143
+ $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
2144
+ $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
2145
+
2146
+ $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
2147
+
2148
+ $table = $label_table_and_column[0];
2149
+
2150
+ $label_column = $label_table_and_column[1];
2151
+
2152
+ if($label_column) {
2153
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
2154
+ }
2155
+
2156
+
2157
+
2158
+ $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_value'][$key]));
2159
+
2160
+ $value_column = $value_table_and_column[1];
2161
+
2162
+
2163
+
2164
+ if($value_column) {
2165
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
2166
+ }
2167
+
2168
+
2169
+
2170
+ $columns_count_radio = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
2171
+
2172
+ if(array_filter($choices_labels) || array_filter($choices_values))
2173
+
2174
+ {
2175
+
2176
+ $total_queries = $total_queries + $columns_count_radio-1;
2177
+
2178
+
2179
+
2180
+ for($k=0; $k<$columns_count_radio; $k++)
2181
+
2182
+ {
2183
+
2184
+ $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
2185
+
2186
+ $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
2187
+
2188
+
2189
+
2190
+ if(($key1+$k)%$param['w_rowcol']==0 && ($key1+$k)>0)
2191
+
2192
+ $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
2193
+
2194
+
2195
+
2196
+ $checked =($choice_value==$element_value ? 'checked="checked"' : '');
2197
+
2198
+ if($choice_value==$element_value)
2199
+
2200
+ $is_other=false;
2201
+
2202
+
2203
+
2204
+ $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" '.$param['w_field_option_pos1'].'>'.$choice_label.'</label><div class="radio-div forlabs" '.$param['w_field_option_pos2'].'><input type="radio" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.htmlspecialchars($choice_value).'" onclick="set_default(&quot;wdform_'.$id1.'&quot;,&quot;'.($key1+$k).'&quot;,&quot;'.$form_id.'&quot;); '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);' : '').'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
2205
+
2206
+
2207
+
2208
+ }
2209
+
2210
+ }
2211
+
2212
+ }
2213
+
2214
+ else
2215
+
2216
+ {
2217
+
2218
+ if($key1%$param['w_rowcol']==0 && $key1>0)
2219
+
2220
+ $rep.='</div><div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).'; vertical-align:top">';
2221
+
2222
+
2223
+
2224
+ $checked =($choice==$element_value ? 'checked="checked"' : '');
2225
+
2226
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key && $is_other==true && $element_value!='')
2227
+
2228
+ $checked = 'checked="checked"';
2229
+
2230
+ $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
2231
+
2232
+
2233
+
2234
+ $rep.='<div style="display: '.($param['w_flow']!='hor' ? 'table-cell' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'" '.$param['w_field_option_pos1'].'>'.$choice.'</label><div class="radio-div forlabs" '.$param['w_field_option_pos2'].'><input type="radio" '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'other="1"' : '' ).' id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.htmlspecialchars($choice_value).'" onclick="set_default(&quot;wdform_'.$id1.'&quot;,&quot;'.$key1.'&quot;,&quot;'.$form_id.'&quot;); '.(($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$key) ? 'show_other_input(&quot;wdform_'.$id1.'&quot;,&quot;'.$form_id.'&quot;);' : '').'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
2235
+
2236
+
2237
+
2238
+ $param['w_allow_other_num'] = $param['w_allow_other_num']==$key ? $key1 : $param['w_allow_other_num'];
2239
+
2240
+ }
2241
+
2242
+ }
2243
+
2244
+ $rep.='</div>';
2245
+
2246
+
2247
+
2248
+ $rep.='</div></div>';
2249
+
2250
+
2251
+
2252
+
2253
+
2254
+ if($is_other && $element_value!='')
2255
+
2256
+ $onload_js .='show_other_input("wdform_'.$id1.'","'.$form_id.'"); jQuery("#wdform_'.$id1.'_other_input'.$form_id.'").val("'.$element_value.'");';
2257
+
2258
+
2259
+
2260
+ $onsubmit_js.='
2261
+
2262
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other'.$form_id.'\" value = \"'.$param['w_allow_other'].'\" />").appendTo("#form'.$form_id.'");
2263
+
2264
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_allow_other_num'.$form_id.'\" value = \"'.$param['w_allow_other_num'].'\" />").appendTo("#adminForm");
2265
+
2266
+ ';
2267
+
2268
+
2269
+
2270
+ break;
2271
+
2272
+ }
2273
+
2274
+ case 'type_own_select':
2275
+
2276
+ {
2277
+
2278
+
2279
+
2280
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_checked', 'w_choices_disabled','w_required','w_class');
2281
+
2282
+ $temp=$params;
2283
+
2284
+ if(strpos($temp, 'w_choices_value') > -1)
2285
+
2286
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_checked', 'w_choices_disabled', 'w_required', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
2287
+
2288
+
2289
+
2290
+ foreach($params_names as $params_name )
2291
+
2292
+ {
2293
+
2294
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2295
+
2296
+ $param[$params_name] = $temp[0];
2297
+
2298
+ $temp=$temp[1];
2299
+
2300
+ }
2301
+
2302
+
2303
+
2304
+
2305
+
2306
+ if($temp)
2307
+
2308
+ {
2309
+
2310
+ $temp =explode('*:*w_attr_name*:*',$temp);
2311
+
2312
+ $attrs = array_slice($temp,0, count($temp)-1);
2313
+
2314
+ foreach($attrs as $attr)
2315
+
2316
+ $param['attributes'] = $param['attributes'].' '.$attr;
2317
+
2318
+ }
2319
+
2320
+
2321
+
2322
+
2323
+
2324
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
2325
+
2326
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
2327
+
2328
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
2329
+
2330
+
2331
+
2332
+ $param['w_choices'] = explode('***',$param['w_choices']);
2333
+
2334
+ $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
2335
+
2336
+ if(isset($param['w_choices_value']))
2337
+
2338
+ {
2339
+
2340
+ $param['w_choices_value'] = explode('***',$param['w_choices_value']);
2341
+
2342
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2343
+
2344
+ }
2345
+
2346
+
2347
+
2348
+ if(!isset($param['w_value_disabled']))
2349
+
2350
+ $param['w_value_disabled'] = 'no';
2351
+
2352
+
2353
+
2354
+ $rep='<div type="type_own_select" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos1'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2355
+
2356
+
2357
+
2358
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos2'].' width: '.($param['w_size']).'px; "><select id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" style="width: 100%;" '.$param['attributes'].'>';
2359
+
2360
+ foreach($param['w_choices'] as $key => $choice)
2361
+
2362
+ {
2363
+
2364
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2365
+
2366
+ {
2367
+
2368
+ $choices_labels =array();
2369
+ $choices_values = array();
2370
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2371
+ $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
2372
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2373
+ $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
2374
+ $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
2375
+
2376
+
2377
+ $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
2378
+
2379
+ $table = $label_table_and_column[0];
2380
+
2381
+ $label_column = $label_table_and_column[1];
2382
+
2383
+ if($label_column)
2384
+
2385
+ {
2386
+
2387
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
2388
+
2389
+ }
2390
+
2391
+
2392
+
2393
+ $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_value'][$key]));
2394
+
2395
+ $value_column = $param['w_choices_disabled'][$key]=="true" ? '' : $value_table_and_column[1];
2396
+
2397
+
2398
+
2399
+ if($value_column)
2400
+
2401
+ {
2402
+
2403
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
2404
+
2405
+ }
2406
+
2407
+
2408
+
2409
+ $columns_count = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
2410
+
2411
+ if(array_filter($choices_labels) || array_filter($choices_values))
2412
+
2413
+ for($k=0; $k<$columns_count; $k++)
2414
+
2415
+ {
2416
+
2417
+ $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
2418
+
2419
+ $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : ($param['w_choices_disabled'][$key]=="true" ? '' : $choice_label);
2420
+
2421
+
2422
+
2423
+ $selected=($element_value && htmlspecialchars($choice_value)==htmlspecialchars($element_value) ? 'selected="selected"' : '');
2424
+
2425
+
2426
+
2427
+ $rep.='<option value="'.htmlspecialchars($choice_value).'" '.$selected.'>'.$choice_label.'</option>';
2428
+
2429
+
2430
+
2431
+ }
2432
+
2433
+ }
2434
+
2435
+ else
2436
+
2437
+ {
2438
+
2439
+ $choice_value = $param['w_choices_disabled'][$key]=="true" ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
2440
+
2441
+
2442
+
2443
+ $selected=($element_value && htmlspecialchars($choice_value)==htmlspecialchars($element_value) ? 'selected="selected"' : '');
2444
+
2445
+
2446
+
2447
+ $rep.='<option value="'.htmlspecialchars($choice_value).'" '.$selected.'>'.$choice.'</option>';
2448
+
2449
+ }
2450
+
2451
+ }
2452
+
2453
+ $rep.='</select></div></div>';
2454
+
2455
+
2456
+
2457
+
2458
+
2459
+ break;
2460
+
2461
+ }
2462
+
2463
+ case 'type_country': {
2464
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_countries','w_required','w_class');
2465
+ $temp=$params;
2466
+ foreach($params_names as $params_name ) {
2467
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2468
+ $param[$params_name] = $temp[0];
2469
+ $temp=$temp[1];
2470
+ }
2471
+
2472
+ if($temp) {
2473
+ $temp =explode('*:*w_attr_name*:*',$temp);
2474
+ $attrs = array_slice($temp,0, count($temp)-1);
2475
+ foreach($attrs as $attr)
2476
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
2477
+ }
2478
+
2479
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
2480
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2481
+
2482
+ $param['w_countries'] = explode('***',$param['w_countries']);
2483
+
2484
+ $selected='';
2485
+
2486
+ $rep='<div type="type_country" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2487
+
2488
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="width: '.$param['w_size'].'px;"><select id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" style="width: 100%;" '.$param['attributes'].'>';
2489
+ foreach($param['w_countries'] as $key => $choice) {
2490
+
2491
+ $selected=(htmlspecialchars($choice)==htmlspecialchars($element_value) ? 'selected="selected"' : '');
2492
+
2493
+ $choice_value=$choice;
2494
+ $rep.='<option value="'.$choice_value.'" '.$selected.'>'.$choice.'</option>';
2495
+ }
2496
+ $rep.='</select></div></div>';
2497
+
2498
+ break;
2499
+ }
2500
+
2501
+ case 'type_time': {
2502
+ if($element_value =='')
2503
+ $element_value = ':';
2504
+
2505
+ $params_names=array('w_field_label_size','w_field_label_pos','w_time_type','w_am_pm','w_sec','w_hh','w_mm','w_ss','w_mini_labels','w_required','w_class');
2506
+ $temp=$params;
2507
+
2508
+ foreach($params_names as $params_name ) {
2509
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2510
+ $param[$params_name] = $temp[0];
2511
+ $temp=$temp[1];
2512
+ }
2513
+
2514
+ if($temp) {
2515
+ $temp =explode('*:*w_attr_name*:*',$temp);
2516
+ $attrs = array_slice($temp,0, count($temp)-1);
2517
+ foreach($attrs as $attr)
2518
+ $param['attributes'] = $param['attributes'].' '.$attr;
2519
+ }
2520
+
2521
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2522
+
2523
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
2524
+ $element_value = explode(':',$element_value);
2525
+
2526
+
2527
+ $w_sec = '';
2528
+ $w_sec_label='';
2529
+
2530
+ if($param['w_sec']=='1') {
2531
+ $w_sec = '<div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="'.(count($element_value)==2 ? '' : $element_value[2]).'" class="time_box" id="wdform_'.$id1.'_ss'.$form_id.'" name="wdform_'.$id1.'_ss'.$form_id.'" onkeypress="return check_second(event, &quot;wdform_'.$id1.'_ss'.$form_id.'&quot;)" '.$param['attributes'].'></div>';
2532
+
2533
+ $w_sec_label='<div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[2].'</label></div>';
2534
+ }
2535
+
2536
+
2537
+ if($param['w_time_type']=='12') {
2538
+ if(strpos($element_value[2],'pm')!==false) {
2539
+ $am_ = "";
2540
+ $pm_ = "selected=\"selected\"";
2541
+ }
2542
+ else {
2543
+ $am_ = "selected=\"selected\"";
2544
+ $pm_ = "";
2545
+ }
2546
+
2547
+ $w_time_type = '<div style="display: table-cell;"><select class="am_pm_select" name="wdform_'.$id1.'_am_pm'.$form_id.'" id="wdform_'.$id1.'_am_pm'.$form_id.'" '.$param['attributes'].'><option value="am" '.$am_.'>AM</option><option value="pm" '.$pm_.'>PM</option></select></div>';
2548
+
2549
+ $w_time_type_label = '<div ><label class="mini_label">'.$w_mini_labels[3].'</label></div>';
2550
+
2551
+ }
2552
+ else {
2553
+ $w_time_type='';
2554
+ $w_time_type_label = '';
2555
+ }
2556
+
2557
+ $rep ='<div type="type_time" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2558
+
2559
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;"><input type="text" value="'.$element_value[0].'" class="time_box" id="wdform_'.$id1.'_hh'.$form_id.'" name="wdform_'.$id1.'_hh'.$form_id.'" onkeypress="return check_hour(event, &quot;wdform_'.$id1.'_hh'.$form_id.'&quot;, &quot;23&quot;)" '.$param['attributes'].'></div><div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="'.$element_value[1].'" class="time_box" id="wdform_'.$id1.'_mm'.$form_id.'" name="wdform_'.$id1.'_mm'.$form_id.'" onkeypress="return check_minute(event, &quot;wdform_'.$id1.'_mm'.$form_id.'&quot;)" '.$param['attributes'].'></div>'.$w_sec.$w_time_type.'</div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[0].'</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[1].'</label></div>'.$w_sec_label.$w_time_type_label.'</div></div></div></div>';
2560
+
2561
+ break;
2562
+ }
2563
+
2564
+ case 'type_date': {
2565
+ $params_names=array('w_field_label_size','w_field_label_pos','w_date','w_required','w_class','w_format','w_but_val');
2566
+ $temp = $params;
2567
+ if(strpos($temp, 'w_disable_past_days') > -1)
2568
+ $params_names = array('w_field_label_size','w_field_label_pos','w_date','w_required','w_class','w_format','w_but_val', 'w_disable_past_days');
2569
+
2570
+ foreach($params_names as $params_name ) {
2571
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2572
+ $param[$params_name] = $temp[0];
2573
+ $temp=$temp[1];
2574
+ }
2575
+
2576
+ if($temp) {
2577
+ $temp =explode('*:*w_attr_name*:*',$temp);
2578
+ $attrs = array_slice($temp,0, count($temp)-1);
2579
+ foreach($attrs as $attr)
2580
+ $param['attributes'] = $param['attributes'].' '.$attr;
2581
+ }
2582
+
2583
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2584
+
2585
+ $rep ='<div type="type_date" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2586
+
2587
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><input type="text" value="'.$element_value.'" class="wdform-date" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" maxlength="10" '.$param['attributes'].'><input id="wdform_'.$id1.'_button'.$form_id.'" class="wdform-calendar-button" type="reset" value="'.$param['w_but_val'].'" format="'.$param['w_format'].'" onclick="return showCalendar(\'wdform_'.$id1.'_element'.$form_id.'\' , \'%Y-%m-%d\')" '.$param['attributes'].' "></div></div>';
2588
+
2589
+
2590
+ // $onload_js.= 'Calendar.setup({inputField: "wdform_'.$id1.'_element'.$form_id.'", ifFormat: "'.$param['w_format'].'",button: "wdform_'.$id1.'_button'.$form_id.'",align: "Tl",singleClick: true,firstDay: 0});';
2591
+
2592
+ break;
2593
+ }
2594
+
2595
+ case 'type_date_fields': {
2596
+ if($element_value=='')
2597
+ $element_value='--';
2598
+
2599
+ $params_names=array('w_field_label_size','w_field_label_pos','w_day','w_month','w_year','w_day_type','w_month_type','w_year_type','w_day_label','w_month_label','w_year_label','w_day_size','w_month_size','w_year_size','w_required','w_class','w_from','w_to','w_divider');
2600
+
2601
+ $temp=$params;
2602
+
2603
+ foreach($params_names as $params_name ) {
2604
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2605
+ $param[$params_name] = $temp[0];
2606
+ $temp=$temp[1];
2607
+ }
2608
+
2609
+
2610
+ if($temp) {
2611
+ $temp =explode('*:*w_attr_name*:*',$temp);
2612
+ $attrs = array_slice($temp,0, count($temp)-1);
2613
+ foreach($attrs as $attr)
2614
+ $param['attributes'] = $param['attributes'].' '.$attr;
2615
+ }
2616
+
2617
+ $element_value = explode('-',$element_value);
2618
+
2619
+ $param['w_day'] = (isset($_POST['wdform_'.$id1."_day".$form_id]) ? esc_html(stripslashes( $_POST['wdform_'.$id1."_day".$form_id])) : $param['w_day']);
2620
+ $param['w_month'] = (isset($_POST['wdform_'.$id1."_month".$form_id]) ? esc_html(stripslashes( $_POST['wdform_'.$id1."_month".$form_id])) : $element_value[1]);//??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
2621
+ $param['w_year'] = (isset($_POST['wdform_'.$id1."w_year".$form_id]) ? esc_html(stripslashes( $_POST['wdform_'.$id1."_year".$form_id])) : $param['w_year']);
2622
+
2623
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2624
+
2625
+ if($param['w_day_type']=="SELECT") {
2626
+
2627
+ $w_day_type = '<select id="wdform_'.$id1.'_day'.$form_id.'" name="wdform_'.$id1.'_day'.$form_id.'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'><option value=""></option>';
2628
+
2629
+ for($k=1; $k<=31; $k++) {
2630
+
2631
+ if($k<10) {
2632
+ if($element_value[0]=='0'.$k)
2633
+ $selected = "selected=\"selected\"";
2634
+ else
2635
+ $selected = "";
2636
+
2637
+ $w_day_type .= '<option value="0'.$k.'" '.$selected.'>0'.$k.'</option>';
2638
+ }
2639
+ else {
2640
+ if($element_value[0]==''.$k)
2641
+ $selected = "selected=\"selected\"";
2642
+ else
2643
+ $selected = "";
2644
+
2645
+ $w_day_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
2646
+ }
2647
+
2648
+ }
2649
+ $w_day_type .= '</select>';
2650
+
2651
+ }
2652
+ else {
2653
+ $w_day_type = '<input type="text" value="'.$element_value[0].'" id="wdform_'.$id1.'_day'.$form_id.'" name="wdform_'.$id1.'_day'.$form_id.'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'>';
2654
+ $onload_js .='jQuery("#wdform_'.$id1.'_day'.$form_id.'").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2655
+ $onload_js .='jQuery("#wdform_'.$id1.'_day'.$form_id.'").keypress(function() {return check_day(event, this)});';
2656
+ }
2657
+
2658
+
2659
+ if($param['w_month_type']=="SELECT") {
2660
+
2661
+ $w_month_type = '<select id="wdform_'.$id1.'_month'.$form_id.'" name="wdform_'.$id1.'_month'.$form_id.'" style="width: '.$param['w_month_size'].'px;" '.$param['attributes'].'><option value=""></option><option value="01" '.($param['w_month']=="01" ? "selected=\"selected\"": "").' >'.(__("January", 'form_maker')).'</option><option value="02" '.($param['w_month']=="02" ? "selected=\"selected\"": "").'>'.(__("February", 'form_maker')).'</option><option value="03" '.($param['w_month']=="03"? "selected=\"selected\"": "").'>'.(__("March", 'form_maker')).'</option><option value="04" '.($param['w_month']=="04" ? "selected=\"selected\"": "").' >'.(__("April", 'form_maker')).'</option><option value="05" '.($param['w_month']=="05" ? "selected=\"selected\"": "").' >'.(__("May", 'form_maker')).'</option><option value="06" '.($param['w_month']=="06" ? "selected=\"selected\"": "").' >'.(__("June", 'form_maker')).'</option><option value="07" '.($param['w_month']=="07" ? "selected=\"selected\"": "").' >'.(__("July", 'form_maker')).'</option><option value="08" '.($param['w_month']=="08" ? "selected=\"selected\"": "").' >'.(__("August", 'form_maker')).'</option><option value="09" '.($param['w_month']=="09" ? "selected=\"selected\"": "").' >'.(__("September", 'form_maker')).'</option><option value="10" '.($param['w_month']=="10" ? "selected=\"selected\"": "").' >'.(__("October", 'form_maker')).'</option><option value="11" '.($param['w_month']=="11" ? "selected=\"selected\"": "").'>'.(__("November", 'form_maker')).'</option><option value="12" '.($param['w_month']=="12" ? "selected=\"selected\"": "").' >'.(__("December", 'form_maker')).'</option></select>';
2662
+ }
2663
+ else {
2664
+ $w_month_type = '<input type="text" value="'.$element_value[1].'" id="wdform_'.$id1.'_month'.$form_id.'" name="wdform_'.$id1.'_month'.$form_id.'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].'>';
2665
+ $onload_js .='jQuery("#wdform_'.$id1.'_month'.$form_id.'").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2666
+ $onload_js .='jQuery("#wdform_'.$id1.'_month'.$form_id.'").keypress(function() {return check_month(event, this)});';
2667
+ }
2668
+
2669
+
2670
+ if($param['w_year_type']=="SELECT" ) {
2671
+ $w_year_type = '<select id="wdform_'.$id1.'_year'.$form_id.'" name="wdform_'.$id1.'_year'.$form_id.'" from="'.$param['w_from'].'" to="'.$param['w_to'].'" style="width: '.$param['w_year_size'].'px;" '.$param['attributes'].'><option value=""></option>';
2672
+
2673
+ for($k=$param['w_to']; $k>=$param['w_from']; $k--) {
2674
+ if($element_value[2]==$k)
2675
+ $selected = "selected=\"selected\"";
2676
+ else
2677
+ $selected = "";
2678
+
2679
+ $w_year_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
2680
+ }
2681
+ $w_year_type .= '</select>';
2682
+ }
2683
+ else {
2684
+ $w_year_type = '<input type="text" value="'.$element_value[2].'" 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'].'>';
2685
+ $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").blur(function() {check_year2(this)});';
2686
+ $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").keypress(function() {return check_year1(event, this)});';
2687
+ $onload_js .='jQuery("#wdform_'.$id1.'_year'.$form_id.'").change(function() {change_year(this)});';
2688
+ }
2689
+
2690
+ $rep ='<div type="type_date_fields" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2691
+
2692
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;">'.$w_day_type.'</div><div style="display: table-cell;"><span class="wdform_separator">'.$param['w_divider'].'</span></div><div style="display: table-cell;">'.$w_month_type.'</div><div style="display: table-cell;"><span class="wdform_separator">'.$param['w_divider'].'</span></div><div style="display: table-cell;">'.$w_year_type.'</div></div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">'.$param['w_day_label'].'</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label" >'.$param['w_month_label'].'</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">'.$param['w_year_label'].'</label></div></div></div></div></div>';
2693
+
2694
+ break;
2695
+ }
2696
+
2697
+
2698
+ case 'type_hidden': {
2699
+ $params_names=array('w_name','w_value');
2700
+ $temp=$params;
2701
+
2702
+ foreach($params_names as $params_name ) {
2703
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2704
+ $param[$params_name] = $temp[0];
2705
+ $temp=$temp[1];
2706
+ }
2707
+
2708
+ if($temp) {
2709
+ $temp =explode('*:*w_attr_name*:*',$temp);
2710
+ $attrs = array_slice($temp,0, count($temp)-1);
2711
+ foreach($attrs as $attr)
2712
+ $param['attributes'] = $param['attributes'].' '.$attr;
2713
+ }
2714
+
2715
+ $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>';
2716
+
2717
+ break;
2718
+ }
2719
+
2720
+
2721
+ case 'type_paypal_price': {
2722
+
2723
+ $params_names=array('w_field_label_size','w_field_label_pos','w_first_val','w_title', 'w_mini_labels','w_size','w_required','w_hide_cents','w_class','w_range_min','w_range_max');
2724
+ $temp=$params;
2725
+
2726
+ foreach($params_names as $params_name ) {
2727
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2728
+ $param[$params_name] = $temp[0];
2729
+ $temp=$temp[1];
2730
+ }
2731
+
2732
+
2733
+ if($temp) {
2734
+ $temp =explode('*:*w_attr_name*:*',$temp);
2735
+ $attrs = array_slice($temp,0, count($temp)-1);
2736
+ foreach($attrs as $attr)
2737
+ $param['attributes'] = $param['attributes'].' '.$attr;
2738
+ }
2739
+
2740
+ if (strpos($element_value,'.')!== false)
2741
+ $element = explode('.',$element_value);
2742
+ else {
2743
+ $element = Array();
2744
+ $element[0] = preg_replace("/[^0-9]/","",$element_value);
2745
+ $element[1] = '';
2746
+ }
2747
+
2748
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
2749
+
2750
+ $hide_cents = ($param['w_hide_cents']=="yes" ? "none;" : "table-cell;");
2751
+
2752
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
2753
+
2754
+ $rep ='<div type="type_paypal_price" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2755
+
2756
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';"><input type="hidden" value="'.$param['w_range_min'].'" name="wdform_'.$id1.'_range_min'.$form_id.'" id="wdform_'.$id1.'_range_min'.$form_id.'"><input type="hidden" value="'.$param['w_range_max'].'" name="wdform_'.$id1.'_range_max'.$form_id.'" id="wdform_'.$id1.'_range_max'.$form_id.'"><div id="wdform_'.$id1.'_table_price" style="display: table;"><div id="wdform_'.$id1.'_tr_price1" style="display: table-row;"><div id="wdform_'.$id1.'_td_name_currency" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;'.$form_currency.'&nbsp;<!--repend--></span></div><div id="wdform_'.$id1.'_td_name_dollars" style="display: table-cell;"><input type="text" class="" id="wdform_'.$id1.'_element_dollars'.$form_id.'" name="wdform_'.$id1.'_element_dollars'.$form_id.'" value="'.(strpos($element_value,'.') !== false ? preg_replace("/[^0-9]/","",$element[0]) : $element[0]).'" onkeypress="return check_isnum(event)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].'></div><div id="wdform_'.$id1.'_td_name_divider" style="display: '.$hide_cents.';"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;.&nbsp;</span></div><div id="wdform_'.$id1.'_td_name_cents" style="display: '.$hide_cents.'"><input type="text" class="" id="wdform_'.$id1.'_element_cents'.$form_id.'" name="wdform_'.$id1.'_element_cents'.$form_id.'" value="'.(strpos($element_value,'.') !== false ? preg_replace("/[^0-9]/","",$element[1]) : " ").'" style="width: 30px;" '.$param['attributes'].'></div></div><div id="wdform_'.$id1.'_tr_price2" style="display: table-row;"><div style="display: table-cell;"><label class="mini_label"></label></div><div align="left" style="display: table-cell;"><label class="mini_label">'.$w_mini_labels[0].'</label></div><div id="wdform_'.$id1.'_td_name_label_divider" style="display: '.$hide_cents.'"><label class="mini_label"></label></div><div align="left" id="wdform_'.$id1.'_td_name_label_cents" style="display: '.$hide_cents.'"><label class="mini_label">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
2757
+
2758
+ $onload_js .='jQuery("#wdform_'.$id1.'_element_cents'.$form_id.'").blur(function() {add_0(this)});';
2759
+ $onload_js .='jQuery("#wdform_'.$id1.'_element_cents'.$form_id.'").keypress(function() {return check_isnum_interval(event,this,0,99)});';
2760
+
2761
+ break;
2762
+ }
2763
+
2764
+ case 'type_paypal_select':
2765
+
2766
+ {
2767
+
2768
+
2769
+
2770
+ if($element_value=='')
2771
+
2772
+ $element_value = ' :';
2773
+
2774
+
2775
+
2776
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_price','w_choices_checked', 'w_choices_disabled','w_required','w_quantity','w_class','w_property','w_property_values');
2777
+
2778
+ $temp=$params;
2779
+
2780
+
2781
+
2782
+ if(strpos($temp, 'w_choices_params') > -1)
2783
+
2784
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_choices','w_choices_price','w_choices_checked', 'w_choices_disabled','w_required','w_quantity', 'w_quantity_value', 'w_choices_params','w_class','w_property','w_property_values');
2785
+
2786
+
2787
+
2788
+ foreach($params_names as $params_name )
2789
+
2790
+ {
2791
+
2792
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2793
+
2794
+ $param[$params_name] = $temp[0];
2795
+
2796
+ $temp=$temp[1];
2797
+
2798
+ }
2799
+
2800
+
2801
+
2802
+
2803
+
2804
+ if($temp)
2805
+
2806
+ {
2807
+
2808
+ $temp =explode('*:*w_attr_name*:*',$temp);
2809
+
2810
+ $attrs = array_slice($temp,0, count($temp)-1);
2811
+
2812
+ foreach($attrs as $attr)
2813
+
2814
+ $param['attributes'] = $param['attributes'].' '.$attr;
2815
+
2816
+ }
2817
+
2818
+
2819
+
2820
+
2821
+
2822
+ $wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
2823
+
2824
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
2825
+
2826
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
2827
+
2828
+
2829
+
2830
+ $param['w_choices'] = explode('***',$param['w_choices']);
2831
+
2832
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
2833
+
2834
+
2835
+
2836
+ $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
2837
+
2838
+ $param['w_property'] = explode('***',$param['w_property']);
2839
+
2840
+ $param['w_property_values'] = explode('***',$param['w_property_values']);
2841
+
2842
+ if(isset($param['w_choices_params']))
2843
+
2844
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2845
+
2846
+
2847
+
2848
+
2849
+
2850
+ if(strpos($element_value,'***br***') !== false)
2851
+
2852
+ {
2853
+
2854
+ $element_value = explode('***br***',$element_value);
2855
+
2856
+ if(count($element_value)==2)
2857
+
2858
+ {
2859
+
2860
+ if(strpos($element_value[1],'***quantity***') !== false)
2861
+
2862
+ {
2863
+
2864
+ $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
2865
+
2866
+ $quantity_value = $quantity_value[1];
2867
+
2868
+ $property_of_select = '';
2869
+
2870
+ }
2871
+
2872
+ else
2873
+
2874
+ {
2875
+
2876
+ $quantity_value = '' ;
2877
+
2878
+ $property_of_select = explode(': ',str_replace("***property***","",$element_value[1]));
2879
+
2880
+ $property_of_select = $property_of_select[1];
2881
+
2882
+ }
2883
+
2884
+
2885
+
2886
+ $element_value = explode(' :',$element_value[0]);
2887
+
2888
+ $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
2889
+
2890
+ }
2891
+
2892
+ else
2893
+
2894
+ {
2895
+
2896
+ $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
2897
+
2898
+ $quantity_value = $quantity_value[1];
2899
+
2900
+ $property_of_select = explode(': ',str_replace("***property***","",$element_value[2]));
2901
+
2902
+ $property_of_select = $property_of_select[1];
2903
+
2904
+ $element_value = explode(' :',$element_value[0]);
2905
+
2906
+ $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
2907
+
2908
+ }
2909
+
2910
+ }
2911
+
2912
+ else
2913
+
2914
+ {
2915
+
2916
+ $element_value = explode(' :',$element_value);
2917
+
2918
+ $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
2919
+
2920
+ $quantity_value = '';
2921
+
2922
+ $property_of_select = '';
2923
+
2924
+ }
2925
+
2926
+
2927
+
2928
+
2929
+
2930
+ $rep='<div type="type_paypal_select" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section" style="'.$param['w_field_label_pos1'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
2931
+
2932
+
2933
+
2934
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos2'].'; width: '.$param['w_size'].'px;"><select id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" style="width:100%;" '.$param['attributes'].'>';
2935
+
2936
+ foreach($param['w_choices'] as $key => $choice)
2937
+
2938
+ {
2939
+
2940
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2941
+
2942
+ {
2943
+
2944
+ $choices_labels =array();
2945
+ $choices_values =array();
2946
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2947
+ $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
2948
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2949
+ $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
2950
+ $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
2951
+
2952
+
2953
+ $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
2954
+
2955
+ $table = $label_table_and_column[0];
2956
+
2957
+ $label_column = $label_table_and_column[1];
2958
+
2959
+ if($label_column)
2960
+
2961
+ {
2962
+
2963
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
2964
+
2965
+ }
2966
+
2967
+
2968
+
2969
+ $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
2970
+
2971
+ $value_column = $param['w_choices_disabled'][$key]=="true" ? '' : $value_table_and_column[1];
2972
+
2973
+
2974
+
2975
+ if($value_column)
2976
+
2977
+ {
2978
+
2979
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
2980
+
2981
+ }
2982
+
2983
+
2984
+
2985
+ $columns_count = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
2986
+
2987
+
2988
+
2989
+ for($k=0; $k<$columns_count; $k++)
2990
+
2991
+ {
2992
+
2993
+ $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
2994
+
2995
+ $choice_value = isset($choices_values[$k]) ? (float)$choices_values[$k] : '';
2996
+
2997
+
2998
+
2999
+ if($element_value[0] == $choice_label && $choice_value == $choise_value)
3000
+
3001
+ $selected = 'selected="selected"';
3002
+
3003
+ else
3004
+
3005
+ $selected = '';
3006
+
3007
+
3008
+
3009
+ $rep.='<option value="'.$choice_value.'" '.$selected.'>'.$choice_label.'</option>';
3010
+
3011
+ }
3012
+
3013
+ }
3014
+
3015
+ else
3016
+
3017
+ {
3018
+
3019
+ if($param['w_choices_disabled'][$key]=="true")
3020
+
3021
+ $choice_value='';
3022
+
3023
+ else
3024
+
3025
+ $choice_value=$param['w_choices_price'][$key];
3026
+
3027
+
3028
+
3029
+ if($element_value[0] == $choice && $param['w_choices_price'][$key] == $choise_value)
3030
+
3031
+ $selected = 'selected="selected"';
3032
+
3033
+ else
3034
+
3035
+ $selected = '';
3036
+
3037
+
3038
+
3039
+ $rep.='<option value="'.$choice_value.'" '.$selected.'>'.$choice.'</option>';
3040
+
3041
+
3042
+
3043
+ }
3044
+
3045
+ }
3046
+
3047
+ $rep.='</select><div id="wdform_'.$id1.'_div'.$form_id.'">';
3048
+
3049
+ if($param['w_quantity']=="yes")
3050
+
3051
+ {
3052
+
3053
+ $rep.='<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">Quantity</label><input type="text" id="wdform_'.$id1.'_element_quantity'.$form_id.'" name="wdform_'.$id1.'_element_quantity'.$form_id.'" value="'.($quantity_value=="" ? 1 : $quantity_value).'" class="wdform-quantity"></div>';
3054
+
3055
+ }
3056
+
3057
+ if($param['w_property'][0])
3058
+
3059
+ foreach($param['w_property'] as $key => $property)
3060
+
3061
+ {
3062
+
3063
+
3064
+
3065
+ $rep.='
3066
+
3067
+ <div id="wdform_'.$id1.'_property_'.$key.'" class="paypal-property">
3068
+
3069
+ <div style="width:150px; display:inline-block;">
3070
+
3071
+ <label class="mini_label" id="wdform_'.$id1.'_property_label_'.$form_id.''.$key.'" style="margin-right: 5px;">'.$property.'</label>
3072
+
3073
+ <select id="wdform_'.$id1.'_property'.$form_id.''.$key.'" name="wdform_'.$id1.'_property'.$form_id.''.$key.'" style="width: 100%; margin: 2px 0px;">';
3074
+
3075
+ $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
3076
+
3077
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
3078
+
3079
+ foreach($param['w_property_values'][$key] as $subkey => $property_value)
3080
+
3081
+ {
3082
+
3083
+ $rep.='<option id="wdform_'.$id1.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'" '.($property_of_select==$property_value ? 'selected="selected"' : "").'>'.$property_value.'</option>';
3084
+
3085
+ }
3086
+
3087
+ $rep.='</select></div></div>';
3088
+
3089
+ }
3090
+
3091
+
3092
+
3093
+ $rep.='</div></div></div>';
3094
+
3095
+
3096
+
3097
+
3098
+
3099
+ $onsubmit_js.='
3100
+
3101
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_label'.$form_id.'\" />").val(jQuery("#wdform_'.$id1.'_element'.$form_id.' option:selected").text()).appendTo("#adminForm");
3102
+
3103
+ ';
3104
+
3105
+ $onsubmit_js.='
3106
+
3107
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_quantity_label'.$form_id.'\" />").val("Quantity").appendTo("#adminForm");
3108
+
3109
+ ';
3110
+
3111
+ $onsubmit_js.='
3112
+
3113
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_property_label'.$form_id.'\" />").val("'.$param['w_property'][0].'").appendTo("#adminForm");
3114
+
3115
+ ';
3116
+
3117
+
3118
+
3119
+
3120
+
3121
+ break;
3122
+
3123
+ }
3124
+
3125
+ case 'type_paypal_checkbox':
3126
+
3127
+ {
3128
+
3129
+
3130
+
3131
+ if($element_value == '')
3132
+
3133
+ $element_value =' :';
3134
+
3135
+
3136
+
3137
+ $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_class','w_property','w_property_values','w_quantity');
3138
+
3139
+ $temp=$params;
3140
+
3141
+ if(strpos($temp, 'w_field_option_pos') > -1)
3142
+
3143
+ $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_option_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num', 'w_choices_params', 'w_class','w_property','w_property_values','w_quantity');
3144
+
3145
+ foreach($params_names as $params_name )
3146
+
3147
+ {
3148
+
3149
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
3150
+
3151
+ $param[$params_name] = $temp[0];
3152
+
3153
+ $temp=$temp[1];
3154
+
3155
+ }
3156
+
3157
+
3158
+
3159
+
3160
+
3161
+ if($temp)
3162
+
3163
+ {
3164
+
3165
+ $temp =explode('*:*w_attr_name*:*',$temp);
3166
+
3167
+ $attrs = array_slice($temp,0, count($temp)-1);
3168
+
3169
+ foreach($attrs as $attr)
3170
+
3171
+ $param['attributes'] = $param['attributes'].' '.$attr;
3172
+
3173
+ }
3174
+
3175
+
3176
+
3177
+
3178
+
3179
+ if(!isset($param['w_field_option_pos']))
3180
+
3181
+ $param['w_field_option_pos'] = 'left';
3182
+
3183
+
3184
+
3185
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
3186
+
3187
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
3188
+
3189
+ $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
3190
+
3191
+ $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
3192
+
3193
+
3194
+
3195
+
3196
+
3197
+ $param['w_choices'] = explode('***',$param['w_choices']);
3198
+
3199
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
3200
+
3201
+
3202
+
3203
+ $param['w_property'] = explode('***',$param['w_property']);
3204
+
3205
+ $param['w_property_values'] = explode('***',$param['w_property_values']);
3206
+
3207
+ if(isset($param['w_choices_params']))
3208
+
3209
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
3210
+
3211
+
3212
+
3213
+ $rep='<div type="type_paypal_checkbox" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
3214
+
3215
+
3216
+
3217
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
3218
+
3219
+
3220
+
3221
+
3222
+
3223
+ if(strpos($element_value,'***br***') !== false)
3224
+
3225
+ {
3226
+
3227
+ $element_value = explode('***br***',$element_value);
3228
+
3229
+ foreach($element_value as $key => $element)
3230
+
3231
+ {
3232
+
3233
+
3234
+
3235
+ if(strpos($element,'***quantity***') !== false)
3236
+
3237
+ {
3238
+
3239
+ $quantity_value = explode(': ',str_replace("***quantity***","",$element));
3240
+
3241
+ $quantity_value = $quantity_value[1];
3242
+
3243
+ unset($element_value[$key]);
3244
+
3245
+ }
3246
+
3247
+ else
3248
+
3249
+ if(strpos($element,'***property***') !== false)
3250
+
3251
+ {
3252
+
3253
+ $property_of_check = explode(': ',str_replace("***property***","",$element));
3254
+
3255
+ $property_of_check = $property_of_check[1];
3256
+
3257
+ unset($element_value[$key]);
3258
+
3259
+ }
3260
+
3261
+ else
3262
+
3263
+ {
3264
+
3265
+ for($m=0; $m<strlen($element); $m++)
3266
+
3267
+ {
3268
+
3269
+ if(!ctype_digit($element[strlen($element)-1]))
3270
+
3271
+ $element_value[$key] = substr($element,0,-1);
3272
+
3273
+ else
3274
+
3275
+ break;
3276
+
3277
+ }
3278
+
3279
+ $quantity_value = '';
3280
+
3281
+ $property_of_check = '';
3282
+
3283
+ }
3284
+
3285
+
3286
+
3287
+ }
3288
+
3289
+ }
3290
+
3291
+ else
3292
+
3293
+ {
3294
+
3295
+ $element_value = explode(' :',$element_value);
3296
+
3297
+ $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3298
+
3299
+ $quantity_value = '';
3300
+
3301
+ $property_of_check = '';
3302
+
3303
+ }
3304
+
3305
+
3306
+
3307
+ $total_queries = 0;
3308
+
3309
+ foreach($param['w_choices'] as $key => $choice)
3310
+
3311
+ {
3312
+
3313
+ $key1 = $key + $total_queries;
3314
+
3315
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
3316
+
3317
+ {
3318
+
3319
+ $choices_labels = array();
3320
+ $choices_values = array();
3321
+
3322
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
3323
+ $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
3324
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
3325
+
3326
+ $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
3327
+ $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
3328
+
3329
+ $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
3330
+
3331
+ $table = $label_table_and_column[0];
3332
+
3333
+ $label_column = $label_table_and_column[1];
3334
+
3335
+ if($label_column)
3336
+
3337
+ {
3338
+
3339
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3340
+ }
3341
+
3342
+
3343
+
3344
+ $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
3345
+
3346
+ $value_column = $value_table_and_column[1];
3347
+
3348
+
3349
+
3350
+ if($value_column)
3351
+
3352
+ {
3353
+
3354
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3355
+
3356
+ }
3357
+
3358
+
3359
+
3360
+ $columns_count = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
3361
+
3362
+
3363
+
3364
+ if(array_filter($choices_labels) || array_filter($choices_values))
3365
+
3366
+ {
3367
+
3368
+ $total_queries = $total_queries + $columns_count-1;
3369
+
3370
+
3371
+
3372
+
3373
+
3374
+ for($k=0; $k<$columns_count; $k++)
3375
+
3376
+ {
3377
+
3378
+ $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
3379
+
3380
+ $choice_value = isset($choices_values) ? (float)$choices_values[$k] : '';
3381
+
3382
+
3383
+
3384
+ $checked=(in_array($choice_label.' - '.$choice_value, $element_value)=='true' ? 'checked="checked"' : '');
3385
+
3386
+
3387
+
3388
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" '.$param['w_field_option_pos1'].'>'.$choice_label.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" value="'.$choice_value.'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div><input type="hidden" name="wdform_'.$id1.'_element'.$form_id.($key1+$k).'_label" value="'.htmlspecialchars($choice_label).'" /></div>';
3389
+
3390
+
3391
+
3392
+
3393
+
3394
+ }
3395
+
3396
+ }
3397
+
3398
+ }
3399
+
3400
+ else
3401
+
3402
+ {
3403
+
3404
+ $checked=(in_array($choice.' - '.$param['w_choices_price'][$key], $element_value)=='true' ? 'checked="checked"' : '');
3405
+
3406
+
3407
+
3408
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'" '.$param['w_field_option_pos1'].'>'.$choice.'</label><div class="checkbox-div forlabs" '.$param['w_field_option_pos2'].'><input type="checkbox" id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.''.$key1.'" value="'.$param['w_choices_price'][$key].'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div><input type="hidden" name="wdform_'.$id1.'_element'.$form_id.$key1.'_label" value="'.htmlspecialchars($choice).'" /></div>';
3409
+
3410
+ }
3411
+
3412
+ }
3413
+
3414
+
3415
+
3416
+ $rep.='<div id="wdform_'.$id1.'_div'.$form_id.'">';
3417
+
3418
+ if($param['w_quantity']=="yes")
3419
+
3420
+ $rep.='<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">Quantity</label><input type="text" value="'.($quantity_value == '' ? 1 : $quantity_value).'" id="wdform_'.$id1.'_element_quantity'.$form_id.'" name="wdform_'.$id1.'_element_quantity'.$form_id.'" class="wdform-quantity"></div>';
3421
+
3422
+
3423
+
3424
+ if($param['w_property'][0])
3425
+
3426
+ foreach($param['w_property'] as $key => $property)
3427
+
3428
+ {
3429
+
3430
+
3431
+
3432
+ $rep.='
3433
+
3434
+ <div class="paypal-property">
3435
+
3436
+ <div style="width:150px; display:inline-block;">
3437
+
3438
+ <label class="mini_label" id="wdform_'.$id1.'_property_label_'.$form_id.''.$key.'" style="margin-right: 5px;">'.$property.'</label>
3439
+
3440
+ <select id="wdform_'.$id1.'_property'.$form_id.''.$key.'" name="wdform_'.$id1.'_property'.$form_id.''.$key.'" style="width: 100%; margin: 2px 0px;">';
3441
+
3442
+ $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
3443
+
3444
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
3445
+
3446
+ foreach($param['w_property_values'][$key] as $subkey => $property_value)
3447
+
3448
+ {
3449
+
3450
+ $rep.='<option id="wdform_'.$id1.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'" '.($property_of_check==$property_value ? 'selected="selected"' : "").'>'.$property_value.'</option>';
3451
+
3452
+ }
3453
+
3454
+ $rep.='</select></div></div>';
3455
+
3456
+ }
3457
+
3458
+
3459
+
3460
+ $rep.='</div></div></div>';
3461
+
3462
+
3463
+
3464
+ $onsubmit_js.='
3465
+
3466
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_quantity_label'.$form_id.'\" />").val("Quantity").appendTo("#adminForm");
3467
+
3468
+ ';
3469
+
3470
+ $onsubmit_js.='
3471
+
3472
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_property_label'.$form_id.'\" />").val("'.$param['w_property'][0].'").appendTo("#adminForm");
3473
+
3474
+ ';
3475
+
3476
+
3477
+
3478
+ break;
3479
+
3480
+ }
3481
+
3482
+ case 'type_paypal_radio':
3483
+
3484
+ {
3485
+
3486
+
3487
+
3488
+ if($element_value=='')
3489
+
3490
+ $element_value = ' :';
3491
+
3492
+
3493
+
3494
+ $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_class','w_property','w_property_values','w_quantity');
3495
+
3496
+ $temp=$params;
3497
+
3498
+
3499
+
3500
+ if(strpos($temp, 'w_field_option_pos') > -1)
3501
+
3502
+ $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_option_pos', 'w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num', 'w_choices_params', 'w_class', 'w_property','w_property_values','w_quantity');
3503
+
3504
+
3505
+
3506
+ foreach($params_names as $params_name )
3507
+
3508
+ {
3509
+
3510
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
3511
+
3512
+ $param[$params_name] = $temp[0];
3513
+
3514
+ $temp=$temp[1];
3515
+
3516
+ }
3517
+
3518
+
3519
+
3520
+ if($temp)
3521
+
3522
+ {
3523
+
3524
+ $temp =explode('*:*w_attr_name*:*',$temp);
3525
+
3526
+ $attrs = array_slice($temp,0, count($temp)-1);
3527
+
3528
+ foreach($attrs as $attr)
3529
+
3530
+ $param['attributes'] = $param['attributes'].' '.$attr;
3531
+
3532
+ }
3533
+
3534
+ if(!isset($param['w_field_option_pos']))
3535
+
3536
+ $param['w_field_option_pos'] = 'left';
3537
+
3538
+
3539
+
3540
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
3541
+
3542
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
3543
+
3544
+ $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
3545
+
3546
+ $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
3547
+
3548
+
3549
+
3550
+ $param['w_choices'] = explode('***',$param['w_choices']);
3551
+
3552
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
3553
+
3554
+
3555
+
3556
+ $param['w_property'] = explode('***',$param['w_property']);
3557
+
3558
+ $param['w_property_values'] = explode('***',$param['w_property_values']);
3559
+
3560
+ if(isset($param['w_choices_params']))
3561
+
3562
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
3563
+
3564
+
3565
+
3566
+ $rep='<div type="type_paypal_radio" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
3567
+
3568
+
3569
+
3570
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
3571
+
3572
+
3573
+
3574
+ if(strpos($element_value,'***br***') !== false)
3575
+
3576
+ {
3577
+
3578
+ $element_value = explode('***br***',$element_value);
3579
+
3580
+ if(count($element_value)==2)
3581
+
3582
+ {
3583
+
3584
+ if(strpos($element_value[1],'***quantity***') !== false)
3585
+
3586
+ {
3587
+
3588
+ $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
3589
+
3590
+ $quantity_value = $quantity_value[1];
3591
+
3592
+ $property_of_radio = '';
3593
+
3594
+ }
3595
+
3596
+ else
3597
+
3598
+ {
3599
+
3600
+ $quantity_value = '' ;
3601
+
3602
+ $property_of_radio = explode(': ',str_replace("***property***","",$element_value[1]));
3603
+
3604
+ $property_of_radio = $property_of_radio[1];
3605
+
3606
+ }
3607
+
3608
+
3609
+
3610
+ $element_value = explode(' :',$element_value[0]);
3611
+
3612
+ $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3613
+
3614
+ }
3615
+
3616
+ else
3617
+
3618
+ {
3619
+
3620
+ $quantity_value = explode(': ',str_replace("***quantity***","",$element_value[1]));
3621
+
3622
+ $quantity_value = $quantity_value[1];
3623
+
3624
+ $property_of_radio = explode(': ',str_replace("***property***","",$element_value[2]));
3625
+
3626
+ $property_of_radio = $property_of_radio[1];
3627
+
3628
+
3629
+
3630
+ $element_value = explode(' :',$element_value[0]);
3631
+
3632
+ $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3633
+
3634
+ }
3635
+
3636
+ }
3637
+
3638
+ else
3639
+
3640
+ {
3641
+
3642
+ $element_value = explode(' :',$element_value);
3643
+
3644
+ $choise_value = preg_replace("/[^0-9]/","",$element_value[1]);
3645
+
3646
+ $quantity_value = '';
3647
+
3648
+ $property_of_radio = '';
3649
+
3650
+ }
3651
+
3652
+ $total_queries = 0;
3653
+
3654
+ foreach($param['w_choices'] as $key => $choice)
3655
+
3656
+ {
3657
+
3658
+ $key1 = $key + $total_queries;
3659
+
3660
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
3661
+
3662
+ {
3663
+
3664
+ $choices_labels =array();
3665
+ $choices_values =array();
3666
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
3667
+ $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
3668
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
3669
+
3670
+ $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
3671
+ $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
3672
+
3673
+
3674
+ $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
3675
+
3676
+ $table = $label_table_and_column[0];
3677
+
3678
+ $label_column = $label_table_and_column[1];
3679
+
3680
+ if($label_column)
3681
+
3682
+ {
3683
+
3684
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3685
+ }
3686
+
3687
+
3688
+
3689
+ $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
3690
+
3691
+ $value_column = $value_table_and_column[1];
3692
+
3693
+
3694
+
3695
+ if($value_column)
3696
+
3697
+ {
3698
+
3699
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3700
+
3701
+ }
3702
+
3703
+
3704
+
3705
+ $columns_count_radio = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
3706
+
3707
+
3708
+
3709
+ if(array_filter($choices_labels) || array_filter($choices_values))
3710
+
3711
+ {
3712
+
3713
+ $total_queries = $total_queries + $columns_count_radio-1;
3714
+
3715
+ for($k=0; $k<$columns_count_radio; $k++)
3716
+
3717
+ {
3718
+
3719
+ $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
3720
+
3721
+ $choice_value = isset($choices_values) ? (float)$choices_values[$k] : '';
3722
+
3723
+
3724
+
3725
+ if($element_value[0] == $choice_label && $choice_value == $choise_value)
3726
+
3727
+ $checked = 'checked="checked"';
3728
+
3729
+ else
3730
+
3731
+ $checked = '';
3732
+
3733
+
3734
+
3735
+
3736
+
3737
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'">'.$choice_label.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$choice_value.'" title="'.htmlspecialchars($choice_label).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
3738
+
3739
+
3740
+
3741
+ }
3742
+
3743
+ }
3744
+
3745
+ }
3746
+
3747
+ else
3748
+
3749
+ {
3750
+
3751
+ if($element_value[0] == $choice && $param['w_choices_price'][$key] == $choise_value)
3752
+
3753
+ $checked = 'checked="checked"';
3754
+
3755
+ else
3756
+
3757
+ $checked = '';
3758
+
3759
+
3760
+
3761
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'">'.$choice.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$param['w_choices_price'][$key].'" title="'.htmlspecialchars($choice).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
3762
+
3763
+ }
3764
+
3765
+
3766
+
3767
+ }
3768
+
3769
+
3770
+
3771
+ $rep.='<div id="wdform_'.$id1.'_div'.$form_id.'">';
3772
+
3773
+ if($param['w_quantity']=="yes")
3774
+
3775
+ $rep.='<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">Quantity</label><input type="text" value="'.($quantity_value=='' ? 1 : $quantity_value).'" id="wdform_'.$id1.'_element_quantity'.$form_id.'" name="wdform_'.$id1.'_element_quantity'.$form_id.'" class="wdform-quantity"></div>';
3776
+
3777
+
3778
+
3779
+ if($param['w_property'][0])
3780
+
3781
+ foreach($param['w_property'] as $key => $property)
3782
+
3783
+ {
3784
+
3785
+
3786
+
3787
+ $rep.='
3788
+
3789
+ <div class="paypal-property">
3790
+
3791
+ <div style="width:150px; display:inline-block;">
3792
+
3793
+ <label class="mini_label" id="wdform_'.$id1.'_property_label_'.$form_id.''.$key.'" style="margin-right: 5px;">'.$property.'</label>
3794
+
3795
+ <select id="wdform_'.$id1.'_property'.$form_id.''.$key.'" name="wdform_'.$id1.'_property'.$form_id.''.$key.'" style="width: 100%; margin: 2px 0px;">';
3796
+
3797
+ $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
3798
+
3799
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
3800
+
3801
+ foreach($param['w_property_values'][$key] as $subkey => $property_value)
3802
+
3803
+ {
3804
+
3805
+ $rep.='<option id="wdform_'.$id1.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'" '.($property_of_radio==$property_value ? 'selected="selected"' : "").'>'.$property_value.'</option>';
3806
+
3807
+ }
3808
+
3809
+ $rep.='</select></div></div>';
3810
+
3811
+ }
3812
+
3813
+
3814
+
3815
+ $rep.='</div></div></div>';
3816
+
3817
+
3818
+
3819
+
3820
+
3821
+ $onsubmit_js.='
3822
+
3823
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_label'.$form_id.'\" />").val(
3824
+
3825
+ jQuery("label[for=\'"+jQuery("input[name^=\'wdform_'.$id1.'_element'.$form_id.'\']:checked").prop("id")+"\']").eq(0).text()
3826
+
3827
+ ).appendTo("#adminForm");
3828
+
3829
+
3830
+
3831
+ ';
3832
+
3833
+ $onsubmit_js.='
3834
+
3835
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_quantity_label'.$form_id.'\" />").val("Quantity").appendTo("#adminForm");
3836
+
3837
+ ';
3838
+
3839
+ $onsubmit_js.='
3840
+
3841
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_property_label'.$form_id.'\" />").val("'.$param['w_property'][0].'").appendTo("#adminForm");
3842
+
3843
+ ';
3844
+
3845
+ break;
3846
+
3847
+ }
3848
+
3849
+
3850
+ case 'type_paypal_shipping':
3851
+
3852
+ {
3853
+
3854
+
3855
+
3856
+ if($element_value=='')
3857
+
3858
+ $element_value =' - ';
3859
+
3860
+
3861
+
3862
+ $params_names=array('w_field_label_size','w_field_label_pos','w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_class');
3863
+
3864
+ $temp=$params;
3865
+
3866
+
3867
+
3868
+ if(strpos($temp, 'w_field_option_pos') > -1)
3869
+
3870
+ $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_option_pos', 'w_flow','w_choices','w_choices_price','w_choices_checked','w_required','w_randomize','w_allow_other','w_allow_other_num','w_choices_params', 'w_class');
3871
+
3872
+ foreach($params_names as $params_name )
3873
+
3874
+ {
3875
+
3876
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
3877
+
3878
+ $param[$params_name] = $temp[0];
3879
+
3880
+ $temp=$temp[1];
3881
+
3882
+ }
3883
+
3884
+
3885
+
3886
+ if($temp)
3887
+
3888
+ {
3889
+
3890
+ $temp =explode('*:*w_attr_name*:*',$temp);
3891
+
3892
+ $attrs = array_slice($temp,0, count($temp)-1);
3893
+
3894
+ foreach($attrs as $attr)
3895
+
3896
+ $param['attributes'] = $param['attributes'].' '.$attr;
3897
+
3898
+ }
3899
+
3900
+
3901
+
3902
+ if(!isset($param['w_field_option_pos']))
3903
+
3904
+ $param['w_field_option_pos'] = 'left';
3905
+
3906
+
3907
+
3908
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
3909
+
3910
+ $param['w_field_option_pos1'] = ($param['w_field_option_pos']=="right" ? "style='float: none !important;'" : "");
3911
+
3912
+ $param['w_field_option_pos2'] = ($param['w_field_option_pos']=="right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
3913
+
3914
+
3915
+
3916
+
3917
+
3918
+ $param['w_choices'] = explode('***',$param['w_choices']);
3919
+
3920
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
3921
+
3922
+ if(isset($param['w_choices_params']))
3923
+
3924
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
3925
+
3926
+
3927
+
3928
+
3929
+
3930
+
3931
+
3932
+ $element_value = explode(' - ',$element_value);
3933
+
3934
+ $element_value[1] = preg_replace("/[^0-9]/","",$element_value[1]);
3935
+
3936
+
3937
+
3938
+ $rep='<div type="type_paypal_shipping" class="wdform-field"><div class="wdform-label-section" style="'.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
3939
+
3940
+
3941
+
3942
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].';">';
3943
+
3944
+
3945
+
3946
+ $total_queries = 0;
3947
+
3948
+ foreach($param['w_choices'] as $key => $choice)
3949
+
3950
+ {
3951
+
3952
+ $key1 = $key + $total_queries;
3953
+
3954
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
3955
+
3956
+ {
3957
+
3958
+ $choices_labels =array();
3959
+ $choices_values =array();
3960
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
3961
+ $where = (str_replace(array('[',']'), '', $w_choices_params[0]) ? ' WHERE '.str_replace(array('[',']'), '', $w_choices_params[0]) : '');
3962
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
3963
+
3964
+ $order_by = str_replace(array('[',']'), '', $w_choices_params[0]);
3965
+ $db_info = str_replace(array('[',']'), '', $w_choices_params[1]);
3966
+
3967
+
3968
+ $label_table_and_column = explode(':',str_replace(array('[',']'), '', $choice));
3969
+
3970
+ $table = $label_table_and_column[0];
3971
+
3972
+ $label_column = $label_table_and_column[1];
3973
+
3974
+ if($label_column)
3975
+
3976
+ {
3977
+
3978
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3979
+ }
3980
+
3981
+
3982
+
3983
+ $value_table_and_column = explode(':',str_replace(array('[',']'), '', $param['w_choices_price'][$key]));
3984
+
3985
+ $value_column = $value_table_and_column[1];
3986
+
3987
+
3988
+
3989
+ if($value_column)
3990
+
3991
+ {
3992
+
3993
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3994
+
3995
+ }
3996
+
3997
+
3998
+
3999
+ $columns_count_shipping = count($choices_labels)>0 ? count($choices_labels) : count($choices_values);
4000
+
4001
+
4002
+
4003
+ if(array_filter($choices_labels) || array_filter($choices_values))
4004
+
4005
+ {
4006
+
4007
+ $total_queries = $total_queries + $columns_count_shipping-1;
4008
+
4009
+ for($k=0; $k<$columns_count_shipping; $k++)
4010
+
4011
+ {
4012
+
4013
+ $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
4014
+
4015
+ $choice_value = isset($choices_values) ? (float)$choices_values[$k] : '';
4016
+
4017
+
4018
+
4019
+ $checked =(($choice_label==$element_value[0] && $choice_value== $element_value[1]) ? 'checked="checked"' : '');
4020
+
4021
+
4022
+
4023
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'">'.$choice_label.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$choice_value.'" title="'.htmlspecialchars($choice_label).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.($key1+$k).'"></label></div></div>';
4024
+
4025
+ }
4026
+
4027
+ }
4028
+
4029
+ }
4030
+
4031
+ else
4032
+
4033
+ {
4034
+
4035
+ $checked =(($choice==$element_value[0] && $param['w_choices_price'][$key]== $element_value[1]) ? 'checked="checked"' : '');
4036
+
4037
+
4038
+
4039
+ $rep.='<div style="display: '.($param['w_flow']=='hor' ? 'inline-block' : 'table-row' ).';"><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.''.$key1.'">'.$choice.'</label><div class="radio-div forlabs"><input type="radio" id="wdform_'.$id1.'_element'.$form_id.''.$key1.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$param['w_choices_price'][$key].'" title="'.htmlspecialchars($choice).'" '.$checked.' '.$param['attributes'].'><label for="wdform_'.$id1.'_element'.$form_id.''.$key1.'"></label></div></div>';
4040
+
4041
+ }
4042
+
4043
+ }
4044
+
4045
+
4046
+
4047
+ $rep.='</div></div>';
4048
+
4049
+
4050
+
4051
+
4052
+
4053
+ $onsubmit_js.='
4054
+
4055
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_element_label'.$form_id.'\" />").val(
4056
+
4057
+ jQuery("label[for=\'"+jQuery("input[name^=\'wdform_'.$id1.'_element'.$form_id.'\']:checked").prop("id")+"\']").eq(0).text()
4058
+
4059
+ ).appendTo("#adminForm");
4060
+
4061
+
4062
+
4063
+ ';
4064
+
4065
+
4066
+
4067
+ break;
4068
+
4069
+ }
4070
+
4071
+ case 'type_star_rating': {
4072
+ if($element_value=='')
4073
+ $element_value = '/';
4074
+
4075
+ $params_names = array('w_field_label_size','w_field_label_pos','w_field_label_col','w_star_amount','w_required','w_class');
4076
+ $temp = $params;
4077
+ foreach($params_names as $params_name ) {
4078
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
4079
+ $param[$params_name] = $temp[0];
4080
+ $temp=$temp[1];
4081
+ }
4082
+
4083
+ if($temp) {
4084
+ $temp =explode('*:*w_attr_name*:*',$temp);
4085
+ $attrs = array_slice($temp,0, count($temp)-1);
4086
+ foreach($attrs as $attr)
4087
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
4088
+ }
4089
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4090
+
4091
+ $element_value = explode('/', $element_value);
4092
+
4093
+ $images = '';
4094
+ for($i=0; $i<$element_value[1]; $i++) {
4095
+ $images .= '<img id="wdform_'.$id1.'_star_'.$i.'_'.$form_id.'" src="' . WD_FMC_URL . '/images/star.png" >';
4096
+
4097
+ $onload_js .='jQuery("#wdform_'.$id1.'_star_'.$i.'_'.$form_id.'").mouseover(function() {change_src('.$i.',"wdform_'.$id1.'", "'.$form_id.'", "'.$param['w_field_label_col'].'");});';
4098
+ $onload_js .='jQuery("#wdform_'.$id1.'_star_'.$i.'_'.$form_id.'").mouseout(function() {reset_src('.$i.',"wdform_'.$id1.'", "'.$form_id.'");});';
4099
+ $onload_js .='jQuery("#wdform_'.$id1.'_star_'.$i.'_'.$form_id.'").click(function() {select_star_rating('.$i.',"wdform_'.$id1.'", "'.$form_id.'","'.$param['w_field_label_col'].'", "'.$element_value[1].'");});';
4100
+ $onload_js .='select_star_rating('.($element_value[0]-1).',"wdform_'.$id1.'", "'.$form_id.'","'.$param['w_field_label_col'].'", "'.$element_value[1].'");';
4101
+ }
4102
+
4103
+ $rep ='<div type="type_star_rating" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4104
+
4105
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div id="wdform_'.$id1.'_element'.$form_id.'" '.$param['attributes'].'>'.$images.'</div><input type="hidden" value="" id="wdform_'.$id1.'_selected_star_amount'.$form_id.'" name="wdform_'.$id1.'_selected_star_amount'.$form_id.'"></div></div>';
4106
+
4107
+
4108
+ $onsubmit_js.='
4109
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_star_amount'.$form_id.'\" value = \"'.$param['w_star_amount'].'\" />").appendTo("#form'.$form_id.'");
4110
+ ';
4111
+
4112
+ break;
4113
+ }
4114
+ case 'type_scale_rating': {
4115
+
4116
+ if($element_value=='')
4117
+ $element_value = '/';
4118
+
4119
+ $params_names=array('w_field_label_size','w_field_label_pos','w_mini_labels','w_scale_amount','w_required','w_class');
4120
+ $temp=$params;
4121
+ foreach($params_names as $params_name ) {
4122
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
4123
+ $param[$params_name] = $temp[0];
4124
+ $temp=$temp[1];
4125
+ }
4126
+
4127
+ if($temp) {
4128
+ $temp =explode('*:*w_attr_name*:*',$temp);
4129
+ $attrs = array_slice($temp,0, count($temp)-1);
4130
+ foreach($attrs as $attr)
4131
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
4132
+ }
4133
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4134
+
4135
+ $element_value = explode('/',$element_value);
4136
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
4137
+
4138
+ $numbers = '';
4139
+ $radio_buttons = '';
4140
+ $to_check=0;
4141
+ $to_check=$element_value[0];
4142
+
4143
+ for($i=1; $i<=$element_value[1]; $i++) {
4144
+ $numbers.= '<div style="text-align: center; display: table-cell;"><span>'.$i.'</span></div>';
4145
+ $radio_buttons.= '<div style="text-align: center; display: table-cell;"><div class="radio-div"><input id="wdform_'.$id1.'_scale_radio'.$form_id.'_'.$i.'" name="wdform_'.$id1.'_scale_radio'.$form_id.'" value="'.$i.'" type="radio" '.( $to_check==$i ? 'checked="checked"' : '' ).'><label for="wdform_'.$id1.'_scale_radio'.$form_id.'_'.$i.'"></label></div></div>';
4146
+ }
4147
+
4148
+ $rep ='<div type="type_scale_rating" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4149
+
4150
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div id="wdform_'.$id1.'_element'.$form_id.'" style="float: left;" '.$param['attributes'].'><label class="mini_label">'.$w_mini_labels[0].'</label><div style="display: inline-table; vertical-align: middle;border-spacing: 7px;"><div style="display: table-row;">'.$numbers.'</div><div style="display: table-row;">'.$radio_buttons.'</div></div><label class="mini_label" >'.$w_mini_labels[1].'</label></div></div></div>';
4151
+
4152
+ $onsubmit_js.='
4153
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_scale_amount'.$form_id.'\" value = \"'.$param['w_scale_amount'].'\" />").appendTo("#form'.$form_id.'");
4154
+ ';
4155
+
4156
+ break;
4157
+ }
4158
+
4159
+ case 'type_spinner': {
4160
+
4161
+ $params_names=array('w_field_label_size','w_field_label_pos','w_field_width','w_field_min_value','w_field_max_value', 'w_field_step', 'w_field_value', 'w_required','w_class');
4162
+ $temp=$params;
4163
+ foreach($params_names as $params_name ) {
4164
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
4165
+ $param[$params_name] = $temp[0];
4166
+ $temp=$temp[1];
4167
+ }
4168
+
4169
+ if($temp) {
4170
+ $temp =explode('*:*w_attr_name*:*',$temp);
4171
+ $attrs = array_slice($temp,0, count($temp)-1);
4172
+ foreach($attrs as $attr)
4173
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
4174
+ }
4175
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4176
+
4177
+
4178
+ $rep ='<div type="type_spinner" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4179
+
4180
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><input type="text" value="'.($element_value!= 'null' ? $element_value : '').'" name="wdform_'.$id1.'_element'.$form_id.'" id="wdform_'.$id1.'_element'.$form_id.'" style="width: '.$param['w_field_width'].'px;" '.$param['attributes'].'></div></div>';
4181
+
4182
+ $onload_js .='
4183
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'")[0].spin = null;
4184
+ spinner = jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner();
4185
+ spinner.spinner( "value", "'.($element_value!= 'null' ? $element_value : '').'");
4186
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ min: "'.$param['w_field_min_value'].'"});
4187
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ max: "'.$param['w_field_max_value'].'"});
4188
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ step: "'.$param['w_field_step'].'"});
4189
+ ';
4190
+
4191
+ break;
4192
+ }
4193
+
4194
+ case 'type_slider': {
4195
+
4196
+ $params_names=array('w_field_label_size','w_field_label_pos','w_field_width','w_field_min_value','w_field_max_value', 'w_field_value', 'w_required','w_class');
4197
+ $temp=$params;
4198
+ foreach($params_names as $params_name ) {
4199
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
4200
+ $param[$params_name] = $temp[0];
4201
+ $temp=$temp[1];
4202
+ }
4203
+
4204
+ if($temp) {
4205
+ $temp =explode('*:*w_attr_name*:*',$temp);
4206
+ $attrs = array_slice($temp,0, count($temp)-1);
4207
+ foreach($attrs as $attr)
4208
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
4209
+ }
4210
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4211
+
4212
+
4213
+ $rep ='<div type="type_slider" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4214
+
4215
+
4216
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><input type="hidden" value="'.$element_value.'" id="wdform_'.$id1.'_slider_value'.$form_id.'" name="wdform_'.$id1.'_slider_value'.$form_id.'"><div name="'.$id1.'_element'.$form_id.'" id="wdform_'.$id1.'_element'.$form_id.'" style="width: '.$param['w_field_width'].'px;" '.$param['attributes'].'"></div><div align="left" style="display: inline-block; width: 33.3%; text-align: left;"><span id="wdform_'.$id1.'_element_min'.$form_id.'" class="label">'.$param['w_field_min_value'].'</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: center;"><span id="wdform_'.$id1.'_element_value'.$form_id.'" class="label">'.$element_value.'</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: right;"><span id="wdform_'.$id1.'_element_max'.$form_id.'" class="label">'.$param['w_field_max_value'].'</span></div></div></div>';
4217
+
4218
+
4219
+ $onload_js .='
4220
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'")[0].slide = null;
4221
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'").slider({
4222
+ range: "min",
4223
+ value: eval('.$element_value.'),
4224
+ min: eval('.$param['w_field_min_value'].'),
4225
+ max: eval('.$param['w_field_max_value'].'),
4226
+ slide: function( event, ui ) {
4227
+
4228
+ jQuery("#wdform_'.$id1.'_element_value'.$form_id.'").html("" + ui.value)
4229
+ jQuery("#wdform_'.$id1.'_slider_value'.$form_id.'").val("" + ui.value)
4230
+
4231
+ }
4232
+ });
4233
+ ';
4234
+
4235
+ break;
4236
+ }
4237
+
4238
+
4239
+ case 'type_range': {
4240
+
4241
+ if($element_value=='')
4242
+ $element_value = '-';
4243
+
4244
+ $params_names=array('w_field_label_size','w_field_label_pos','w_field_range_width','w_field_range_step','w_field_value1', 'w_field_value2', 'w_mini_labels', 'w_required','w_class');
4245
+ $temp=$params;
4246
+ foreach($params_names as $params_name ) {
4247
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
4248
+ $param[$params_name] = $temp[0];
4249
+ $temp=$temp[1];
4250
+ }
4251
+
4252
+ if($temp) {
4253
+ $temp =explode('*:*w_attr_name*:*',$temp);
4254
+ $attrs = array_slice($temp,0, count($temp)-1);
4255
+ foreach($attrs as $attr)
4256
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
4257
+ }
4258
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4259
+
4260
+ $element_value = explode('-',$element_value);
4261
+
4262
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
4263
+
4264
+ $rep ='<div type="type_range" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4265
+
4266
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div style="display: table;"><div style="display: table-row;"><div valign="middle" align="left" style="display: table-cell;"><input type="text" value="'.($element_value[0]!= 'null' ? $element_value[0] : '').'" name="wdform_'.$id1.'_element'.$form_id.'0" id="wdform_'.$id1.'_element'.$form_id.'0" style="width: '.$param['w_field_range_width'].'px;" '.$param['attributes'].'></div><div valign="middle" align="left" style="display: table-cell; padding-left: 4px;"><input type="text" value="'.($element_value[1]!= 'null' ? $element_value[1] : '').'" name="wdform_'.$id1.'_element'.$form_id.'1" id="wdform_'.$id1.'_element'.$form_id.'1" style="width: '.$param['w_field_range_width'].'px;" '.$param['attributes'].'></div></div><div style="display: table-row;"><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_'.$id1.'_mini_label_from">'.$w_mini_labels[0].'</label></div><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_'.$id1.'_mini_label_to">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
4267
+
4268
+ $onload_js .='
4269
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'0")[0].spin = null;
4270
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'1")[0].spin = null;
4271
+
4272
+ spinner0 = jQuery("#wdform_'.$id1.'_element'.$form_id.'0").spinner();
4273
+ spinner0.spinner( "value", "'.($element_value[0]!= 'null' ? $element_value[0] : '').'");
4274
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ step: '.$param['w_field_range_step'].'});
4275
+
4276
+ spinner1 = jQuery("#wdform_'.$id1.'_element'.$form_id.'1").spinner();
4277
+ spinner1.spinner( "value", "'.($element_value[1]!= 'null' ? $element_value[1] : '').'");
4278
+ jQuery("#wdform_'.$id1.'_element'.$form_id.'").spinner({ step: '.$param['w_field_range_step'].'});
4279
+ ';
4280
+
4281
+ break;
4282
+ }
4283
+
4284
+ case 'type_grading': {
4285
+ $params_names=array('w_field_label_size','w_field_label_pos', 'w_items', 'w_total', 'w_required','w_class');
4286
+ $temp=$params;
4287
+ foreach($params_names as $params_name ) {
4288
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
4289
+ $param[$params_name] = $temp[0];
4290
+ $temp=$temp[1];
4291
+ }
4292
+
4293
+ if($temp) {
4294
+ $temp =explode('*:*w_attr_name*:*',$temp);
4295
+ $attrs = array_slice($temp,0, count($temp)-1);
4296
+ foreach($attrs as $attr)
4297
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
4298
+ }
4299
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4300
+
4301
+
4302
+ $element_value = explode(':', $element_value);
4303
+
4304
+ $w_items = explode('***',$param['w_items']);
4305
+
4306
+ $w_items_labels =implode(':',$w_items);
4307
+
4308
+ $grading_items ='';
4309
+
4310
+
4311
+ for($i=0; $i<(count($element_value))/2-1; $i++) {
4312
+ $value=$element_value[$i];
4313
+
4314
+ $grading_items .= '<div class="wdform_grading"><input type="text" id="wdform_'.$id1.'_element'.$form_id.'_'.$i.'" name="wdform_'.$id1.'_element'.$form_id.'_'.$i.'" value="'.$value.'" '.$param['attributes'].'><label class="wdform-ch-rad-label" for="wdform_'.$id1.'_element'.$form_id.'_'.$i.'">'.$w_items[$i].'</label></div>';
4315
+
4316
+ }
4317
+
4318
+ $rep ='<div type="type_grading" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4319
+
4320
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><input type="hidden" value="'.$param['w_total'].'" name="wdform_'.$id1.'_grading_total'.$form_id.'" id="wdform_'.$id1.'_grading_total'.$form_id.'"><div id="wdform_'.$id1.'_element'.$form_id.'">'.$grading_items.'<div id="wdform_'.$id1.'_element_total_div'.$form_id.'" class="grading_div">Total: <span id="wdform_'.$id1.'_sum_element'.$form_id.'">0</span>/<span id="wdform_'.$id1.'_total_element'.$form_id.'">'.$param['w_total'].'</span><span id="wdform_'.$id1.'_text_element'.$form_id.'"></span></div></div></div></div>';
4321
+
4322
+ $onload_js.='
4323
+ jQuery("#wdform_'.$id1.'_element'.$form_id.' input").change(function() {sum_grading_values("wdform_'.$id1.'","'.$form_id.'");});';
4324
+
4325
+ $onload_js.='
4326
+ jQuery("#wdform_'.$id1.'_element'.$form_id.' input").keyup(function() {sum_grading_values("wdform_'.$id1.'","'.$form_id.'");});';
4327
+
4328
+
4329
+ $onload_js.='
4330
+ sum_grading_values("wdform_'.$id1.'","'.$form_id.'");';
4331
+
4332
+ $onsubmit_js.='
4333
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_hidden_item'.$form_id.'\" value = \"'.$w_items_labels.':'.$param['w_total'].'\" />").appendTo("#form'.$form_id.'");
4334
+ ';
4335
+
4336
+ break;
4337
+ }
4338
+ case 'type_matrix': {
4339
+
4340
+ $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_input_type', 'w_rows', 'w_columns', 'w_required','w_class');
4341
+ $temp=$params;
4342
+ foreach($params_names as $params_name ) {
4343
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
4344
+ $param[$params_name] = $temp[0];
4345
+ $temp=$temp[1];
4346
+ }
4347
+
4348
+ if($temp) {
4349
+ $temp =explode('*:*w_attr_name*:*',$temp);
4350
+ $attrs = array_slice($temp,0, count($temp)-1);
4351
+ foreach($attrs as $attr)
4352
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
4353
+ }
4354
+
4355
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "display:block;");
4356
+ $w_rows = explode('***',$param['w_rows']);
4357
+ $w_columns = explode('***',$param['w_columns']);
4358
+ $element_value = str_replace("******matrix***","",$element_value);
4359
+ $element_value = explode($param['w_field_input_type'].'***', $element_value);
4360
+ $element_value = explode('***', $element_value[1]);
4361
+ $column_labels ='';
4362
+
4363
+ for($i=1; $i<count($w_columns); $i++) {
4364
+ $column_labels .= '<div><label class="wdform-ch-rad-label">'.$w_columns[$i].'</label></div>';
4365
+ }
4366
+
4367
+ $rows_columns = '';
4368
+ $for_matrix =0;
4369
+ for($i=1; $i<count($w_rows); $i++) {
4370
+
4371
+ $rows_columns .= '<div class="wdform-matrix-row'.($i%2).'"><div class="wdform-matrix-column"><label class="wdform-ch-rad-label" >'.$w_rows[$i].'</label></div>';
4372
+
4373
+
4374
+ for($k=1; $k<count($w_columns); $k++) {
4375
+ $rows_columns .= '<div class="wdform-matrix-cell">';
4376
+ if($param['w_field_input_type']=='radio') {
4377
+ if (array_key_exists($i-1,$element_value))
4378
+ $to_check=$element_value[$i-1];
4379
+ else
4380
+ $to_check= '' ;
4381
+
4382
+ $rows_columns .= '<div class="radio-div"><input id="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" type="radio" name="wdform_'.$id1.'_input_element'.$form_id.''.$i.'" value="'.$i.'_'.$k.'" '.($to_check==$i.'_'.$k ? 'checked="checked"' : '').'><label for="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'"></label></div>';
4383
+
4384
+ }
4385
+ else
4386
+ if($param['w_field_input_type']=='checkbox') {
4387
+
4388
+ if (array_key_exists($for_matrix,$element_value))
4389
+ $to_check=$element_value[$for_matrix];
4390
+ else
4391
+ $to_check= '' ;
4392
+
4393
+ $rows_columns .= '<div class="checkbox-div"><input id="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" type="checkbox" name="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" value="1" '.($to_check=="1" ? 'checked="checked"' : '').'><label for="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'"></label></div>';
4394
+
4395
+ $for_matrix++;
4396
+ }
4397
+ else
4398
+ if($param['w_field_input_type']=='text') {
4399
+ $rows_columns .= '<input id="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" type="text" name="wdform_'.$id1.'_input_element'.$form_id.''.$i.'_'.$k.'" value="'.(array_key_exists($for_matrix,$element_value) ? $element_value[$for_matrix] : '').'">';
4400
+
4401
+ $for_matrix++;
4402
+ }
4403
+ else
4404
+ if($param['w_field_input_type']=='select') {
4405
+ $rows_columns .= '<select id="wdform_'.$id1.'_select_yes_no'.$form_id.''.$i.'_'.$k.'" name="wdform_'.$id1.'_select_yes_no'.$form_id.''.$i.'_'.$k.'" ><option value="" '.(array_key_exists($for_matrix,$element_value) ? ($element_value[$for_matrix]=="" ? "selected=\"selected\"": "") : '').'> </option><option value="yes" '.(array_key_exists($for_matrix,$element_value) ? ($element_value[$for_matrix]=="yes" ? "selected=\"selected\"": "") : '').'>Yes</option><option value="no" '.(array_key_exists($for_matrix,$element_value) ? ($element_value[$for_matrix]=="no" ? "selected=\"selected\"": "") : '').'>No</option></select>';
4406
+
4407
+ $for_matrix++;
4408
+ }
4409
+ $rows_columns.='</div>';
4410
+ }
4411
+
4412
+ $rows_columns .= '</div>';
4413
+ }
4414
+
4415
+ $rep ='<div type="type_matrix" class="wdform-field"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].' width: '.$param['w_field_label_size'].'px;"><span class="wdform-label">'.$label.'</span>';
4416
+
4417
+ $rep.='</div><div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos'].'"><div id="wdform_'.$id1.'_element'.$form_id.'" class="wdform-matrix-table" '.$param['attributes'].'><div style="display: table-row-group;"><div class="wdform-matrix-head"><div style="display: table-cell;"></div>'.$column_labels.'</div>'.$rows_columns.'</div></div></div></div>';
4418
+
4419
+ $onsubmit_js.='
4420
+ jQuery("<input type=\"hidden\" name=\"wdform_'.$id1.'_input_type'.$form_id.'\" value = \"'.$param['w_field_input_type'].'\" /><input type=\"hidden\" name=\"wdform_'.$id1.'_hidden_row'.$form_id.'\" value = \"'.$param['w_rows'].'\" /><input type=\"hidden\" name=\"wdform_'.$id1.'_hidden_column'.$form_id.'\" value = \"'.$param['w_columns'].'\" />").appendTo("#form'.$form_id.'");
4421
+ ';
4422
+
4423
+ break;
4424
+ }
4425
+ }
4426
+ $form = str_replace('%'.$id1.' - '.$labels[$id1s_key].'%', $rep, $form);
4427
+ }
4428
+ }
4429
+ echo $form;
4430
+ ?>
4431
+
4432
+ </div>
4433
+ <input type="hidden" name="option" value="com_formmaker"/>
4434
+ <input type="hidden" id="current_id" name="current_id" value="<?php echo $rows[0]->group_id; ?>" />
4435
+ <input type="hidden" name="form_id" value="<?php echo $rows[0]->form_id; ?>" />
4436
+ <input type="hidden" name="date" value="<?php echo $rows[0]->date; ?>" />
4437
+ <input type="hidden" name="ip" value="<?php echo $rows[0]->ip; ?>" />
4438
+ <input type="hidden" id="task" name="task" value="" />
4439
+ <input type="hidden" value="<?php echo WD_FMC_URL; ?>" id="form_plugins_url" />
4440
+ <script type="text/javascript">
4441
+ function pressbutton() {
4442
+ <?php echo $onsubmit_js; ?>;
4443
+ }
4444
+ jQuery("div[type='type_number'] input, div[type='type_phone'] input, div[type='type_spinner'] input, div[type='type_range'] input, .wdform-quantity").keypress(function(evt) {
4445
+ return check_isnum(evt);
4446
+ });
4447
+ jQuery("div[type='type_grading'] input").keypress(function() {
4448
+ return check_isnum_or_minus(event);
4449
+ });
4450
+ plugin_url = '<?php echo WD_FMC_URL; ?>';
4451
+ <?php
4452
+ if ($onload_js) {
4453
+ ?>
4454
+ jQuery(window).load(function () {
4455
+ <?php echo $onload_js; ?>;
4456
+ });
4457
+ <?php
4458
+ }
4459
+ ?>
4460
+ </script>
4461
+ </form>
4462
+ <?php
4463
+ }
4464
+ }
4465
+
4466
+ ?>
contact-form-maker.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Contact Form Maker
4
  * Plugin URI: http://web-dorado.com/products/form-maker-wordpress.html
5
  * Description: WordPress Contact Form Maker is a simple contact form builder, which allows the user with almost no knowledge of programming to create and edit different type of contact forms.
6
- * Version: 1.8.38
7
  * Author: WebDorado
8
  * Author URI: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -207,7 +207,7 @@ add_shortcode('email_verification', 'fmc_email_verification_shortcode');
207
  function fmc_email_verification_shortcode() {
208
  require_once(WD_FMC_DIR . '/framework/WDW_FMC_Library.php');
209
  require_once(WD_FMC_DIR . '/frontend/controllers/FMControllerVerify_email_fmc.php');
210
- $controller_class = 'FMontrollerVerify_email_fmc';
211
  $controller = new $controller_class();
212
  $controller->execute();
213
  }
@@ -249,9 +249,10 @@ function register_fmcemailverification_cpt(){
249
  // Activate plugin.
250
  function form_maker_activate_cfm() {
251
  $version = get_option("wd_form_maker_version");
252
- $new_version = '1.8.38';
253
  global $wpdb;
254
  if (!$version) {
 
255
  add_option("wd_form_maker_version", $new_version, '', 'no');
256
  if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "formmaker'") == $wpdb->prefix . "formmaker") {
257
  $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
@@ -268,22 +269,17 @@ function form_maker_activate_cfm() {
268
  contact_form_maker_update('');
269
  }
270
  else {
271
-
272
  require_once WD_FMC_DIR . "/contact_form_maker_insert.php";
273
  contact_from_maker_insert();
274
  add_option("wd_cfield_limit", '9', '', 'no');
 
275
  $cf_email_verification_post = array(
276
  'post_title' => 'Email Verification',
277
  'post_content' => '[email_verification]',
278
  'post_status' => 'publish',
279
  'post_author' => 1,
280
- 'post_type' => 'fmemailverification',
281
  );
282
-
283
-
284
- add_option('fmc_settings', array('public_key' => '', 'private_key' => '', 'csv_delimiter' => ','));
285
-
286
-
287
  $cf_mail_verification_post_id = wp_insert_post( $cf_email_verification_post );
288
  $wpdb->update($wpdb->prefix . "formmaker", array(
289
  'mail_verification_post_id' => $cf_mail_verification_post_id,
@@ -293,16 +289,46 @@ function form_maker_activate_cfm() {
293
  }
294
  }
295
  elseif (version_compare($version, $new_version, '<')) {
296
- require_once WD_FMC_DIR . "/contact_form_maker_update.php";
297
- contact_form_maker_update($version);
298
- update_option("wd_form_maker_version", $new_version);
299
- $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
300
- $public_key = isset($recaptcha_keys['public_key']) ? $recaptcha_keys['public_key'] : '';
301
- $private_key = isset($recaptcha_keys['private_key']) ? $recaptcha_keys['private_key'] : '';
302
-
303
- if (FALSE === $fmc_settings = get_option('fmc_settings')) {
304
- add_option('fmc_settings', array('public_key' => $public_key, 'private_key' => $private_key, 'csv_delimiter' => ','));
305
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
 
308
  require_once WD_FMC_DIR . "/contact_form_maker_insert.php";
3
  * Plugin Name: Contact Form Maker
4
  * Plugin URI: http://web-dorado.com/products/form-maker-wordpress.html
5
  * Description: WordPress Contact Form Maker is a simple contact form builder, which allows the user with almost no knowledge of programming to create and edit different type of contact forms.
6
+ * Version: 1.8.39
7
  * Author: WebDorado
8
  * Author URI: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
207
  function fmc_email_verification_shortcode() {
208
  require_once(WD_FMC_DIR . '/framework/WDW_FMC_Library.php');
209
  require_once(WD_FMC_DIR . '/frontend/controllers/FMControllerVerify_email_fmc.php');
210
+ $controller_class = 'FMControllerVerify_email_fmc';
211
  $controller = new $controller_class();
212
  $controller->execute();
213
  }
249
  // Activate plugin.
250
  function form_maker_activate_cfm() {
251
  $version = get_option("wd_form_maker_version");
252
+ $new_version = '1.8.39';
253
  global $wpdb;
254
  if (!$version) {
255
+
256
  add_option("wd_form_maker_version", $new_version, '', 'no');
257
  if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "formmaker'") == $wpdb->prefix . "formmaker") {
258
  $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
269
  contact_form_maker_update('');
270
  }
271
  else {
 
272
  require_once WD_FMC_DIR . "/contact_form_maker_insert.php";
273
  contact_from_maker_insert();
274
  add_option("wd_cfield_limit", '9', '', 'no');
275
+ add_option('fmc_settings', array('public_key' => '', 'private_key' => '', 'csv_delimiter' => ','));
276
  $cf_email_verification_post = array(
277
  'post_title' => 'Email Verification',
278
  'post_content' => '[email_verification]',
279
  'post_status' => 'publish',
280
  'post_author' => 1,
281
+ 'post_type' => 'cfmemailverification',
282
  );
 
 
 
 
 
283
  $cf_mail_verification_post_id = wp_insert_post( $cf_email_verification_post );
284
  $wpdb->update($wpdb->prefix . "formmaker", array(
285
  'mail_verification_post_id' => $cf_mail_verification_post_id,
289
  }
290
  }
291
  elseif (version_compare($version, $new_version, '<')) {
292
+ require_once WD_FMC_DIR . "/contact_form_maker_update.php";
293
+
294
+ $mail_verification_post_ids = $wpdb->get_results($wpdb->prepare('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id!="%d"',0));
295
+ if($mail_verification_post_ids){
296
+ foreach($mail_verification_post_ids as $mail_verification_post_id) {
297
+ $update_email_ver_post_type = array(
298
+ 'ID' => (int)$mail_verification_post_id->mail_verification_post_id,
299
+ 'post_type' => 'cfmemailverification',
300
+ );
301
+
302
+ wp_update_post( $update_email_ver_post_type );
303
+ }
304
+ }
305
+ else{
306
+ $email_verification_post = array(
307
+ 'post_title' => 'Email Verification',
308
+ 'post_content' => '[email_verification]',
309
+ 'post_status' => 'publish',
310
+ 'post_author' => 1,
311
+ 'post_type' => 'cfmemailverification',
312
+ );
313
+ $mail_verification_post_id = wp_insert_post( $email_verification_post );
314
+
315
+ add_option('fm_settings', array('public_key' => '', 'private_key' => '', 'csv_delimiter' => ',', 'map_key' => ''));
316
+ $wpdb->update($wpdb->prefix . "formmaker", array(
317
+ 'mail_verification_post_id' => $mail_verification_post_id,
318
+ ), array('id' => 1), array(
319
+ '%d',
320
+ ), array('%d'));
321
+ }
322
+
323
+ contact_form_maker_update($version);
324
+ update_option("wd_form_maker_version", $new_version);
325
+ $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
326
+ $public_key = isset($recaptcha_keys['public_key']) ? $recaptcha_keys['public_key'] : '';
327
+ $private_key = isset($recaptcha_keys['private_key']) ? $recaptcha_keys['private_key'] : '';
328
+
329
+ if (FALSE === $fmc_settings = get_option('fmc_settings')) {
330
+ add_option('fmc_settings', array('public_key' => $public_key, 'private_key' => $private_key, 'csv_delimiter' => ','));
331
+ }
332
  }
333
 
334
  require_once WD_FMC_DIR . "/contact_form_maker_insert.php";
frontend/models/FMModelForm_maker_fmc.php CHANGED
@@ -1,4706 +1,4708 @@
1
- <?php
2
-
3
- class FMModelForm_maker_fmc {
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 showform($id) {
22
- global $wpdb;
23
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
24
- if (!$row || !$row->published) {
25
- return FALSE;
26
- }
27
- if (isset($_GET['test_theme']) && (esc_html(stripslashes($_GET['test_theme'])) != '')) {
28
- /* From preview.*/
29
- $theme_id = esc_html(stripslashes($_GET['test_theme']));
30
- }
31
- else {
32
- $theme_id = $row->theme;
33
- }
34
- $form_theme = $wpdb->get_var($wpdb->prepare('SELECT css FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
35
- if (!$form_theme) {
36
- $form_theme = $wpdb->get_var('SELECT css FROM ' . $wpdb->prefix . 'formmaker_themes');
37
- if (!$form_theme) {
38
- return FALSE;
39
- }
40
- }
41
- $label_id = array();
42
- $label_type = array();
43
- $label_all = explode('#****#', $row->label_order);
44
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
45
- foreach ($label_all as $key => $label_each) {
46
- $label_id_each = explode('#**id**#', $label_each);
47
- array_push($label_id, $label_id_each[0]);
48
- $label_order_each = explode('#**label**#', $label_id_each[1]);
49
- array_push($label_type, $label_order_each[1]);
50
- }
51
- return array(
52
- $row,
53
- 1,
54
- $label_id,
55
- $label_type,
56
- $form_theme
57
- );
58
- }
59
-
60
- public function savedata($form, $id) {
61
- $fmc_settings = get_option('fmc_settings');
62
- $all_files = array();
63
- $correct = FALSE;
64
- $id_for_old = $id;
65
- if (!$form->form_front) {
66
- $id = '';
67
- }
68
- if (isset($_POST["counter" . $id])) {
69
- $counter = esc_html($_POST["counter" . $id]);
70
- if (isset($_POST["captcha_input"])) {
71
- $captcha_input = esc_html($_POST["captcha_input"]);
72
- $session_wd_captcha_code = isset($_SESSION[$id . '_wd_captcha_code']) ? $_SESSION[$id . '_wd_captcha_code'] : '-';
73
- if (md5($captcha_input) == $session_wd_captcha_code) {
74
- $correct = TRUE;
75
- }
76
- else {
77
- ?>
78
- <script>alert("<?php echo addslashes(__('Error, incorrect Security code.', 'form_maker')); ?>");</script>
79
- <?php
80
- }
81
- }
82
- elseif (isset($_POST["arithmetic_captcha_input"])) {
83
- $arithmetic_captcha_input = esc_html($_POST["arithmetic_captcha_input"]);
84
- $session_wd_arithmetic_captcha_code = isset($_SESSION[$id . '_wd_arithmetic_captcha_code']) ? $_SESSION[$id . '_wd_arithmetic_captcha_code'] : '-';
85
- if (md5($arithmetic_captcha_input) == $session_wd_arithmetic_captcha_code) {
86
- $correct = TRUE;
87
- }
88
- else {
89
- ?>
90
- <script>alert("<?php echo addslashes(__('Error, incorrect Security code.', 'form_maker')); ?>");</script>
91
- <?php
92
- }
93
- }
94
- elseif (isset($_POST["g-recaptcha-response"])){
95
- $privatekey= isset($fmc_settings['private_key']) ? $fmc_settings['private_key'] : '';
96
- $captcha = $_POST['g-recaptcha-response'];
97
- $url = 'https://www.google.com/recaptcha/api/siteverify';
98
- $data = array(
99
- 'secret' => $privatekey,
100
- 'response' => $captcha,
101
- 'remoteip' => $_SERVER['REMOTE_ADDR']
102
- );
103
-
104
- $curlConfig = array(
105
- CURLOPT_URL => $url,
106
- CURLOPT_POST => true,
107
- CURLOPT_RETURNTRANSFER => true,
108
- CURLOPT_POSTFIELDS => $data
109
- );
110
-
111
- $ch = curl_init();
112
- curl_setopt_array($ch, $curlConfig);
113
- $response = curl_exec($ch);
114
- curl_close($ch);
115
-
116
- $jsonResponse = json_decode($response);
117
-
118
- if ($jsonResponse->success == "true")
119
- $correct = TRUE;
120
- else {
121
- ?>
122
- <script>alert("<?php echo addslashes(__('Error, incorrect Security code.', 'form_maker')); ?>");</script>
123
- <?php
124
- }
125
- }
126
- else {
127
- $correct = TRUE;
128
- }
129
- if ($correct) {
130
-
131
- $ip=$_SERVER['REMOTE_ADDR'];
132
-
133
- global $wpdb;
134
- $blocked_ip = $wpdb->get_var($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $ip));
135
- if ($blocked_ip) {
136
- $_SESSION['massage_after_submit' . $id] = addslashes(__('Your ip is blacklisted. Please contact the website administrator.', 'form_maker'));
137
- wp_redirect($_SERVER["REQUEST_URI"]);//to be checked
138
- exit;
139
- }
140
-
141
- $result_temp = $this->save_db($counter, $id_for_old);
142
- $all_files = $result_temp[0];
143
- if (is_numeric($all_files)) {
144
- $this->remove($all_files, $id_for_old);
145
- }
146
- elseif (isset($counter)) {
147
- $this->gen_mail($counter, $all_files, $id_for_old, $result_temp[1]);
148
- }
149
-
150
- }
151
- return $all_files;
152
- }
153
-
154
- return $all_files;
155
- }
156
-
157
- public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
158
- global $wpdb;
159
-
160
- $query = "SELECT `".$label_column."` FROM ".$table.$where." ORDER BY ".$order_by;
161
- if($db_info)
162
- {
163
-
164
- $temp = explode('@@@wdfhostwdf@@@',$db_info);
165
- $host = $temp[0];
166
- $temp = explode('@@@wdfportwdf@@@',$temp[1]);
167
- $port = $temp[0];
168
- $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
169
- $username = $temp[0];
170
- $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
171
- $password = $temp[0];
172
- $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
173
- $database = $temp[0];
174
-
175
- $wpdb_temp = new wpdb($username, $password, $database, $host);
176
- $choices_labels = $wpdb_temp->get_results($query,ARRAY_N);
177
- }
178
- else{
179
- $choices_labels = $wpdb->get_results($query,ARRAY_N);
180
- }
181
- return $choices_labels;
182
- }
183
-
184
- public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
185
- global $wpdb;
186
-
187
- $query = "SELECT `".$value_column."` FROM ".$table.$where." ORDER BY ".$order_by;
188
- if($db_info)
189
- {
190
- $temp = explode('@@@wdfhostwdf@@@',$db_info);
191
- $host = $temp[0];
192
- $temp = explode('@@@wdfportwdf@@@',$temp[1]);
193
- $port = $temp[0];
194
- $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
195
- $username = $temp[0];
196
- $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
197
- $password = $temp[0];
198
- $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
199
- $database = $temp[0];
200
-
201
- $wpdb_temp = new wpdb($username, $password, $database, $host);
202
- $choices_values = $wpdb_temp->get_results($query,ARRAY_N);
203
- }
204
- else{
205
- $choices_values = $wpdb->get_results($query,ARRAY_N);
206
- }
207
- return $choices_values;
208
- }
209
-
210
- public function save_db($counter, $id) {
211
- global $wpdb;
212
- $current_user = wp_get_current_user();
213
- if ($current_user->ID != 0)
214
- {
215
- $wp_userid = $current_user->ID;
216
- $wp_username = $current_user->display_name;
217
- $wp_useremail = $current_user->user_email;
218
- }
219
- else
220
- {
221
- $wp_userid = '';
222
- $wp_username = '';
223
- $wp_useremail = '';
224
- }
225
- $ip = $_SERVER['REMOTE_ADDR'];
226
-
227
- $chgnac = TRUE;
228
- $all_files = array();
229
- $paypal = array();
230
- $paypal['item_name'] = array();
231
- $paypal['quantity'] = array();
232
- $paypal['amount'] = array();
233
- $is_amount=false;
234
- $paypal['on_os'] = array();
235
- $total = 0;
236
- $form_currency = '$';
237
- $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
238
- $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
239
- $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id= %d", $id));
240
- $id_old = $id;
241
- if (!$form->form_front) {
242
- $id = '';
243
- }
244
- if ($form->payment_currency) {
245
- $form_currency = $currency_sign[array_search($form->payment_currency, $currency_code)];
246
- }
247
- $old = false;
248
- if(isset($form->form)) {
249
- $old = true;
250
- }
251
- $label_id = array();
252
- $label_label = array();
253
- $label_type = array();
254
-
255
- $disabled_fields = explode(',', (isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : ""));
256
- $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
257
-
258
- if($old == false || ($old == true && $form->form=='')) {
259
- $label_all = explode('#****#',$form->label_order_current);
260
- }
261
- else {
262
- $label_all = explode('#****#',$form->label_order);
263
- }
264
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
265
- foreach ($label_all as $key => $label_each) {
266
- $label_id_each = explode('#**id**#', $label_each);
267
- array_push($label_id, $label_id_each[0]);
268
- $label_order_each = explode('#**label**#', $label_id_each[1]);
269
- array_push($label_label, $label_order_each[0]);
270
- array_push($label_type, $label_order_each[1]);
271
- }
272
- $max = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
273
- $fvals=array();
274
- if ($old == FALSE || ($old == TRUE && $form->form == '')) {
275
- foreach ($label_type as $key => $type) {
276
- $value = '';
277
- if ($type == "type_submit_reset" or $type == "type_map" or $type == "type_editor" or $type == "type_captcha" or $type == "type_arithmetic_captcha" or $type == "type_recaptcha" or $type == "type_button" or $type == "type_paypal_total" or $type == "type_send_copy")
278
- continue;
279
-
280
- $i = $label_id[$key];
281
- if(!in_array($i,$disabled_fields)) {
282
- switch ($type) {
283
- case 'type_text':
284
- case 'type_password':
285
- case 'type_textarea':
286
- case "type_submitter_mail":
287
- case "type_date":
288
- case "type_own_select":
289
- case "type_country":
290
- case "type_number": {
291
- $value = isset($_POST['wdform_'.$i."_element".$id]) ? esc_html($_POST['wdform_'.$i."_element".$id]) : "";
292
- break;
293
- }
294
- case "type_wdeditor": {
295
- $value = isset($_POST['wdform_'.$i.'_wd_editor'.$id]) ? esc_html($_POST['wdform_'.$i.'_wd_editor'.$id]) : "";
296
- break;
297
- }
298
- case "type_mark_map": {
299
- $value = (isset($_POST['wdform_'.$i."_long".$id]) ? $_POST['wdform_'.$i."_long".$id] : "") . '***map***' . (isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "");
300
- break;
301
- }
302
- case "type_date_fields": {
303
- $value = (isset($_POST['wdform_'.$i."_day".$id]) ? $_POST['wdform_'.$i."_day".$id] : "") . '-' . (isset($_POST['wdform_'.$i."_month".$id]) ? $_POST['wdform_'.$i."_month".$id] : "") . '-' . (isset($_POST['wdform_'.$i."_year".$id]) ? $_POST['wdform_'.$i."_year".$id] : "");
304
- break;
305
- }
306
- case "type_time": {
307
- $ss = isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : NULL;
308
- if(isset($ss)) {
309
- $value = (isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : "") . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "") . ':' . (isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : "");
310
- }
311
- else {
312
- $value = (isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : "") . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
313
- }
314
- $am_pm = isset($_POST['wdform_'.$i."_am_pm".$id]) ? $_POST['wdform_'.$i."_am_pm".$id] : NULL;
315
- if(isset($am_pm)) {
316
- $value = $value . ' ' . $am_pm;
317
- }
318
- break;
319
- }
320
- case "type_phone": {
321
- $value = (isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : "") . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "");
322
- break;
323
- }
324
- case "type_name": {
325
- $element_title = isset($_POST['wdform_'.$i."_element_title".$id]) ? esc_html($_POST['wdform_'.$i."_element_title".$id]) : NULL;
326
- $element_middle = isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : NULL;
327
- if(isset($element_title) || isset($element_middle)) {
328
- $value = (isset($_POST['wdform_'.$i."_element_title".$id]) ? esc_html($_POST['wdform_'.$i."_element_title".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_first".$id]) ? esc_html($_POST['wdform_'.$i."_element_first".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? esc_html($_POST['wdform_'.$i."_element_last".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : "");
329
- }
330
- else {
331
- $value = (isset($_POST['wdform_'.$i."_element_first".$id]) ? esc_html($_POST['wdform_'.$i."_element_first".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? esc_html($_POST['wdform_'.$i."_element_last".$id]) : "");
332
- }
333
- break;
334
- }
335
- case "type_file_upload": {
336
- $files = isset($_FILES['wdform_'.$i.'_file'.$id]) ? $_FILES['wdform_'.$i.'_file'.$id] : NULL;
337
- foreach($files['name'] as $file_key => $file_name) {
338
- if($file_name) {
339
- $untilupload = $form->form_fields;
340
- $untilupload = substr($untilupload, strpos($untilupload,$i.'*:*id*:*type_file_upload'), -1);
341
- $untilupload = substr($untilupload, 0, strpos($untilupload,'*:*new_field*:'));
342
- $untilupload = explode('*:*w_field_label_pos*:*',$untilupload);
343
- $untilupload = $untilupload[1];
344
- $untilupload = explode('*:*w_destination*:*',$untilupload);
345
- $destination = $untilupload[0];
346
- $destination = str_replace(site_url() . '/', '', $destination);
347
- $untilupload = $untilupload[1];
348
- $untilupload = explode('*:*w_extension*:*',$untilupload);
349
- $extension = $untilupload[0];
350
- $untilupload = $untilupload[1];
351
- $untilupload = explode('*:*w_max_size*:*',$untilupload);
352
- $max_size = $untilupload[0];
353
- $untilupload = $untilupload[1];
354
- $fileName = $files['name'][$file_key];
355
- $fileSize = $files['size'][$file_key];
356
-
357
- if($fileSize > $max_size * 1024) {
358
- echo "<script> alert('" . addslashes(__('The file exceeds the allowed size of', 'form_maker')) . $max_size . " KB');</script>";
359
- return array($max+1);
360
- }
361
-
362
- $uploadedFileNameParts = explode('.',$fileName);
363
- $uploadedFileExtension = array_pop($uploadedFileNameParts);
364
- $to = strlen($fileName) - strlen($uploadedFileExtension) - 1;
365
-
366
- $fileNameFree = substr($fileName, 0, $to);
367
- $invalidFileExts = explode(',', $extension);
368
- $extOk = false;
369
-
370
- foreach($invalidFileExts as $key => $valuee) {
371
- if(is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension)))) {
372
- $extOk = true;
373
- }
374
- }
375
-
376
- if ($extOk == false) {
377
- echo "<script> alert('" . addslashes(__('Sorry, you are not allowed to upload this type of file.', 'form_maker')) . "');</script>";
378
- return array($max+1);
379
- }
380
-
381
- $fileTemp = $files['tmp_name'][$file_key];
382
- $p = 1;
383
-
384
- if(!file_exists($destination))
385
- mkdir($destination , 0777);
386
- if (file_exists($destination . "/" . $fileName)) {
387
- $fileName1 = $fileName;
388
- while (file_exists($destination . "/" . $fileName1)) {
389
- $to = strlen($file_name) - strlen($uploadedFileExtension) - 1;
390
- $fileName1 = substr($fileName, 0, $to) . '(' . $p . ').' . $uploadedFileExtension;
391
- // $file['name'] = $fileName;
392
- $p++;
393
- }
394
- $fileName = $fileName1;
395
- }
396
-
397
- // for dropbox & google drive integration addons
398
- $check_both = 0;
399
- if($form->save_uploads == 0){
400
- if(defined('WD_FM_DBOX_INT') && is_plugin_active(constant('WD_FM_DBOX_INT'))){
401
- $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix ."formmaker_dbox_int WHERE form_id=" . $form->id);
402
- if($enable == 1){
403
- $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix ."formmaker_dbox_int WHERE form_id=" . $form->id);
404
-
405
- if((int)$selectable_upload == 1){
406
- $temp_dir_dbox = explode('\\', $fileTemp);
407
- $temp_dir_dbox = implode('%%', $temp_dir_dbox);
408
-
409
- $value.= $temp_dir_dbox . '*@@url@@*' . $fileName;
410
- }
411
- else{
412
- $dlink_dbox = '<a href="'.add_query_arg(array('action' => 'WD_FM_DBOX_INT', 'addon_task' => 'upload_dbox_file', 'id' => $form->id), admin_url('admin-ajax.php')).'&dbox_file_name=' . $fileName . '&dbox_folder_name=/'.$form->title.'" >' . $fileName . '</a>';
413
-
414
- $value.= $dlink_dbox;
415
- }
416
-
417
- $files['tmp_name'][$file_key]=$fileTemp;
418
- $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
419
- }
420
- else
421
- $check_both ++;
422
-
423
- }
424
- else
425
- $check_both ++;
426
- if(defined('WD_FM_GDRIVE_INT') && is_plugin_active(constant('WD_FM_GDRIVE_INT'))){
427
- $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix ."formmaker_gdrive_int WHERE form_id=" . $form->id);
428
- if($enable == 1){
429
- $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix ."formmaker_gdrive_int WHERE form_id=" . $form->id);
430
-
431
- if((int)$selectable_upload == 1){
432
- $temp_dir_dbox = explode('\\', $fileTemp);
433
- $temp_dir_dbox = implode('%%', $temp_dir_dbox);
434
- $value.= 'wdCloudAddon' . $temp_dir_dbox . '*@@url@@*' . $fileName . '*@@url@@*' . $files['type'][$file_key];
435
- }
436
- else{
437
- $dlink_dbox = '<a target="_blank" href="'.add_query_arg(array('action' => 'WD_FM_GDRIVE_INT', 'addon_task' => 'create_drive_link', 'id' => $form->id), admin_url('admin-ajax.php')).'&gdrive_file_name=' . $fileName . '&gdrive_folder_name='.$form->title.'" >' . $fileName . '</a>';
438
- $value.= $dlink_dbox;
439
- }
440
-
441
- $files['tmp_name'][$file_key]=$fileTemp;
442
- $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
443
- }
444
- else
445
- $check_both ++;
446
-
447
- }
448
- else
449
- $check_both ++;
450
-
451
- }
452
- //
453
- if($check_both != 0){
454
- $value.= '';
455
- $files['tmp_name'][$file_key]=$fileTemp;
456
- $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
457
- }
458
- // dropbox and google drive integration addons
459
- if($form->save_uploads == 1){
460
- if(!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
461
- echo "<script> alert('" . addslashes(__('Error, file cannot be moved.', 'form_maker')) . "');</script>";
462
- return array($max+1);
463
- }
464
- $value.= site_url() . '/' . $destination . '/' . $fileName . '*@@url@@*';
465
- $files['tmp_name'][$file_key]=$destination . "/" . $fileName;
466
- $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
467
-
468
- }
469
- array_push($all_files,$temp_file);
470
- }
471
- }
472
- break;
473
- }
474
-
475
- case 'type_address': {
476
- $value = '*#*#*#';
477
- $element = isset($_POST['wdform_'.$i."_street1".$id]) ? esc_html($_POST['wdform_'.$i."_street1".$id]) : NULL;
478
- if(isset($element)) {
479
- $value = $element;
480
- break;
481
- }
482
-
483
- $element = isset($_POST['wdform_'.$i."_street2".$id]) ? esc_html($_POST['wdform_'.$i."_street2".$id]) : NULL;
484
- if(isset($element)) {
485
- $value = $element;
486
- break;
487
- }
488
-
489
- $element = isset($_POST['wdform_'.$i."_city".$id]) ? esc_html($_POST['wdform_'.$i."_city".$id]) : NULL;
490
- if(isset($element)) {
491
- $value = $element;
492
- break;
493
- }
494
-
495
- $element = isset($_POST['wdform_'.$i."_state".$id]) ? esc_html($_POST['wdform_'.$i."_state".$id]) : NULL;
496
- if(isset($element)) {
497
- $value = $element;
498
- break;
499
- }
500
-
501
- $element = isset($_POST['wdform_'.$i."_postal".$id]) ? esc_html($_POST['wdform_'.$i."_postal".$id]) : NULL;
502
- if(isset($element)) {
503
- $value = $element;
504
- break;
505
- }
506
-
507
- $element = isset($_POST['wdform_'.$i."_country".$id]) ? esc_html($_POST['wdform_'.$i."_country".$id]) : NULL;
508
- if(isset($element)) {
509
- $value = $element;
510
- break;
511
- }
512
- break;
513
- }
514
-
515
- case "type_hidden": {
516
- $value = isset($_POST[$label_label[$key]]) ? esc_html($_POST[$label_label[$key]]) : "";
517
- break;
518
- }
519
-
520
- case "type_radio": {
521
- $element = isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL;
522
- if(isset($element)) {
523
- $value = $element;
524
- break;
525
- }
526
- $value = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "";
527
- break;
528
- }
529
-
530
- case "type_checkbox": {
531
- $start = -1;
532
- $value = '';
533
- for($j = 0; $j < 100; $j++) {
534
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
535
- if(isset($element)) {
536
- $start = $j;
537
- break;
538
- }
539
- }
540
-
541
- $other_element_id = -1;
542
- $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
543
- if($is_other == "yes") {
544
- $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
545
- }
546
-
547
- if($start != -1) {
548
- for($j = $start; $j < 100; $j++) {
549
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
550
- if(isset($element)) {
551
- if($j == $other_element_id) {
552
- $value = $value . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '***br***';
553
- }
554
- else {
555
- $value = $value . (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "") . '***br***';
556
- }
557
- }
558
- }
559
- }
560
- break;
561
- }
562
-
563
- case "type_paypal_price": {
564
- $value = isset($_POST['wdform_'.$i."_element_dollars".$id]) ? $_POST['wdform_'.$i."_element_dollars".$id] : 0;
565
-
566
- $value = (int) preg_replace('/\D/', '', $value);
567
-
568
- if(isset($_POST['wdform_'.$i."_element_cents".$id])) {
569
- $value = $value . '.' . ( preg_replace('/\D/', '', $_POST['wdform_'.$i."_element_cents".$id]));
570
- }
571
-
572
- $total += (float)($value);
573
- $paypal_option = array();
574
-
575
- if($value != 0) {
576
- $quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : 1);
577
- array_push ($paypal['item_name'], $label_label[$key]);
578
- array_push ($paypal['quantity'], $quantity);
579
- array_push ($paypal['amount'], $value);
580
- $is_amount=true;
581
- array_push ($paypal['on_os'], $paypal_option);
582
- }
583
- $value = $value . $form_currency;
584
- break;
585
- }
586
-
587
- case "type_paypal_select": {
588
- if(isset($_POST['wdform_'.$i."_element_label".$id]) && $_POST['wdform_'.$i."_element".$id] !='') {
589
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
590
- }
591
- else {
592
- $value = '';
593
- }
594
- $quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : 1);
595
- $total += (float)(isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : 0) * $quantity;
596
- array_push ($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : ""));
597
- array_push ($paypal['quantity'], $quantity);
598
- array_push ($paypal['amount'], (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : ""));
599
- if(isset($_POST['wdform_'.$i."_element".$id]) && $_POST['wdform_'.$i."_element".$id] != 0) {
600
- $is_amount=true;
601
- }
602
- $element_quantity = isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
603
- if(isset($element_quantity) && $value != '') {
604
- $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : "") . ': ' . $_POST['wdform_'.$i."_element_quantity".$id] . '***quantity***';
605
- }
606
- $paypal_option = array();
607
- $paypal_option['on'] = array();
608
- $paypal_option['os'] = array();
609
-
610
- for($k = 0; $k < 50; $k++) {
611
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
612
- if(isset($temp_val) && $value != '') {
613
- array_push ($paypal_option['on'], (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : ""));
614
- array_push ($paypal_option['os'], (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : ""));
615
- $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : "") . '***property***';
616
- }
617
- }
618
- array_push ($paypal['on_os'], $paypal_option);
619
- break;
620
- }
621
-
622
- case "type_paypal_radio": {
623
- if(isset($_POST['wdform_'.$i."_element_label".$id])) {
624
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
625
- }
626
- else {
627
- $value = '';
628
- }
629
- $quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : 1);
630
- $total += (float)(isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : 0) * $quantity;
631
- array_push ($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : ""));
632
- array_push ($paypal['quantity'], $quantity);
633
- array_push ($paypal['amount'], (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : 0));
634
- if(isset($_POST['wdform_'.$i."_element".$id]) && $_POST['wdform_'.$i."_element".$id] != 0) {
635
- $is_amount=true;
636
- }
637
-
638
- $element_quantity = isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
639
- if(isset($element_quantity) && $value != '') {
640
- $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : "") . ': ' . $_POST['wdform_'.$i."_element_quantity".$id] . '***quantity***';
641
- }
642
-
643
- $paypal_option = array();
644
- $paypal_option['on'] = array();
645
- $paypal_option['os'] = array();
646
-
647
- for($k = 0; $k < 50; $k++) {
648
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
649
- if(isset($temp_val) && $value != '') {
650
- array_push ($paypal_option['on'], (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : ""));
651
- array_push ($paypal_option['os'], $_POST['wdform_'.$i."_property".$id.$k]);
652
- $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $_POST['wdform_'.$i."_property".$id.$k] . '***property***';
653
- }
654
- }
655
- array_push ($paypal['on_os'], $paypal_option);
656
- break;
657
- }
658
-
659
- case "type_paypal_shipping": {
660
- if(isset($_POST['wdform_'.$i."_element_label".$id])) {
661
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
662
- }
663
- else {
664
- $value = '';
665
- }
666
- $value = (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : "") . ' - ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
667
- $paypal['shipping'] = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "";
668
- break;
669
- }
670
-
671
- case "type_paypal_checkbox": {
672
- $start = -1;
673
- $value = '';
674
- for($j = 0; $j < 100; $j++) {
675
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
676
- if(isset($element)) {
677
- $start = $j;
678
- break;
679
- }
680
- }
681
-
682
- $other_element_id = -1;
683
- $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
684
- if($is_other == "yes") {
685
- $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
686
- }
687
-
688
- if($start != -1) {
689
- for($j = $start; $j < 100; $j++) {
690
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
691
- if(isset($element)) {
692
- if($j == $other_element_id) {
693
- $value = $value . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '***br***';
694
- }
695
- else {
696
- $value = $value . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "") . ' - ' . (isset($_POST['wdform_'.$i."_element".$id.$j]) && $_POST['wdform_'.$i."_element".$id.$j] == '' ? '0' : (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "")) . $form_currency . '***br***';
697
- $quantity = ((isset($_POST['wdform_' . $i . "_element_quantity" . $id]) && ($_POST['wdform_' . $i . "_element_quantity" . $id] >= 1)) ? $_POST['wdform_'.$i . "_element_quantity" . $id] : 1);
698
- $total += (float)(isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : 0) * (float)($quantity);
699
- array_push ($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : ""));
700
- array_push ($paypal['quantity'], $quantity);
701
- array_push ($paypal['amount'], (isset($_POST['wdform_'.$i."_element".$id.$j]) ? ($_POST['wdform_'.$i."_element".$id.$j] == '' ? '0' : $_POST['wdform_'.$i."_element".$id.$j]) : ""));
702
- if (isset($_POST['wdform_'.$i."_element".$id.$j]) && $_POST['wdform_'.$i."_element".$id.$j] != 0) {
703
- $is_amount = TRUE;
704
- }
705
- $paypal_option = array();
706
- $paypal_option['on'] = array();
707
- $paypal_option['os'] = array();
708
-
709
- for($k = 0; $k < 50; $k++) {
710
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
711
- if(isset($temp_val)) {
712
- array_push ($paypal_option['on'], isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "");
713
- array_push ($paypal_option['os'], $_POST['wdform_'.$i."_property".$id.$k]);
714
- }
715
- }
716
- array_push ($paypal['on_os'], $paypal_option);
717
- }
718
- }
719
- }
720
-
721
- $element_quantity = isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
722
- if(isset($element_quantity)) {
723
- $value .= (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : "") . ': ' . $_POST['wdform_'.$i."_element_quantity".$id] . '***quantity***';
724
- }
725
- for($k = 0; $k < 50; $k++) {
726
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
727
- if(isset($temp_val)) {
728
- $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $_POST['wdform_'.$i."_property".$id.$k] . '***property***';
729
- }
730
- }
731
- }
732
- break;
733
- }
734
-
735
- case "type_star_rating": {
736
- if(isset($_POST['wdform_'.$i."_selected_star_amount".$id]) && $_POST['wdform_'.$i."_selected_star_amount".$id] == "") {
737
- $selected_star_amount = 0;
738
- }
739
- else {
740
- $selected_star_amount = isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : 0;
741
- }
742
- $value = $selected_star_amount . '/' . (isset($_POST['wdform_'.$i."_star_amount".$id]) ? $_POST['wdform_'.$i."_star_amount".$id] : "");
743
- break;
744
- }
745
-
746
- case "type_scale_rating": {
747
- $value = (isset($_POST['wdform_'.$i."_scale_radio".$id]) ? $_POST['wdform_'.$i."_scale_radio".$id] : 0) . '/' . (isset($_POST['wdform_'.$i."_scale_amount".$id]) ? $_POST['wdform_'.$i."_scale_amount".$id] : "");
748
- break;
749
- }
750
-
751
- case "type_spinner": {
752
- $value = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "";
753
- break;
754
- }
755
-
756
- case "type_slider": {
757
- $value = isset($_POST['wdform_'.$i."_slider_value".$id]) ? $_POST['wdform_'.$i."_slider_value".$id] : "";
758
- break;
759
- }
760
-
761
- case "type_range": {
762
- $value = (isset($_POST['wdform_'.$i."_element".$id.'0']) ? $_POST['wdform_'.$i."_element".$id.'0'] : "") . '-' . (isset($_POST['wdform_'.$i."_element".$id.'1']) ? $_POST['wdform_'.$i."_element".$id.'1'] : "");
763
- break;
764
- }
765
-
766
- case "type_grading": {
767
- $value = "";
768
- $items = explode(":", isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "");
769
- for($k = 0; $k < sizeof($items) - 1; $k++) {
770
- $value .= (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : "") . ':';
771
- }
772
- $value .= (isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "") . '***grading***';
773
- break;
774
- }
775
-
776
- case "type_matrix": {
777
- $rows_of_matrix = explode("***", isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "");
778
- $rows_count = sizeof($rows_of_matrix) - 1;
779
- $column_of_matrix = explode("***", isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "");
780
- $columns_count = sizeof($column_of_matrix) - 1;
781
-
782
- if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "radio") {
783
- $input_value = "";
784
- for($k = 1; $k <= $rows_count; $k++) {
785
- $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k]) ? $_POST['wdform_'.$i."_input_element".$id.$k] : 0) . "***";
786
- }
787
- }
788
- if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "checkbox") {
789
- $input_value = "";
790
- for($k = 1; $k <= $rows_count; $k++) {
791
- for($j = 1; $j <= $columns_count; $j++) {
792
- $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : 0)."***";
793
- }
794
- }
795
- }
796
-
797
- if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "text") {
798
- $input_value = "";
799
- for($k = 1; $k <= $rows_count; $k++) {
800
- for($j = 1; $j <= $columns_count; $j++) {
801
- $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? esc_html($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) : "") . "***";
802
- }
803
- }
804
- }
805
-
806
- if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "select") {
807
- $input_value = "";
808
- for($k = 1; $k <= $rows_count; $k++) {
809
- for($j = 1; $j <= $columns_count; $j++) {
810
- $input_value .= (isset($_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j] : "") . "***";
811
- }
812
- }
813
- }
814
-
815
- $value = $rows_count . (isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "") . '***' . $columns_count . (isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "") . '***' . (isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : "") . '***' . $input_value . '***matrix***';
816
- break;
817
- }
818
-
819
- }
820
-
821
- if($type == "type_address") {
822
- if( $value == '*#*#*#') {
823
- continue;
824
- }
825
- }
826
- if($type == "type_text" or $type == "type_password" or $type == "type_textarea" or $type == "type_name" or $type == "type_submitter_mail" or $type == "type_number" or $type == "type_phone")
827
- {
828
- $untilupload = $form->form_fields;
829
- $untilupload = substr($untilupload, strpos($untilupload, $i.'*:*id*:*'.$type), -1);
830
- $untilupload = substr($untilupload, 0, strpos($untilupload, '*:*new_field*:'));
831
- $untilupload = explode('*:*w_required*:*', $untilupload);
832
- $untilupload = $untilupload[1];
833
- $untilupload = explode('*:*w_unique*:*', $untilupload);
834
- $unique_element = $untilupload[0];
835
- if(strlen($unique_element)>3)
836
- $unique_element = substr($unique_element, -3);
837
-
838
- if($unique_element == 'yes') {
839
- $unique = $wpdb->get_col($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id= %d and element_label= %s and element_value= %s", $id, $i, addslashes($value)));
840
- if ($unique) {
841
- echo "<script> alert('" . addslashes(__('This field %s requires a unique entry and this value was already submitted.', 'form_maker')) . "'.replace('%s','" . $label_label[$key] . "'));</script>";
842
- return array($max + 1);
843
- }
844
- }
845
- }
846
- $save_or_no = TRUE;
847
- $fvals['{'.$i.'}']=str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***"), array(" ", "", " ", " ", " ", ", "), addslashes($value));
848
- if ($form->savedb) {
849
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
850
- 'form_id' => $id,
851
- 'element_label' => $i,
852
- 'element_value' => stripslashes($value),
853
- 'group_id' => ($max + 1),
854
- 'date' => date('Y-m-d H:i:s'),
855
- 'ip' => $_SERVER['REMOTE_ADDR'],
856
- 'user_id_wd' => $current_user->ID,
857
- ), array(
858
- '%d',
859
- '%s',
860
- '%s',
861
- '%d',
862
- '%s',
863
- '%s',
864
- '%d'
865
- ));
866
- }
867
- if (!$save_or_no) {
868
- return FALSE;
869
- }
870
- $chgnac = FALSE;
871
- }
872
- else{
873
- $fvals['{'.$i.'}']='';
874
- }
875
- }
876
- }
877
- else {
878
- foreach ($label_type as $key => $type) {
879
- $value = '';
880
- if ($type == "type_submit_reset" or $type == "type_map" or $type == "type_editor" or $type == "type_captcha" or $type == "type_arithmetic_captcha" or $type == "type_recaptcha" or $type == "type_button" or $type=="type_paypal_total")
881
- continue;
882
- $i = $label_id[$key];
883
- if ($type != "type_address") {
884
- $deleted = isset($_POST[$i . "_type" . $id]) ? $_POST[$i . "_type" . $id] : NULL;
885
- if (!isset($deleted))
886
- break;
887
- }
888
- if ($type == 'type_paypal_total') {
889
- continue;
890
- }
891
- switch ($type) {
892
- case 'type_text':
893
- case 'type_password':
894
- case 'type_textarea':
895
- case "type_submitter_mail":
896
- case "type_date":
897
- case "type_own_select":
898
- case "type_country":
899
- case "type_number": {
900
- $value = isset($_POST[$i . "_element" . $id]) ? esc_html($_POST[$i . "_element" . $id]) : "";
901
- break;
902
- }
903
- case "type_mark_map": {
904
- $value = (isset($_POST[$i . "_long" . $id]) ? $_POST[$i . "_long" . $id] : "") . '***map***' . (isset($_POST[$i . "_lat" . $id]) ? $_POST[$i . "_lat" . $id] : "");
905
- break;
906
- }
907
- case "type_date_fields": {
908
- $value = (isset($_POST[$i . "_day" . $id]) ? $_POST[$i . "_day" . $id] : "") . '-' . (isset($_POST[$i . "_month" . $id]) ? $_POST[$i . "_month" . $id] : "") . '-' . (isset($_POST[$i . "_year" . $id]) ? $_POST[$i . "_year" . $id] : "");
909
- break;
910
- }
911
- case "type_time": {
912
- $ss = isset($_POST[$i . "_ss" . $id]) ? $_POST[$i . "_ss" . $id] : NULL;
913
- if (isset($ss)) {
914
- $value = (isset($_POST[$i . "_hh" . $id]) ? $_POST[$i . "_hh" . $id] : "") . ':' . (isset($_POST[$i . "_mm" . $id]) ? $_POST[$i . "_mm" . $id] : "") . ':' . $ss;
915
- }
916
- else {
917
- $value = (isset($_POST[$i . "_hh" . $id]) ? $_POST[$i . "_hh" . $id] : "") . ':' . (isset($_POST[$i . "_mm" . $id]) ? $_POST[$i . "_mm" . $id] : "");
918
- }
919
- $am_pm = isset($_POST[$i . "_am_pm" . $id]) ? $_POST[$i . "_am_pm" . $id] : NULL;
920
- if (isset($am_pm))
921
- $value = $value . ' ' . $am_pm;
922
- break;
923
- }
924
- case "type_phone": {
925
- $value = (isset($_POST[$i . "_element_first" . $id]) ? $_POST[$i . "_element_first" . $id] : "") . ' ' . (isset($_POST[$i . "_element_last" . $id]) ? $_POST[$i . "_element_last" . $id] : "");
926
- break;
927
- }
928
- case "type_name": {
929
- $element_title = isset($_POST[$i . "_element_title" . $id]) ? esc_html($_POST[$i . "_element_title" . $id]) : NULL;
930
- if (isset($element_title)) {
931
- $value = $element_title . ' ' . (isset($_POST[$i . "_element_first" . $id]) ? esc_html($_POST[$i . "_element_first" . $id]) : "") . ' ' . (isset($_POST[$i . "_element_last" . $id]) ? esc_html($_POST[$i . "_element_last" . $id]) : "") . ' ' . (isset($_POST[$i . "_element_middle" . $id]) ? esc_html($_POST[$i . "_element_middle" . $id]) : "");
932
- }
933
- else {
934
- $value = (isset($_POST[$i . "_element_first" . $id]) ? esc_html($_POST[$i . "_element_first" . $id]) : "") . ' ' . (isset($_POST[$i . "_element_last" . $id]) ? esc_html($_POST[$i . "_element_last" . $id]) : "");
935
- }
936
- break;
937
- }
938
- case "type_file_upload": {
939
- $file = isset($_FILES[$i . '_file' . $id]) ? $_FILES[$i . '_file' . $id] : NULL;
940
- if ($file['name']) {
941
- $untilupload = $form->form;
942
- $pos1 = strpos($untilupload, "***destinationskizb" . $i . "***");
943
- $pos2 = strpos($untilupload, "***destinationverj" . $i . "***");
944
- $destination = substr($untilupload, $pos1 + (23 + (strlen($i) - 1)), $pos2 - $pos1 - (23 + (strlen($i) - 1)));
945
- $pos1 = strpos($untilupload, "***extensionskizb" . $i . "***");
946
- $pos2 = strpos($untilupload, "***extensionverj" . $i . "***");
947
- $extension = substr($untilupload, $pos1 + (21 + (strlen($i) - 1)), $pos2 - $pos1 - (21 + (strlen($i) - 1)));
948
- $pos1 = strpos($untilupload, "***max_sizeskizb" . $i . "***");
949
- $pos2 = strpos($untilupload, "***max_sizeverj" . $i . "***");
950
- $max_size = substr($untilupload, $pos1 + (20 + (strlen($i) - 1)), $pos2 - $pos1 - (20 + (strlen($i) - 1)));
951
- $fileName = $file['name'];
952
- $destination = str_replace(site_url() . '/', '', $destination);
953
- $fileSize = $file['size'];
954
- if ($fileSize > $max_size * 1024) {
955
- echo "<script> alert('" . addslashes(__('The file exceeds the allowed size of', 'form_maker')) . $max_size . " KB');</script>";
956
- return array($max + 1);
957
- }
958
- $uploadedFileNameParts = explode('.', $fileName);
959
- $uploadedFileExtension = array_pop($uploadedFileNameParts);
960
- $to = strlen($fileName) - strlen($uploadedFileExtension) - 1;
961
- $fileNameFree = substr($fileName, 0, $to);
962
- $invalidFileExts = explode(',', $extension);
963
- $extOk = FALSE;
964
- foreach ($invalidFileExts as $key => $value) {
965
- if (is_numeric(strpos(strtolower($value), strtolower($uploadedFileExtension)))) {
966
- $extOk = TRUE;
967
- }
968
- }
969
- if ($extOk == FALSE) {
970
- echo "<script> alert('" . addslashes(__('Sorry, you are not allowed to upload this type of file.', 'form_maker')) . "');</script>";
971
- return array($max + 1);
972
- }
973
- $fileTemp = $file['tmp_name'];
974
- $p = 1;
975
-
976
- if(!file_exists($destination))
977
- mkdir($destination , 0777);
978
-
979
- if (file_exists($destination . "/" . $fileName)) {
980
- $fileName1 = $filename;
981
- while (file_exists($destination . "/" . $fileName1)) {
982
- $to = strlen($file['name']) - strlen($uploadedFileExtension) - 1;
983
- $fileName1 = substr($fileName, 0, $to) . '(' . $p . ').' . $uploadedFileExtension;
984
- $file['name'] = $fileName;
985
- $p++;
986
- }
987
- $fileName = $fileName1;
988
- }
989
- if (is_dir(ABSPATH . $destination)) {
990
- if (!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
991
- echo "<script> alert('" . addslashes(__('Error, file cannot be moved.', 'form_maker')) . "');</script>";
992
- return array($max + 1);
993
- }
994
- }
995
- else {
996
- echo "<script> alert('" . addslashes(__('Error, file destination does not exist.', 'form_maker')) . "');</script>";
997
- return array($max + 1);
998
- }
999
- $value = site_url() . '/' . $destination . '/' . $fileName . '*@@url@@*';
1000
- $file['tmp_name'] = $destination . "/" . $fileName;
1001
- $file['name'] = ABSPATH . $destination . "/" . $fileName;
1002
- // $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
1003
- array_push($all_files, $file);
1004
- }
1005
- break;
1006
- }
1007
- case 'type_address': {
1008
- $value = '*#*#*#';
1009
- if (isset($_POST[$i . "_street1" . $id])) {
1010
- $value = esc_html($_POST[$i . "_street1" . $id]);
1011
- break;
1012
- }
1013
- if (isset($_POST[$i . "_street2" . $id])) {
1014
- $value = esc_html($_POST[$i . "_street2" . $id]);
1015
- break;
1016
- }
1017
- if (isset($_POST[$i . "_city" . $id])) {
1018
- $value = esc_html($_POST[$i . "_city" . $id]);
1019
- break;
1020
- }
1021
- if (isset($_POST[$i . "_state" . $id])) {
1022
- $value = esc_html($_POST[$i . "_state" . $id]);
1023
- break;
1024
- }
1025
- if (isset($_POST[$i . "_postal" . $id])) {
1026
- $value = esc_html($_POST[$i . "_postal" . $id]);
1027
- break;
1028
- }
1029
- if (isset($_POST[$i . "_country" . $id])) {
1030
- $value = esc_html($_POST[$i . "_country" . $id]);
1031
- break;
1032
- }
1033
- break;
1034
- }
1035
- case "type_hidden": {
1036
- $value = isset($_POST[$label_label[$key]]) ? $_POST[$label_label[$key]] : "";
1037
- break;
1038
- }
1039
- case "type_radio": {
1040
- $element = isset($_POST[$i . "_other_input" . $id]) ? $_POST[$i . "_other_input" . $id] : NULL;
1041
- if (isset($element)) {
1042
- $value = $element;
1043
- break;
1044
- }
1045
- $value = isset($_POST[$i . "_element" . $id]) ? $_POST[$i . "_element" . $id] : "";
1046
- break;
1047
- }
1048
- case "type_checkbox": {
1049
- $start = -1;
1050
- $value = '';
1051
- for ($j = 0; $j < 100; $j++) {
1052
- if (isset($_POST[$i . "_element" . $id . $j])) {
1053
- $start = $j;
1054
- break;
1055
- }
1056
- }
1057
- $other_element_id = -1;
1058
- $is_other = isset($_POST[$i . "_allow_other" . $id]) ? $_POST[$i . "_allow_other" . $id] : "";
1059
- if ($is_other == "yes") {
1060
- $other_element_id = isset($_POST[$i . "_allow_other_num" . $id]) ? $_POST[$i . "_allow_other_num" . $id] : "";
1061
- }
1062
- if ($start != -1) {
1063
- for ($j = $start; $j < 100; $j++) {
1064
- if (isset($_POST[$i . "_element" . $id . $j])) {
1065
- if ($j == $other_element_id) {
1066
- $value = $value . (isset($_POST[$i . "_other_input" . $id]) ? $_POST[$i . "_other_input" . $id] : "") . '***br***';
1067
- }
1068
- else {
1069
- $value = $value . $_POST[$i . "_element" . $id . $j] . '***br***';
1070
- }
1071
- }
1072
- }
1073
- }
1074
- break;
1075
- }
1076
- case "type_paypal_price": {
1077
- $value = 0;
1078
- if (isset($_POST[$i."_element_dollars".$id])) {
1079
- $value = $_POST[$i . "_element_dollars" . $id];
1080
- }
1081
- $value = (int) preg_replace('/\D/', '', $value);
1082
- if (isset($_POST[$i . "_element_cents" . $id])) {
1083
- $value = $value . '.' . (preg_replace('/\D/', '', $_POST[$i . "_element_cents" . $id]));
1084
- }
1085
- $total += (float)($value);
1086
- $paypal_option = array();
1087
- if ($value != 0) {
1088
- array_push($paypal['item_name'], $label_label[$key]);
1089
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1090
- array_push($paypal['quantity'], $quantity);
1091
- array_push($paypal['amount'], $value);
1092
- $is_amount=true;
1093
- array_push($paypal['on_os'], $paypal_option);
1094
- }
1095
- $value = $value . $form_currency;
1096
- break;
1097
- }
1098
- case "type_paypal_select": {
1099
- $value = '';
1100
- $value = (isset($_POST[$i . "_element_label" . $id]) ? $_POST[$i . "_element_label" . $id] : "") . ' : ' . (isset($_POST[$i . "_element" . $id]) ? $_POST[$i . "_element" . $id] : "") . $form_currency;
1101
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1102
- $total += (float)(isset($_POST[$i . "_element" . $id]) ? $_POST[$i . "_element" . $id] : 0) * (float)($quantity);
1103
- array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST[$i."_element_label".$id]) ? $_POST[$i."_element_label".$id] : ""));
1104
- array_push($paypal['quantity'], $quantity);
1105
- array_push($paypal['amount'], isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "");
1106
- if(isset($_POST[$i."_element".$id]) && $_POST[$i."_element".$id] != 0) {
1107
- $is_amount=true;
1108
- }
1109
- $element_quantity_label = isset($_POST[$i."_element_quantity_label".$id]) ? $_POST[$i."_element_quantity_label".$id] : NULL;
1110
- if (isset($element_quantity_label)) {
1111
- $value .= '***br***' . $element_quantity_label . ': ' . $quantity;
1112
- }
1113
- $paypal_option=array();
1114
- $paypal_option['on']=array();
1115
- $paypal_option['os']=array();
1116
- for($k=0; $k<50; $k++) {
1117
- $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1118
- if(isset($temp_val)) {
1119
- array_push($paypal_option['on'], isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "");
1120
- array_push($paypal_option['os'], $temp_val);
1121
- $value .= '***br***' . (isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
1122
- }
1123
- }
1124
- array_push($paypal['on_os'], $paypal_option);
1125
- break;
1126
- }
1127
- case "type_paypal_radio": {
1128
- $value = '';
1129
- if (isset($_POST[$i."_element_label".$id]) && ($_POST[$i."_element_label".$id] != '')) {
1130
- $value = $_POST[$i."_element_label".$id] . ' - ' . (isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "") . $form_currency;
1131
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1132
- $total+=(float)(isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : 0)*(float)($quantity);
1133
- array_push($paypal['item_name'], $label_label[$key] . ' ' . $_POST[$i."_element_label".$id]);
1134
- array_push($paypal['quantity'], $quantity);
1135
- array_push($paypal['amount'], isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "");
1136
- if(isset($_POST[$i."_element".$id]) && $_POST[$i."_element".$id] != 0) {
1137
- $is_amount=true;
1138
- }
1139
- $element_quantity_label = isset($_POST[$i."_element_quantity_label".$id]) ? $_POST[$i."_element_quantity_label".$id] : NULL;
1140
- if (isset($element_quantity_label)) {
1141
- $value .= '***br***' . $element_quantity_label . ': ' . $quantity;
1142
- }
1143
- $paypal_option = array();
1144
- $paypal_option['on'] = array();
1145
- $paypal_option['os'] = array();
1146
- for ($k = 0; $k < 50; $k++) {
1147
- $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1148
- if(isset($temp_val)) {
1149
- array_push ($paypal_option['on'], isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "");
1150
- array_push ($paypal_option['os'], $temp_val);
1151
- $value .= '***br***' . (isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
1152
- }
1153
- }
1154
- array_push ($paypal['on_os'], $paypal_option);
1155
- }
1156
- break;
1157
- }
1158
- case "type_paypal_shipping": {
1159
- $value = '';
1160
- if (isset($_POST[$i."_element_label".$id]) && ($_POST[$i."_element_label".$id] != '')) {
1161
- $value = $_POST[$i."_element_label".$id] . ' - ' . (isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "") . $form_currency;
1162
- $paypal['shipping'] = isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "";
1163
- }
1164
- break;
1165
- }
1166
- case "type_paypal_checkbox": {
1167
- $start = -1;
1168
- $value = '';
1169
- for ($j = 0; $j < 100; $j++) {
1170
- if (isset($_POST[$i."_element".$id.$j])) {
1171
- $start = $j;
1172
- break;
1173
- }
1174
- }
1175
- $other_element_id = -1;
1176
- $is_other = isset($_POST[$i."_allow_other".$id]) ? $_POST[$i."_allow_other".$id] : "";
1177
- if ($is_other == "yes") {
1178
- $other_element_id = isset($_POST[$i."_allow_other_num".$id]) ? $_POST[$i."_allow_other_num".$id] : "";
1179
- }
1180
- if ($start != -1) {
1181
- for ($j = $start; $j < 100; $j++) {
1182
- if (isset($_POST[$i."_element".$id.$j])) {
1183
- if ($j == $other_element_id) {
1184
- $value = $value . (isset($_POST[$i."_other_input".$id]) ? $_POST[$i."_other_input".$id] : "") . '***br***';
1185
- }
1186
- else {
1187
- $value = $value . (isset($_POST[$i."_element".$id.$j."_label"]) ? $_POST[$i."_element".$id.$j."_label"] : "") . ' - ' . ($_POST[$i."_element".$id.$j] == '' ? '0' : $_POST[$i."_element".$id.$j]) . $form_currency . '***br***';
1188
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1189
- $total += (float)(isset($_POST[$i."_element".$id.$j]) ? $_POST[$i."_element".$id.$j] : 0) * (float)($quantity);
1190
- array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST[$i."_element".$id.$j."_label"]) ? $_POST[$i."_element".$id.$j."_label"] : ""));
1191
- array_push($paypal['quantity'], $quantity);
1192
- array_push($paypal['amount'], ($_POST[$i."_element".$id.$j] == '') ? '0' : $_POST[$i."_element".$id.$j]);
1193
- if (isset($_POST[$i."_element".$id.$j]) && $_POST[$i."_element".$id.$j] != 0) {
1194
- $is_amount = TRUE;
1195
- }
1196
- $paypal_option = array();
1197
- $paypal_option['on'] = array();
1198
- $paypal_option['os'] = array();
1199
- for ($k = 0; $k < 50; $k++) {
1200
- $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1201
- if (isset($temp_val)) {
1202
- array_push ($paypal_option['on'], isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "");
1203
- array_push ($paypal_option['os'], $temp_val);
1204
- }
1205
- }
1206
- array_push ($paypal['on_os'], $paypal_option);
1207
- }
1208
- }
1209
- }
1210
- $element_quantity_label = isset($_POST[$i."_element_quantity_label".$id]) ? $_POST[$i."_element_quantity_label".$id] : NULL;
1211
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1212
- if (isset($element_quantity_label)) {
1213
- $value .= $element_quantity_label . ': ' . $quantity . '***br***';
1214
- }
1215
- for ($k = 0; $k < 50; $k++) {
1216
- $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1217
- if (isset($temp_val)) {
1218
- $value .= (isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val . '***br***';
1219
- }
1220
- }
1221
- }
1222
- break;
1223
- }
1224
- case "type_star_rating": {
1225
- if (isset($_POST[$i."_selected_star_amount".$id]) && $_POST[$i."_selected_star_amount".$id] != "") {
1226
- $selected_star_amount = $_POST[$i."_selected_star_amount".$id];
1227
- }
1228
- else {
1229
- $selected_star_amount = 0;
1230
- }
1231
- $value = (isset($_POST[$i."_star_amount".$id]) ? $_POST[$i."_star_amount".$id] : '').'***'.$selected_star_amount.'***'.(isset($_POST[$i."_star_color".$id]) ? $_POST[$i."_star_color".$id] : '').'***star_rating***';
1232
- break;
1233
- }
1234
- case "type_scale_rating": {
1235
- $value = (isset($_POST[$i."_scale_radio".$id]) ? $_POST[$i."_scale_radio".$id] : 0).'/'.(isset($_POST[$i."_scale_amount".$id]) ? $_POST[$i."_scale_amount".$id] : '');
1236
- break;
1237
- }
1238
- case "type_spinner": {
1239
- $value = (isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : '');
1240
- break;
1241
- }
1242
- case "type_slider": {
1243
- $value = (isset($_POST[$i."_slider_value".$id]) ? $_POST[$i."_slider_value".$id] : '');
1244
- break;
1245
- }
1246
- case "type_range": {
1247
- $value = (isset($_POST[$i."_element".$id . '0']) ? $_POST[$i."_element".$id . '0'] : '') .'-'.(isset($_POST[$i."_element".$id.'1']) ? $_POST[$i."_element".$id.'1'] : '');
1248
- break;
1249
- }
1250
- case "type_grading": {
1251
- $value = "";
1252
- if (isset($_POST[$i."_hidden_item".$id])) {
1253
- $items = explode(":", $_POST[$i."_hidden_item".$id]);
1254
- for ($k = 0; $k < sizeof($items) - 1; $k++) {
1255
- if (isset($_POST[$i."_element".$id.$k])) {
1256
- $value .= $_POST[$i."_element".$id.$k].':';
1257
- }
1258
- }
1259
- $value .= $_POST[$i."_hidden_item".$id].'***grading***';
1260
- }
1261
- break;
1262
- }
1263
- case "type_matrix": {
1264
- $rows_of_matrix = explode("***", isset($_POST[$i."_hidden_row".$id]) ? $_POST[$i."_hidden_row".$id] : "");
1265
- $rows_count = sizeof($rows_of_matrix) - 1;
1266
- $column_of_matrix = explode("***", isset($_POST[$i."_hidden_column".$id]) ? $_POST[$i."_hidden_column".$id] : "");
1267
- $columns_count = sizeof($column_of_matrix) - 1;
1268
- $row_ids = explode(",", substr(isset($_POST[$i."_row_ids".$id]) ? $_POST[$i."_row_ids".$id] : "", 0, -1));
1269
- $column_ids = explode(",", substr(isset($_POST[$i."_column_ids".$id]) ? $_POST[$i."_column_ids".$id] : "", 0, -1));
1270
- if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "radio") {
1271
- $input_value="";
1272
- foreach($row_ids as $row_id) {
1273
- $input_value.=(isset($_POST[$i."_input_element".$id.$row_id]) ? $_POST[$i."_input_element".$id.$row_id] : 0)."***";
1274
- }
1275
- }
1276
- if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "checkbox") {
1277
- $input_value="";
1278
- foreach($row_ids as $row_id)
1279
- foreach($column_ids as $column_id)
1280
- $input_value .= (isset($_POST[$i."_input_element".$id.$row_id.'_'.$column_id]) ? $_POST[$i."_input_element".$id.$row_id.'_'.$column_id] : 0)."***";
1281
- }
1282
- if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "text") {
1283
- $input_value="";
1284
- foreach($row_ids as $row_id)
1285
- foreach($column_ids as $column_id)
1286
- $input_value .= (isset($_POST[$i."_input_element".$id.$row_id.'_'.$column_id]) ? esc_html($_POST[$i."_input_element".$id.$row_id.'_'.$column_id]) : "")."***";
1287
- }
1288
- if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "select") {
1289
- $input_value="";
1290
- foreach($row_ids as $row_id)
1291
- foreach($column_ids as $column_id)
1292
- $input_value .= (isset($_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id]) ? $_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id] : "")."***";
1293
- }
1294
- $value = $rows_count . '***' . (isset($_POST[$i."_hidden_row".$id]) ? $_POST[$i."_hidden_row".$id] : "") . $columns_count . '***' . (isset($_POST[$i."_hidden_column".$id]) ? $_POST[$i."_hidden_column".$id] : "") . (isset($_POST[$i."_input_type".$id]) ? $_POST[$i."_input_type".$id] : "") . '***' .$input_value . '***matrix***';
1295
- break;
1296
- }
1297
- }
1298
- if ($type == "type_address") {
1299
- if ($value == '*#*#*#') {
1300
- // break; ?????????????????????????????????????????????????????
1301
- continue;
1302
- }
1303
- }
1304
- $unique_element = isset($_POST[$i . "_unique" . $id]) ? $_POST[$i . "_unique" . $id] : "";
1305
- if ($unique_element == 'yes') {
1306
- $unique = $wpdb->get_col($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id= %d and element_label= %s and element_value= %s", $id_old, $i, addslashes($value)));
1307
- if ($unique) {
1308
- echo "<script> alert('" . addslashes(__('This field %s requires a unique entry and this value was already submitted.', 'form_maker')) . "'.replace('%s','" . $label_label[$key] . "'));</script>";
1309
- return array($max + 1);
1310
- }
1311
- }
1312
-
1313
- $r = $wpdb->prefix . "formmaker_submits";
1314
-
1315
- $save_or_no = $wpdb->insert($r, array(
1316
- 'form_id' => $id_old,
1317
- 'element_label' => $i,
1318
- 'element_value' => stripslashes($value),
1319
- 'group_id' => ($max + 1),
1320
- 'date' => date('Y-m-d H:i:s'),
1321
- 'ip' => $ip,
1322
- 'user_id_wd' => $current_user->ID,
1323
- ), array(
1324
- '%d',
1325
- '%s',
1326
- '%s',
1327
- '%d',
1328
- '%s',
1329
- '%s',
1330
- '%d'
1331
- ));
1332
- if (!$save_or_no) {
1333
- return FALSE;
1334
- }
1335
- $chgnac = FALSE;
1336
- }
1337
- }
1338
-
1339
-
1340
- $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
1341
- $user_fields = array("subid"=>$subid, "ip"=>$ip, "userid"=>$wp_userid, "username"=>$wp_username, "useremail"=>$wp_useremail);
1342
-
1343
- $queries = $wpdb->get_results( $wpdb->prepare("SELECT * FROM " .$wpdb->prefix. "formmaker_query WHERE form_id=%d",(int)$id ));
1344
- if($queries)
1345
- {
1346
- foreach($queries as $query)
1347
- {
1348
- $temp = explode('***wdfcon_typewdf***',$query->details);
1349
- $con_type = $temp[0];
1350
- $temp = explode('***wdfcon_methodwdf***',$temp[1]);
1351
- $con_method = $temp[0];
1352
- $temp = explode('***wdftablewdf***',$temp[1]);
1353
- $table_cur = $temp[0];
1354
- $temp = explode('***wdfhostwdf***',$temp[1]);
1355
- $host = $temp[0];
1356
- $temp = explode('***wdfportwdf***',$temp[1]);
1357
- $port = $temp[0];
1358
- $temp = explode('***wdfusernamewdf***',$temp[1]);
1359
- $username = $temp[0];
1360
- $temp = explode('***wdfpasswordwdf***',$temp[1]);
1361
- $password = $temp[0];
1362
- $temp = explode('***wdfdatabasewdf***',$temp[1]);
1363
- $database = $temp[0];
1364
-
1365
- $query=str_replace(array_keys($fvals), $fvals ,$query->query);
1366
- foreach($user_fields as $user_key=>$user_field)
1367
- $query=str_replace('{'.$user_key.'}', $user_field , $query);
1368
-
1369
- if($con_type == 'remote')
1370
- {
1371
- $wpdb_temp = new wpdb($username, $password, $database, $host);
1372
- $wpdb_temp->query($query);
1373
- }
1374
- else {
1375
- $wpdb->query($query);
1376
- }
1377
- }
1378
- // $wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
1379
- }
1380
-
1381
- $addons = array('WD_FM_MAILCHIMP' => 'MailChimp', 'WD_FM_REG' => 'Registration');
1382
- foreach($addons as $addon => $addon_name)
1383
- {
1384
- if (defined($addon) && is_plugin_active(constant($addon))) {
1385
- $_GET['addon_task']='frontend';
1386
- $_GET['form_id']=$id;
1387
- $GLOBALS['fvals']=$fvals;
1388
- do_action($addon.'_init');
1389
- }
1390
- }
1391
-
1392
- $str = '';
1393
-
1394
- if ($form->paypal_mode) {
1395
- if ($paypal['item_name']) {
1396
- if ($is_amount) {
1397
- $tax = $form->tax;
1398
- $currency = $form->payment_currency;
1399
- $business = $form->paypal_email;
1400
- $ip = $_SERVER['REMOTE_ADDR'];
1401
- $total2 = round($total, 2);
1402
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1403
- 'form_id' => $id,
1404
- 'element_label' => 'item_total',
1405
- 'element_value' => $total2 . $form_currency,
1406
- 'group_id' => ($max + 1),
1407
- 'date' => date('Y-m-d H:i:s'),
1408
- 'ip' => $ip,
1409
- 'user_id_wd' => $current_user->ID,
1410
- ), array(
1411
- '%d',
1412
- '%s',
1413
- '%s',
1414
- '%d',
1415
- '%s',
1416
- '%s',
1417
- '%d'
1418
- ));
1419
- if (!$save_or_no) {
1420
- return false;
1421
- }
1422
- $total = $total + ($total * $tax) / 100;
1423
- if (isset($paypal['shipping'])) {
1424
- $total = $total + $paypal['shipping'];
1425
- }
1426
- $total = round($total, 2);
1427
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1428
- 'form_id' => $id,
1429
- 'element_label' => 'total',
1430
- 'element_value' => $total . $form_currency,
1431
- 'group_id' => ($max + 1),
1432
- 'date' => date('Y-m-d H:i:s'),
1433
- 'ip' => $ip,
1434
- 'user_id_wd' => $current_user->ID,
1435
- ), array(
1436
- '%d',
1437
- '%s',
1438
- '%s',
1439
- '%d',
1440
- '%s',
1441
- '%s',
1442
- '%d'
1443
- ));
1444
- if (!$save_or_no) {
1445
- return false;
1446
- }
1447
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1448
- 'form_id' => $id,
1449
- 'element_label' => '0',
1450
- 'element_value' => 'In progress',
1451
- 'group_id' => ($max + 1),
1452
- 'date' => date('Y-m-d H:i:s'),
1453
- 'ip' => $ip,
1454
- 'user_id_wd' => $current_user->ID,
1455
- ), array(
1456
- '%d',
1457
- '%s',
1458
- '%s',
1459
- '%d',
1460
- '%s',
1461
- '%s',
1462
- '%d'
1463
- ));
1464
- if (!$save_or_no) {
1465
- return false;
1466
- }
1467
- $str = '';
1468
- if ($form->checkout_mode==1 || $form->checkout_mode == "production") {
1469
- $str .= "https://www.paypal.com/cgi-bin/webscr?";
1470
- }
1471
- else {
1472
- $str .= "https://www.sandbox.paypal.com/cgi-bin/webscr?";
1473
- }
1474
- $str .= "currency_code=" . $currency;
1475
- $str .= "&business=" . urlencode($business);
1476
- $str .= "&cmd=" . "_cart";
1477
- $str .= "&notify_url=" . admin_url('admin-ajax.php?action=checkpaypal%26form_id=' . $id . '%26group_id=' . ($max + 1));
1478
- $str .= "&upload=" . "1";
1479
- $str .= "&charset=UTF-8";
1480
- if (isset($paypal['shipping'])) {
1481
- $str = $str . "&shipping_1=" . $paypal['shipping'];
1482
- // $str=$str."&weight_cart=".$paypal['shipping'];
1483
- // $str=$str."&shipping2=3".$paypal['shipping'];
1484
- $str = $str."&no_shipping=2";
1485
- }
1486
- $i=0;
1487
- foreach ($paypal['item_name'] as $pkey => $pitem_name) {
1488
- if($paypal['amount'][$pkey]) {
1489
- $i++;
1490
- $str = $str."&item_name_".$i."=".urlencode($pitem_name);
1491
- $str = $str."&amount_".$i."=".$paypal['amount'][$pkey];
1492
- $str = $str."&quantity_".$i."=".$paypal['quantity'][$pkey];
1493
- if ($tax) {
1494
- $str = $str . "&tax_rate_" . $i . "=" . $tax;
1495
- }
1496
- if ($paypal['on_os'][$pkey]) {
1497
- foreach ($paypal['on_os'][$pkey]['on'] as $on_os_key => $on_item_name) {
1498
- $str = $str."&on".$on_os_key."_".$i."=".$on_item_name;
1499
- $str = $str."&os".$on_os_key."_".$i."=".$paypal['on_os'][$pkey]['os'][$on_os_key];
1500
- }
1501
- }
1502
- }
1503
- }
1504
- }
1505
- }
1506
- }
1507
-
1508
- if($form->mail_verify){
1509
- unset($_SESSION['hash']);
1510
- unset($_SESSION['gid']);
1511
- $ip = $_SERVER['REMOTE_ADDR'];
1512
- $_SESSION['gid'] = $max+1;
1513
- $send_tos = explode('**',$form->send_to);
1514
- if($send_tos){
1515
- foreach($send_tos as $send_index => $send_to)
1516
- {
1517
- $_SESSION['hash'][] = md5($ip.time().rand());
1518
- $send_to = str_replace('*', '',$send_to);
1519
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1520
- 'form_id' => $id,
1521
- 'element_label' => 'verifyInfo@'.$send_to,
1522
- 'element_value' => $_SESSION['hash'][$send_index]."**".$form->mail_verify_expiretime."**".$send_to,
1523
- 'group_id' => ($max + 1),
1524
- 'date' => date('Y-m-d H:i:s'),
1525
- 'ip' => $ip,
1526
- 'user_id_wd' => $current_user->ID,
1527
- ), array(
1528
- '%d',
1529
- '%s',
1530
- '%s',
1531
- '%d',
1532
- '%s',
1533
- '%s',
1534
- '%d'
1535
- ));
1536
- if (!$save_or_no) {
1537
- return false;
1538
- }
1539
- }
1540
- }
1541
- }
1542
-
1543
-
1544
- if ($chgnac) {
1545
- global $wpdb;
1546
- if ($form->submit_text_type != 4) {
1547
- $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Nothing was submitted.', 'form_maker')));
1548
- }
1549
- $_SESSION['error_or_no' . $id] = 1;
1550
- $_SESSION['form_submit_type' . $id] = $form->submit_text_type . "," . $form->id;
1551
- wp_redirect($_SERVER["REQUEST_URI"]);
1552
- exit;
1553
- }
1554
-
1555
- $addons = array('WD_FM_GDRIVE_INT' => 'GDriveInt', 'WD_FM_DBOX_INT' => 'DboxInt', 'WD_FM_POST_GEN' => 'PostGen', 'WD_FM_PUSHOVER' => 'Pushover'); // the sequence is important for google drive and drop box addons !!!!!!!!!!
1556
- foreach($addons as $addon => $addon_name) {
1557
- if (defined($addon) && is_plugin_active(constant($addon))) {
1558
- $_GET['addon_task'] = 'frontend';
1559
- $_GET['form_id'] = $id;
1560
- $GLOBALS['all_files'] = json_encode($all_files);
1561
- $GLOBALS['form_currency'] = $form_currency;
1562
- do_action($addon.'_init');
1563
- }
1564
- }
1565
- return array($all_files, $str);
1566
- }
1567
-
1568
- public function remove($group_id) {
1569
- global $wpdb;
1570
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id= %d', $group_id));
1571
- }
1572
-
1573
- public function get_after_submission_text($form_id) {
1574
- global $wpdb;
1575
- $submit_text = $wpdb->get_var("SELECT submit_text FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
1576
- $current_user = wp_get_current_user();
1577
- if ($current_user->ID != 0){
1578
- $userid = $current_user->ID;
1579
- $username = $current_user->display_name;
1580
- $useremail = $current_user->user_email;
1581
- } else{
1582
- $userid = '';
1583
- $username = '';
1584
- $useremail = '';
1585
- }
1586
- $ip = $_SERVER['REMOTE_ADDR'];
1587
- $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
1588
- $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $form_id));
1589
-
1590
- $old = false;
1591
- if(isset($row->form)) {
1592
- $old = true;
1593
- }
1594
- $label_order_original = array();
1595
- $label_order_ids = array();
1596
- $submission_array = array();
1597
- if($old == false || ($old == true && $row->form == '')) {
1598
- $label_all = explode('#****#',$row->label_order_current);
1599
- } else {
1600
- $label_all = explode('#****#',$row->label_order);
1601
- }
1602
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
1603
- foreach ($label_all as $key => $label_each) {
1604
- $label_id_each = explode('#**id**#', $label_each);
1605
- $label_id = $label_id_each[0];
1606
- array_push($label_order_ids, $label_id);
1607
- $label_order_each = explode('#**label**#', $label_id_each[1]);
1608
- $label_order_original[$label_id] = $label_order_each[0];
1609
- }
1610
-
1611
- $submissions_row = $wpdb->get_results($wpdb->prepare("SELECT `element_label`, `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=%d AND group_id=%d", $form_id, $subid));
1612
- foreach ($submissions_row as $sub_row){
1613
- $submission_array[$sub_row->element_label] = $sub_row->element_value;
1614
- }
1615
-
1616
- foreach($label_order_original as $key => $label_each) {
1617
- if(strpos($submit_text, "%".$label_each."%")>-1) {
1618
- $submit_text = str_replace("%".$label_each."%", $submission_array[$key], $submit_text);
1619
- }
1620
- }
1621
-
1622
- $custom_fields = array( "subid"=>$subid, "ip"=>$ip, "userid"=>$userid, "username"=>$username, "useremail"=>$useremail);
1623
- foreach($custom_fields as $key=>$custom_field)
1624
- {
1625
- if(strpos($submit_text, "%".$key."%")>-1)
1626
- $submit_text = str_replace("%".$key."%", $custom_field, $submit_text);
1627
- }
1628
- $submit_text = str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***", "***star_rating***"), array(" ", "", " ", " ", " ", ", ", " "), $submit_text);
1629
-
1630
- return $submit_text;
1631
- }
1632
-
1633
- public function increment_views_count($id) {
1634
- global $wpdb;
1635
- $vives_form = $wpdb->get_var($wpdb->prepare("SELECT views FROM " . $wpdb->prefix . "formmaker_views WHERE form_id=%d", $id));
1636
- if (isset($vives_form)) {
1637
- $vives_form = $vives_form + 1;
1638
- $wpdb->update($wpdb->prefix . "formmaker_views", array(
1639
- 'views' => $vives_form,
1640
- ), array('form_id' => $id), array(
1641
- '%d',
1642
- ), array('%d'));
1643
- }
1644
- else {
1645
- $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
1646
- 'form_id' => $id,
1647
- 'views' => 1
1648
- ), array(
1649
- '%d',
1650
- '%d'
1651
- ));
1652
- }
1653
- }
1654
-
1655
- public function gen_mail($counter, $all_files, $id, $str) {
1656
- // checking save uploads option
1657
- global $wpdb;
1658
- $save_uploads = $wpdb->get_var("SELECT save_uploads FROM " . $wpdb->prefix ."formmaker WHERE id=" . $id);
1659
- if($save_uploads == 0){
1660
- $destination = 'wp-content/uploads/tmpAddon';
1661
- if(!file_exists($destination))
1662
- mkdir($destination , 0777);
1663
-
1664
- foreach($all_files as &$all_file){
1665
- $fileTemp = $all_file['tmp_name'];
1666
- $fileName = $all_file['name'];
1667
- if(!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
1668
- echo "<script> alert('" . addslashes(__('Error, file cannot be moved.', 'form_maker')) . "');</script>";
1669
- return array($max+1);
1670
- }
1671
-
1672
- $all_file['tmp_name'] = $destination . "/" . $fileName;
1673
- }
1674
- }
1675
- $ip = $_SERVER['REMOTE_ADDR'];
1676
- $replyto = '';
1677
- global $wpdb;
1678
- $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $id));
1679
- if (!$row->form_front) {
1680
- $id = '';
1681
- }
1682
-
1683
- $custom_fields = array('ip', 'useremail', 'username', 'subid', 'all' );
1684
- $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
1685
-
1686
- $current_user = wp_get_current_user();
1687
- if ($current_user->ID != 0)
1688
- {
1689
- $username = $current_user->display_name;
1690
- $useremail = $current_user->user_email;
1691
- }
1692
- else
1693
- {
1694
- $username = '';
1695
- $useremail = '';
1696
- }
1697
-
1698
- $label_order_original = array();
1699
- $label_order_ids = array();
1700
- $label_label = array();
1701
- $label_type = array();
1702
- $total = 0;
1703
- $form_currency = '$';
1704
- $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
1705
- $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
1706
- if ($row->payment_currency) {
1707
- $form_currency = $currency_sign[array_search($row->payment_currency, $currency_code)];
1708
- }
1709
-
1710
- $old = false;
1711
- if(isset($row->form)) {
1712
- $old = true;
1713
- }
1714
-
1715
- $cc = array();
1716
- $row_mail_one_time = 1;
1717
- $label_type = array();
1718
-
1719
- if($old == false || ($old == true && $row->form == '')) {
1720
- $label_all = explode('#****#',$row->label_order_current);
1721
- }
1722
- else {
1723
- $label_all = explode('#****#',$row->label_order);
1724
- }
1725
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
1726
- foreach ($label_all as $key => $label_each) {
1727
- $label_id_each = explode('#**id**#', $label_each);
1728
- $label_id = $label_id_each[0];
1729
- array_push($label_order_ids, $label_id);
1730
- $label_order_each = explode('#**label**#', $label_id_each[1]);
1731
- $label_order_original[$label_id] = $label_order_each[0];
1732
- $label_type[$label_id] = $label_order_each[1];
1733
- array_push($label_label, $label_order_each[0]);
1734
- array_push($label_type, $label_order_each[1]);
1735
- }
1736
-
1737
- $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
1738
- $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
1739
-
1740
- $list='<table border="1" cellpadding="3" cellspacing="0" style="width:600px;">';
1741
- $list_text_mode = '';
1742
- if($old == false || ($old == true && $row->form == '')) {
1743
- foreach($label_order_ids as $key => $label_order_id) {
1744
- $i = $label_order_id;
1745
- $type = $label_type[$i];
1746
-
1747
- if($type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button") {
1748
- $element_label=$label_order_original[$i];
1749
- if(!in_array($i,$disabled_fields)) {
1750
- switch ($type) {
1751
- case 'type_text':
1752
- case 'type_password':
1753
- case 'type_textarea':
1754
- case "type_date":
1755
- case "type_own_select":
1756
- case "type_country":
1757
- case "type_number": {
1758
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
1759
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1760
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
1761
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1762
- }
1763
-
1764
- break;
1765
- }
1766
- case "type_hidden": {
1767
- $element = isset($_POST[$element_label]) ? $_POST[$element_label] : NULL;
1768
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1769
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
1770
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1771
- }
1772
- break;
1773
- }
1774
- case "type_mark_map": {
1775
- $element = isset($_POST['wdform_'.$i."_long".$id]) ? $_POST['wdform_'.$i."_long".$id] : NULL;
1776
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1777
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "") . '</td></tr>';
1778
- $list_text_mode=$list_text_mode.$element_label.' - Longitude:'.$element.' Latitude:'.(isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "")."\r\n";
1779
- }
1780
- break;
1781
- }
1782
- case "type_submitter_mail": {
1783
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
1784
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1785
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
1786
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1787
- }
1788
- break;
1789
- }
1790
-
1791
- case "type_time": {
1792
- $hh = isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : NULL;
1793
- if(isset($hh) && ($this->empty_field($hh, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_mm".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_ss".$id], $row->mail_emptyfields))) {
1794
- $ss = isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : NULL;
1795
- if(isset($ss)) {
1796
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "") . ':' . $ss;
1797
- $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "").':'.$ss;
1798
- }
1799
- else {
1800
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
1801
- $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
1802
- }
1803
- $am_pm = isset($_POST['wdform_'.$i."_am_pm".$id]) ? $_POST['wdform_'.$i."_am_pm".$id] : NULL;
1804
- if(isset($am_pm)) {
1805
- $list = $list . ' ' . $am_pm . '</td></tr>';
1806
- $list_text_mode=$list_text_mode.$am_pm."\r\n";
1807
- }
1808
- else {
1809
- $list = $list.'</td></tr>';
1810
- $list_text_mode=$list_text_mode."\r\n";
1811
- }
1812
- }
1813
- break;
1814
- }
1815
-
1816
- case "type_phone": {
1817
- $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
1818
- if(isset($element_first) && $this->empty_field($element_first, $row->mail_emptyfields)) {
1819
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
1820
- $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
1821
- }
1822
- break;
1823
- }
1824
-
1825
- case "type_name": {
1826
- $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
1827
- if(isset($element_first)) {
1828
- $element_title = isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : NULL;
1829
- $element_middle = isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : NULL;
1830
- if((isset($element_title) || isset($element_middle)) && ($this->empty_field($element_title, $row->mail_emptyfields) || $this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_middle".$id], $row->mail_emptyfields))) {
1831
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . (isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '') . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "") . '</td></tr>';
1832
- $list_text_mode=$list_text_mode.$element_label.' - '.(isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '').' '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "").' '.(isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "")."\r\n";
1833
- }
1834
- else {
1835
- if($this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields)) {
1836
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
1837
- $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
1838
- }
1839
- }
1840
- }
1841
- break;
1842
- }
1843
-
1844
- case "type_address": {
1845
- $element = isset($_POST['wdform_'.$i."_street1".$id]) ? $_POST['wdform_'.$i."_street1".$id] : NULL;
1846
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1847
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1848
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1849
- break;
1850
- }
1851
- $element = isset($_POST['wdform_'.$i."_street2".$id]) ? $_POST['wdform_'.$i."_street2".$id] : NULL;
1852
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1853
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1854
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1855
- break;
1856
- }
1857
- $element = isset($_POST['wdform_'.$i."_city".$id]) ? $_POST['wdform_'.$i."_city".$id] : NULL;
1858
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1859
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1860
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1861
- break;
1862
- }
1863
- $element = isset($_POST['wdform_'.$i."_state".$id]) ? $_POST['wdform_'.$i."_state".$id] : NULL;
1864
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1865
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1866
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1867
- break;
1868
- }
1869
- $element = isset($_POST['wdform_'.$i."_postal".$id]) ? $_POST['wdform_'.$i."_postal".$id] : NULL;
1870
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1871
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1872
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1873
- break;
1874
- }
1875
- $element = isset($_POST['wdform_'.$i."_country".$id]) ? $_POST['wdform_'.$i."_country".$id] : NULL;
1876
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1877
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1878
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1879
- break;
1880
- }
1881
- break;
1882
- }
1883
-
1884
- case "type_date_fields": {
1885
- $day = isset($_POST['wdform_'.$i."_day".$id]) ? $_POST['wdform_'.$i."_day".$id] : NULL;
1886
- $month = isset($_POST['wdform_'.$i."_month".$id]) ? $_POST['wdform_'.$i."_month".$id] : "";
1887
- $year = isset($_POST['wdform_'.$i."_year".$id]) ? $_POST['wdform_'.$i."_year".$id] : "";
1888
- if(isset($day) && $this->empty_field($day, $row->mail_emptyfields)) {
1889
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' .(($day || $month || $year) ? $day . '-' . $month . '-' . $year : '' ). '</td></tr>';
1890
- $list_text_mode=$list_text_mode.$element_label.(($day || $month || $year) ? $day.'-'.$month.'-'.$year : '')."\r\n";
1891
- }
1892
- break;
1893
- }
1894
-
1895
- case "type_radio": {
1896
- $element = isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL;
1897
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1898
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
1899
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1900
- break;
1901
- }
1902
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
1903
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1904
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
1905
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1906
- }
1907
- break;
1908
- }
1909
-
1910
- case "type_checkbox": {
1911
- $start = -1;
1912
- for($j = 0; $j < 100; $j++) {
1913
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
1914
- if(isset($element)) {
1915
- $start = $j;
1916
- break;
1917
- }
1918
- }
1919
- $other_element_id = -1;
1920
- $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
1921
- if($is_other == "yes") {
1922
- $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
1923
- }
1924
-
1925
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
1926
- {
1927
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
1928
- $list_text_mode=$list_text_mode.$element_label.' - ';
1929
- }
1930
-
1931
- if($start != -1) {
1932
- for($j = $start; $j < 100; $j++) {
1933
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
1934
- if(isset($element)) {
1935
- if($j == $other_element_id) {
1936
- $list = $list . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '<br>';
1937
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "").', ';
1938
- }
1939
- else {
1940
- $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "") . '<br>';
1941
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "").', ';
1942
- }
1943
- }
1944
- }
1945
- }
1946
-
1947
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
1948
- {
1949
- $list = $list . '</td></tr>';
1950
- $list_text_mode=$list_text_mode."\r\n";
1951
- }
1952
- break;
1953
- }
1954
-
1955
- case "type_paypal_price": {
1956
- $value = 0;
1957
- if(isset($_POST['wdform_'.$i."_element_dollars".$id])) {
1958
- $value = $_POST['wdform_'.$i."_element_dollars".$id];
1959
- }
1960
- if(isset($_POST['wdform_'.$i."_element_cents".$id]) && $_POST['wdform_'.$i."_element_cents".$id]) {
1961
- $value = $value . '.' . $_POST['wdform_'.$i."_element_cents".$id];
1962
- }
1963
-
1964
- if($this->empty_field($value, $row->mail_emptyfields) && $value!='.')
1965
- {
1966
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . $form_currency . '</td></tr>';
1967
- $list_text_mode=$list_text_mode.$element_label.' - '.$value.$form_currency."\r\n";
1968
- }
1969
- break;
1970
- }
1971
-
1972
- case "type_paypal_select": {
1973
- if(isset($_POST['wdform_'.$i."_element_label".$id]) && $_POST['wdform_'.$i."_element".$id] != '') {
1974
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
1975
- }
1976
- else {
1977
- $value='';
1978
- }
1979
- $element_quantity_label = (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) && $_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
1980
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
1981
- if($value != '' && isset($element_quantity)) {
1982
- $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
1983
- }
1984
- for($k = 0; $k < 50; $k++) {
1985
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
1986
- if(isset($temp_val)) {
1987
- $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
1988
- }
1989
- }
1990
-
1991
- if($this->empty_field($value, $row->mail_emptyfields))
1992
- {
1993
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
1994
- $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
1995
- }
1996
- break;
1997
- }
1998
-
1999
- case "type_paypal_radio": {
2000
- if(isset($_POST['wdform_'.$i."_element".$id])) {
2001
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
2002
-
2003
- $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2004
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2005
- if (isset($element_quantity)) {
2006
- $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2007
- }
2008
- for($k = 0; $k < 50; $k++) {
2009
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
2010
- if(isset($temp_val)) {
2011
- $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2012
- }
2013
- }
2014
- }
2015
- else {
2016
- $value='';
2017
- }
2018
-
2019
- if($this->empty_field($value, $row->mail_emptyfields))
2020
- {
2021
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2022
- $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
2023
- }
2024
- break;
2025
- }
2026
-
2027
- case "type_paypal_shipping": {
2028
- if(isset($_POST['wdform_'.$i."_element".$id])) {
2029
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
2030
-
2031
- if($this->empty_field($value, $row->mail_emptyfields))
2032
- {
2033
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2034
- $list_text_mode=$list_text_mode.$element_label.' - '.$value."\r\n";
2035
- }
2036
- }
2037
- else {
2038
- $value='';
2039
- }
2040
-
2041
- break;
2042
- }
2043
-
2044
- case "type_paypal_checkbox": {
2045
-
2046
- $start = -1;
2047
- for($j = 0; $j < 100; $j++) {
2048
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2049
- if(isset($element)) {
2050
- $start=$j;
2051
- break;
2052
- }
2053
- }
2054
-
2055
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2056
- {
2057
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2058
- $list_text_mode=$list_text_mode.$element_label.' - ';
2059
- }
2060
- if($start!=-1) {
2061
- for($j = $start; $j < 100; $j++) {
2062
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2063
- if(isset($element)) {
2064
- $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "") . ' - ' . ($element == '' ? '0' . $form_currency : $element) . $form_currency . '<br>';
2065
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "").' - '.($element == '' ? '0' . $form_currency : $element).$form_currency.', ';
2066
- }
2067
- }
2068
- }
2069
- $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2070
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2071
- if (isset($element_quantity)) {
2072
- $list = $list . '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2073
- $list_text_mode=$list_text_mode.$element_quantity_label . ': ' . $element_quantity.', ';
2074
- }
2075
- for($k = 0; $k < 50; $k++) {
2076
- $temp_val = isset($_POST['wdform_'.$i."_element_property_value".$id.$k]) ? $_POST['wdform_'.$i."_element_property_value".$id.$k] : NULL;
2077
- if(isset($temp_val)) {
2078
- $list = $list . '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2079
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val.', ';
2080
- }
2081
- }
2082
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2083
- {
2084
- $list = $list . '</td></tr>';
2085
- $list_text_mode=$list_text_mode."\r\n";
2086
- }
2087
- break;
2088
- }
2089
-
2090
- case "type_paypal_total": {
2091
- $element = isset($_POST['wdform_'.$i."_paypal_total".$id]) ? $_POST['wdform_'.$i."_paypal_total".$id] : "";
2092
- if($this->empty_field($element, $row->mail_emptyfields))
2093
- {
2094
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2095
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2096
- }
2097
- break;
2098
- }
2099
-
2100
- case "type_star_rating": {
2101
- $element = isset($_POST['wdform_'.$i."_star_amount".$id]) ? $_POST['wdform_'.$i."_star_amount".$id] : NULL;
2102
- $selected = isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : 0;
2103
- if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2104
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2105
- $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2106
- }
2107
- break;
2108
- }
2109
-
2110
- case "type_scale_rating": {
2111
- $element = isset($_POST['wdform_'.$i."_scale_amount".$id]) ? $_POST['wdform_'.$i."_scale_amount".$id] : NULL;
2112
- $selected = isset($_POST['wdform_'.$i."_scale_radio".$id]) ? $_POST['wdform_'.$i."_scale_radio".$id] : 0;
2113
- if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2114
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2115
- $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2116
- }
2117
- break;
2118
- }
2119
-
2120
- case "type_spinner": {
2121
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2122
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2123
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2124
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2125
- }
2126
- break;
2127
- }
2128
-
2129
- case "type_slider": {
2130
- $element = isset($_POST['wdform_'.$i."_slider_value".$id]) ? $_POST['wdform_'.$i."_slider_value".$id] : NULL;
2131
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2132
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2133
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2134
- }
2135
- break;
2136
- }
2137
-
2138
- case "type_range": {
2139
- $element0 = isset($_POST['wdform_'.$i."_element".$id.'0']) ? $_POST['wdform_'.$i."_element".$id.'0'] : NULL;
2140
- $element1 = isset($_POST['wdform_'.$i."_element".$id.'1']) ? $_POST['wdform_'.$i."_element".$id.'1'] : NULL;
2141
- if((isset($element0) && $this->empty_field($element0, $row->mail_emptyfields)) || (isset($element1) && $this->empty_field($element1, $row->mail_emptyfields))) {
2142
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >From:' . $element0 . '<span style="margin-left:6px">To</span>:' . $element1 . '</td></tr>';
2143
- $list_text_mode=$list_text_mode.$element_label.' - From:'.$element0.' To:'.$element1."\r\n";
2144
- }
2145
- break;
2146
- }
2147
-
2148
- case "type_grading": {
2149
- $element = isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "";
2150
- $grading = explode(":", $element);
2151
- $items_count = sizeof($grading) - 1;
2152
- $element = "";
2153
- $total = "";
2154
- $form_empty_field = 1;
2155
- for($k = 0;$k < $items_count; $k++) {
2156
- $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : "") . " ";
2157
- $total += (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : 0);
2158
- if(isset($_POST['wdform_'.$i."_element".$id.'_'.$k]))
2159
- $form_empty_field = 0;
2160
- }
2161
- $element .= "Total:" . $total;
2162
- if(isset($element) && $this->empty_field($form_empty_field, $row->mail_emptyfields)) {
2163
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2164
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2165
- }
2166
- break;
2167
- }
2168
-
2169
- case "type_matrix": {
2170
- $input_type = isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : "";
2171
- $mat_rows = explode("***", isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "");
2172
- $rows_count = sizeof($mat_rows) - 1;
2173
- $mat_columns = explode("***", isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "");
2174
- $columns_count = sizeof($mat_columns) - 1;
2175
- $matrix = "<table>";
2176
- $matrix .= '<tr><td></td>';
2177
- for($k = 1; $k < count($mat_columns); $k++) {
2178
- $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
2179
- }
2180
- $matrix .= '</tr>';
2181
- $aaa = Array();
2182
- for($k = 1; $k <= $rows_count; $k++) {
2183
- $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
2184
- if($input_type == "radio") {
2185
- $mat_radio = isset($_POST['wdform_'.$i."_input_element".$id.$k]) ? $_POST['wdform_'.$i."_input_element".$id.$k] : 0;
2186
- if($mat_radio == 0) {
2187
- $checked = "";
2188
- $aaa[1] = "";
2189
- }
2190
- else {
2191
- $aaa = explode("_", $mat_radio);
2192
- }
2193
- for($j = 1; $j <= $columns_count; $j++) {
2194
- if($aaa[1] == $j) {
2195
- $checked = "checked";
2196
- }
2197
- else {
2198
- $checked = "";
2199
- }
2200
- $matrix .= '<td style="text-align:center"><input type="radio" ' . $checked . ' disabled /></td>';
2201
- }
2202
- }
2203
- else {
2204
- if($input_type == "checkbox") {
2205
- for($j = 1; $j <= $columns_count; $j++) {
2206
- $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : "";
2207
- if($checked == 1) {
2208
- $checked = "checked";
2209
- }
2210
- else {
2211
- $checked = "";
2212
- }
2213
- $matrix .= '<td style="text-align:center"><input type="checkbox" ' . $checked . ' disabled /></td>';
2214
- }
2215
- }
2216
- else {
2217
- if($input_type == "text") {
2218
- for($j = 1; $j <= $columns_count; $j++) {
2219
- $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : "";
2220
- $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
2221
- }
2222
- }
2223
- else {
2224
- for($j = 1; $j <= $columns_count; $j++) {
2225
- $checked = isset($_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j] : "";
2226
- $matrix .= '<td style="text-align:center">' . $checked . '</td>';
2227
- }
2228
- }
2229
- }
2230
- }
2231
- $matrix .= '</tr>';
2232
- }
2233
- $matrix .= '</table>';
2234
- if(isset($matrix)) {
2235
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $matrix . '</td></tr>';
2236
- }
2237
- break;
2238
- }
2239
- default: break;
2240
- }
2241
- }
2242
- }
2243
- }
2244
-
2245
- $list = $list . '</table>';
2246
- if($row->sendemail) {
2247
- $fromname = $row->mail_from_name_user;
2248
- if($row->mail_subject_user)
2249
- $subject = $row->mail_subject_user;
2250
- else
2251
- $subject = $row->title;
2252
- if($row->reply_to_user) {
2253
- $replyto = $row->reply_to_user;
2254
- }
2255
- $attachment_user = array();
2256
- if ($row->mail_attachment_user) {
2257
- for ($k = 0; $k < count($all_files); $k++) {
2258
- if (isset($all_files[$k]['tmp_name'])) {
2259
- $attachment_user[$k] = $all_files[$k]['tmp_name'];
2260
- }
2261
- }
2262
- }
2263
-
2264
- if ($row->mail_mode_user) {
2265
- $content_type = "text/html";
2266
- $mode = 1;
2267
- $list_user = wordwrap($list, 70, "\n", true);
2268
- $new_script = wpautop($row->script_mail_user);
2269
- }
2270
- else {
2271
- $content_type = "text/plain";
2272
- $mode = 0;
2273
- $list_user = wordwrap($list_text_mode, 1000, "\n", true);
2274
- $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail_user);
2275
- }
2276
-
2277
- foreach($label_order_original as $key => $label_each) {
2278
- $type=$label_type[$key];
2279
- if(strpos($row->script_mail_user, "%".$label_each."%")>-1) {
2280
- $new_value = $this->custom_fields_mail($type, $key, $id, $attachment_user, '');
2281
- $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
2282
- }
2283
-
2284
- if(strpos($fromname, "%".$label_each."%")>-1) {
2285
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2286
- if(substr($new_value, -2)==', ') {
2287
- $new_value = substr($new_value, 0, -2);
2288
- }
2289
- $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
2290
- }
2291
-
2292
- if(strpos($subject, "%".$label_each."%")>-1) {
2293
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2294
- if(substr($new_value, -2)==', ') {
2295
- $new_value = substr($new_value, 0, -2);
2296
- }
2297
- $subject = str_replace("%".$label_each."%", $new_value, $subject);
2298
- }
2299
- }
2300
-
2301
- $recipient = '';
2302
- $cca = $row->mail_cc_user;
2303
- $bcc = $row->mail_bcc_user;
2304
- if ($row->mail_from_user != '') {
2305
- if ($fromname != '') {
2306
- $from = "From: '" . $fromname . "' <" . $row->mail_from_user . ">" . "\r\n";
2307
- }
2308
- else {
2309
- $from = "From: '' <" . $row->mail_from_user . ">" . "\r\n";
2310
- }
2311
- }
2312
- else {
2313
- $from = '';
2314
- }
2315
-
2316
- $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
2317
- if ($replyto) {
2318
- $headers .= "Reply-To: <" . $replyto . ">\r\n";
2319
- }
2320
- if ($cca) {
2321
- $headers .= "Cc: <" . $cca . ">\r\n";
2322
- }
2323
- if ($bcc) {
2324
- $headers .= "Bcc: <" . $bcc . ">\r\n";
2325
- }
2326
-
2327
- $custom_fields_value = array( $ip, $useremail, $username, $subid, $list_user );
2328
- foreach($custom_fields as $key=>$custom_field)
2329
- {
2330
- if(strpos($new_script, "%".$custom_field."%")>-1)
2331
- $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
2332
-
2333
- if($key==2 || $key==3)
2334
- {
2335
- if(strpos($fromname, "%".$custom_field."%")>-1)
2336
- $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
2337
-
2338
- if(strpos($subject, "%".$custom_field."%")>-1)
2339
- $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
2340
- }
2341
- }
2342
- $body = $new_script;
2343
- $GLOBALS['attachment_user'] = array();
2344
- $GLOBALS['attachment'] = array();
2345
- if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
2346
- $_GET['addon_task'] = 'frontend';
2347
- $_GET['form_id'] = $id;
2348
- $_GET['form_currency'] = $form_currency;
2349
- $GLOBALS['custom_fields_value'] = $custom_fields_value;
2350
- do_action('WD_FM_PDF_init');
2351
- }
2352
- if(!empty($GLOBALS['attachment_user']))
2353
- array_push($attachment_user, $GLOBALS['attachment_user']);
2354
-
2355
- if($row->send_to) {
2356
- $send_tos = explode('**',$row->send_to);
2357
- $send_copy = isset($_POST["wdform_send_copy_".$id]) ? $_POST["wdform_send_copy_".$id] : NULL;
2358
- if(isset($send_copy)) {
2359
- $send=true;
2360
- }
2361
- else {
2362
- $mail_verification_post_id = (int)$wpdb->get_var($wpdb->prepare('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
2363
- $verification_link = get_post( $mail_verification_post_id );
2364
- foreach($send_tos as $index => $send_to) {
2365
- $recipient = isset($_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id]) ? $_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id] : NULL;
2366
- if(strpos($new_script, "%Verification link%")>-1 && $verification_link !== NULL) {
2367
- $ver_link = $row->mail_mode_user ? "<a href =".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id)).">".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id))."</a><br/>" : add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id));
2368
-
2369
- $body = $row->mail_verify ? str_replace("%Verification link%", $ver_link, $new_script) : str_replace("%Verification link%", '', $new_script);
2370
- }
2371
-
2372
- if($recipient) {
2373
- $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment_user);
2374
- }
2375
- }
2376
- }
2377
- }
2378
- }
2379
-
2380
- if($row->sendemail) {
2381
- if($row->reply_to) {
2382
- $replyto = isset($_POST['wdform_'.$row->reply_to."_element".$id]) ? $_POST['wdform_'.$row->reply_to."_element".$id] : NULL;
2383
- if(!isset($replyto)) {
2384
- $replyto = $row->reply_to;
2385
- }
2386
- }
2387
- $recipient = $row->mail;
2388
- if($row->mail_subject) {
2389
- $subject = $row->mail_subject;
2390
- }
2391
- else {
2392
- $subject = $row->title;
2393
- }
2394
-
2395
- if ($row->from_name) {
2396
- $fromname = $row->from_name;
2397
- }
2398
- else {
2399
- $fromname = '';
2400
- }
2401
- $attachment = array();
2402
- if ($row->mail_attachment) {
2403
- for ($k = 0; $k < count($all_files); $k++) {
2404
- if (isset($all_files[$k]['tmp_name'])) {
2405
- $attachment[$k] = $all_files[$k]['tmp_name'];
2406
- }
2407
- }
2408
- }
2409
- if(!empty($GLOBALS['attachment']))
2410
- array_push($attachment, $GLOBALS['attachment']);
2411
-
2412
-
2413
- if ($row->mail_mode) {
2414
- $content_type = "text/html";
2415
- $mode = 1;
2416
- $list = wordwrap($list, 70, "\n", true);
2417
- $new_script = wpautop($row->script_mail);
2418
- }
2419
- else {
2420
- $content_type = "text/plain";
2421
- $mode = 0;
2422
- $list = $list_text_mode;
2423
- $list = wordwrap($list, 1000, "\n", true);
2424
- $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail);
2425
- }
2426
-
2427
- foreach($label_order_original as $key => $label_each) {
2428
- $type=$label_type[$key];
2429
- if(strpos($row->script_mail, "%".$label_each."%")>-1) {
2430
- $new_value = $this->custom_fields_mail($type, $key, $id, $attachment, '');
2431
- $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
2432
- }
2433
-
2434
- if(strpos($fromname, "%".$label_each."%")>-1) {
2435
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2436
- if(substr($new_value, -2)==', ') {
2437
- $new_value = substr($new_value, 0, -2);
2438
- }
2439
- $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
2440
- }
2441
-
2442
- if(strpos($fromname, "%username%")>-1){
2443
- $fromname = str_replace("%username%", $username, $fromname);
2444
- }
2445
-
2446
- if(strpos($subject, "%".$label_each."%")>-1) {
2447
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2448
- if(substr($new_value, -2)==', ') {
2449
- $new_value = substr($new_value, 0, -2);
2450
- }
2451
- $subject = str_replace("%".$label_each."%", $new_value, $subject);
2452
- }
2453
- }
2454
-
2455
- if ($row->from_mail) {
2456
- $from = isset($_POST['wdform_'.$row->from_mail."_element".$id]) ? $_POST['wdform_'.$row->from_mail."_element".$id] : NULL;
2457
- if (!isset($from)) {
2458
- $from = $row->from_mail;
2459
- }
2460
- $from = "From: '" . $fromname . "' <" . $from . ">" . "\r\n";
2461
- }
2462
- else {
2463
- $from = "";
2464
- }
2465
-
2466
- $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
2467
- if ($replyto) {
2468
- $headers .= "Reply-To: <" . $replyto . ">\r\n";
2469
- }
2470
- $cca = $row->mail_cc;
2471
- $bcc = $row->mail_bcc;
2472
- if ($cca) {
2473
- $headers .= "Cc: <" . $cca . ">\r\n";
2474
- }
2475
- if ($bcc) {
2476
- $headers .= "Bcc: <" . $bcc . ">\r\n";
2477
- }
2478
-
2479
- $custom_fields_value = array( $ip, $useremail, $username, $subid, $list );
2480
- foreach($custom_fields as $key=>$custom_field)
2481
- {
2482
- if(strpos($new_script, "%".$custom_field."%")>-1)
2483
- $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
2484
-
2485
- if($key==2 || $key==3)
2486
- {
2487
- if(strpos($fromname, "%".$custom_field."%")>-1)
2488
- $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
2489
-
2490
- if(strpos($subject, "%".$custom_field."%")>-1)
2491
- $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
2492
- }
2493
- }
2494
- $admin_body = $new_script;
2495
- if($recipient) {
2496
- $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($admin_body), $headers, $attachment);
2497
- }
2498
- }
2499
-
2500
- $_SESSION['error_or_no' . $id] = 0;
2501
- $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
2502
- $succes = 1;
2503
-
2504
- if($row->sendemail)
2505
- if($row->mail || $row->send_to) {
2506
- if ($send) {
2507
- if ($send !== true ) {
2508
- $_SESSION['error_or_no' . $id] = 1;
2509
- $msg = addslashes(__('Error, email was not sent.', 'form_maker'));
2510
- $succes = 0;
2511
- }
2512
- else {
2513
- $_SESSION['error_or_no' . $id] = 0;
2514
- $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
2515
- }
2516
- }
2517
- }
2518
-
2519
- $fm_email_params = $row->sendemail ? array('admin_body' => $admin_body, 'body' => $body, 'subject' => $subject, 'headers' => $headers, 'attachment' => $attachment, 'attachment_user' => $attachment_user) : array();
2520
-
2521
- $addons = array('WD_FM_EMAIL_COND' => 'Email Conditions');
2522
- $addons_array = array();
2523
- foreach($addons as $addon => $addon_name) {
2524
- if (defined($addon) && is_plugin_active(constant($addon))) {
2525
- $_GET['addon_task'] = 'frontend';
2526
- $_GET['form_id'] = $id;
2527
- $GLOBALS['fm_email_params'] = $fm_email_params;
2528
- $GLOBALS['form_currency'] = $form_currency;
2529
- $GLOBALS['custom_fields_value'] = isset($custom_fields_value) ? $custom_fields_value : array();
2530
- do_action($addon.'_init');
2531
- }
2532
- }
2533
- }
2534
- else { /* Old form.*/
2535
- foreach ($label_order_ids as $key => $label_order_id) {
2536
- $i = $label_order_id;
2537
- $type = $_POST[$i . "_type" . $id];
2538
- if (isset($_POST[$i . "_type" . $id]))
2539
- if ($type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button") {
2540
- $element_label = $label_order_original[$i];
2541
- switch ($type) {
2542
- case 'type_text':
2543
- case 'type_password':
2544
- case 'type_textarea':
2545
- case "type_date":
2546
- case "type_own_select":
2547
- case "type_country":
2548
- case "type_number":
2549
- {
2550
- $element = $_POST[$i . "_element" . $id];
2551
- if (isset($_POST[$i . "_element" . $id])) {
2552
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2553
- }
2554
- break;
2555
- }
2556
- case "type_hidden": {
2557
- $element = $_POST[$element_label];
2558
- if (isset($element)) {
2559
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2560
- }
2561
- break;
2562
- }
2563
- case "type_submitter_mail":
2564
- {
2565
- $element = $_POST[$i . "_element" . $id];
2566
- if (isset($_POST[$i . "_element" . $id])) {
2567
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2568
- if ($_POST[$i . "_send" . $id] == "yes")
2569
- array_push($cc, $element);
2570
- }
2571
- break;
2572
- }
2573
- case "type_time":
2574
- {
2575
- $hh = $_POST[$i . "_hh" . $id];
2576
- if (isset($_POST[$i . "_hh" . $id])) {
2577
- $ss = $_POST[$i . "_ss" . $id];
2578
- if (isset($_POST[$i . "_ss" . $id]))
2579
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_hh" . $id] . ':' . $_POST[$i . "_mm" . $id] . ':' . $_POST[$i . "_ss" . $id];
2580
- else
2581
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_hh" . $id] . ':' . $_POST[$i . "_mm" . $id];
2582
- $am_pm = $_POST[$i . "_am_pm" . $id];
2583
- if (isset($_POST[$i . "_am_pm" . $id]))
2584
- $list = $list . ' ' . $_POST[$i . "_am_pm" . $id] . '</td></tr>';
2585
- else
2586
- $list = $list . '</td></tr>';
2587
- }
2588
- break;
2589
- }
2590
- case "type_phone":
2591
- {
2592
- $element_first = $_POST[$i . "_element_first" . $id];
2593
- if (isset($_POST[$i . "_element_first" . $id])) {
2594
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_element_first" . $id] . ' ' . $_POST[$i . "_element_last" . $id] . '</td></tr>';
2595
- }
2596
- break;
2597
- }
2598
- case "type_name":
2599
- {
2600
- $element_first = $_POST[$i . "_element_first" . $id];
2601
- if (isset($_POST[$i . "_element_first" . $id])) {
2602
- $element_title = $_POST[$i . "_element_title" . $id];
2603
- if (isset($_POST[$i . "_element_title" . $id]))
2604
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_element_title" . $id] . ' ' . $_POST[$i . "_element_first" . $id] . ' ' . $_POST[$i . "_element_last" . $id] . ' ' . $_POST[$i . "_element_middle" . $id] . '</td></tr>';
2605
- else
2606
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_element_first" . $id] . ' ' . $_POST[$i . "_element_last" . $id] . '</td></tr>';
2607
- }
2608
- break;
2609
- }
2610
- case "type_mark_map":
2611
- {
2612
- if (isset($_POST[$i . "_long" . $id])) {
2613
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >Longitude:' . $_POST[$i . "_long" . $id] . '<br/>Latitude:' . $_POST[$i . "_lat" . $id] . '</td></tr>';
2614
- }
2615
- break;
2616
- }
2617
- case "type_address":
2618
- {
2619
- if (isset($_POST[$i . "_street1" . $id]))
2620
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_street1" . $id] . '</td></tr>';
2621
- $i++;
2622
- if (isset($_POST[$i."_street2".$id]))
2623
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_street2" . $id] . '</td></tr>';
2624
- $i++;
2625
- if (isset($_POST[$i."_city".$id]))
2626
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_city" . $id] . '</td></tr>';
2627
- $i++;
2628
- if (isset($_POST[$i."_state".$id]))
2629
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_state" . $id] . '</td></tr>';
2630
- $i++;
2631
- if (isset($_POST[$i."_postal".$id]))
2632
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_postal" . $id] . '</td></tr>';
2633
- $i++;
2634
- if (isset($_POST[$i."_country".$id]))
2635
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_country" . $id] . '</td></tr>';
2636
- $i++;
2637
- break;
2638
- }
2639
- case "type_date_fields":
2640
- {
2641
- $day = $_POST[$i . "_day" . $id];
2642
- if (isset($_POST[$i . "_day" . $id])) {
2643
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_day" . $id] . '-' . $_POST[$i . "_month" . $id] . '-' . $_POST[$i . "_year" . $id] . '</td></tr>';
2644
- }
2645
- break;
2646
- }
2647
- case "type_radio":
2648
- {
2649
- $element = $_POST[$i . "_other_input" . $id];
2650
- if (isset($_POST[$i . "_other_input" . $id])) {
2651
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_other_input" . $id] . '</td></tr>';
2652
- break;
2653
- }
2654
- $element = $_POST[$i . "_element" . $id];
2655
- if (isset($_POST[$i . "_element" . $id])) {
2656
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2657
- }
2658
- break;
2659
- }
2660
- case "type_checkbox":
2661
- {
2662
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2663
- $start = -1;
2664
- for ($j = 0; $j < 100; $j++) {
2665
- if (isset($_POST[$i . "_element" . $id . $j])) {
2666
- $start = $j;
2667
- break;
2668
- }
2669
- }
2670
- $other_element_id = -1;
2671
- $is_other = $_POST[$i . "_allow_other" . $id];
2672
- if ($is_other == "yes") {
2673
- $other_element_id = $_POST[$i . "_allow_other_num" . $id];
2674
- }
2675
- if ($start != -1) {
2676
- for ($j = $start; $j < 100; $j++) {
2677
- $element = $_POST[$i . "_element" . $id . $j];
2678
- if (isset($_POST[$i . "_element" . $id . $j]))
2679
- if ($j == $other_element_id) {
2680
- $list = $list . $_POST[$i . "_other_input" . $id] . '<br>';
2681
- }
2682
- else
2683
- $list = $list . $_POST[$i . "_element" . $id . $j] . '<br>';
2684
- }
2685
- $list = $list . '</td></tr>';
2686
- }
2687
- break;
2688
- }
2689
- case "type_paypal_price": {
2690
- $value = 0;
2691
- if ($_POST[$i."_element_dollars".$id]) {
2692
- $value = $_POST[$i."_element_dollars".$id];
2693
- }
2694
- if ($_POST[$i."_element_cents".$id]) {
2695
- $value = $value.'.'.$_POST[$i."_element_cents".$id];
2696
- }
2697
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td >'.$value.$form_currency.'</td></tr>';
2698
- break;
2699
- }
2700
- case "type_paypal_select": {
2701
- $value = $_POST[$i."_element_label".$id].':'.$_POST[$i."_element".$id].$form_currency;
2702
- $element_quantity_label = $_POST[$i."_element_quantity_label".$id];
2703
- if (isset($element_quantity_label)) {
2704
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
2705
- $value .= '<br/>'.$_POST[$i."_element_quantity_label".$id].': '.$quantity;
2706
- }
2707
- for ($k = 0; $k < 50; $k++) {
2708
- $temp_val = $_POST[$i."_element_property_value".$id.$k];
2709
- if (isset($temp_val)) {
2710
- $value .= '<br/>'.$_POST[$i."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
2711
- }
2712
- }
2713
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$value.'</pre></td></tr>';
2714
- break;
2715
- }
2716
- case "type_paypal_radio": {
2717
- $value = $_POST[$i."_element_label".$id].' - '.$_POST[$i."_element".$id].$form_currency;
2718
- $element_quantity_label = $_POST[$i."_element_quantity_label".$id];
2719
- if (isset($element_quantity_label)) {
2720
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
2721
- $value .= '<br/>' . $_POST[$i."_element_quantity_label".$id] . ': ' . $quantity;
2722
- }
2723
- for ($k = 0; $k < 50; $k++) {
2724
- $temp_val = $_POST[$i."_element_property_value".$id.$k];
2725
- if (isset($temp_val)) {
2726
- $value .= '<br/>'.$_POST[$i."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
2727
- }
2728
- }
2729
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$value.'</pre></td></tr>';
2730
- break;
2731
- }
2732
- case "type_paypal_shipping": {
2733
- $value = $_POST[$i."_element_label".$id].' - '.$_POST[$i."_element".$id].$form_currency;
2734
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$value.'</pre></td></tr>';
2735
- break;
2736
- }
2737
- case "type_paypal_checkbox": {
2738
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td >';
2739
- $start = -1;
2740
- for ($j = 0; $j < 100; $j++) {
2741
- $element = $_POST[$i."_element".$id.$j];
2742
- if (isset($element)) {
2743
- $start = $j;
2744
- break;
2745
- }
2746
- }
2747
- if ($start != -1) {
2748
- for ($j = $start; $j < 100; $j++) {
2749
- $element = $_POST[$i."_element".$id.$j];
2750
- if (isset($element)) {
2751
- $list = $list.$_POST[$i."_element".$id.$j."_label"].' - '.($_POST[$i."_element".$id.$j]=='' ? '0'.$form_currency : $_POST[$i."_element".$id.$j]).$form_currency.'<br>';
2752
- }
2753
- }
2754
- }
2755
- $element_quantity_label = $_POST[$i."_element_quantity_label".$id];
2756
- if (isset($element_quantity_label)) {
2757
- $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
2758
- $list = $list.'<br/>'.$_POST[$i."_element_quantity_label".$id].': '.$quantity;
2759
- }
2760
- for ($k = 0; $k < 50; $k++) {
2761
- $temp_val = $_POST[$i."_element_property_value".$id.$k];
2762
- if (isset($temp_val)) {
2763
- $list = $list.'<br/>'.$_POST[$i."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
2764
- }
2765
- }
2766
- $list = $list.'</td></tr>';
2767
- break;
2768
- }
2769
- case "type_star_rating": {
2770
- $selected = (isset($_POST[$i."_selected_star_amount".$id]) ? $_POST[$i."_selected_star_amount".$id] : 0);
2771
- if (isset($_POST[$i."_star_amount".$id])) {
2772
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$selected.'/'.$_POST[$i."_star_amount".$id].'</pre></td></tr>';
2773
- }
2774
- break;
2775
- }
2776
- case "type_scale_rating": {
2777
- $selected = (isset($_POST[$i."_scale_radio".$id]) ? $_POST[$i."_scale_radio".$id] : 0);
2778
- if (isset($_POST[$i."_scale_amount".$id])) {
2779
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$selected.'/'.$_POST[$i."_scale_radio".$id].'</pre></td></tr>';
2780
- }
2781
- break;
2782
- }
2783
- case "type_spinner": {
2784
- if (isset($_POST[$i."_element".$id])) {
2785
- $list=$list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$_POST[$i."_element".$id].'</pre></td></tr>';
2786
- }
2787
- break;
2788
- }
2789
- case "type_slider": {
2790
- if (isset($_POST[$i."_slider_value".$id])) {
2791
- $list=$list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$_POST[$i."_slider_value".$id].'</pre></td></tr>';
2792
- }
2793
- break;
2794
- }
2795
- case "type_range": {
2796
- if(isset($_POST[$i."_element".$id.'0']) || isset($_POST[$i."_element".$id.'1'])) {
2797
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">From:'.$_POST[$i."_element".$id.'0'].'<span style="margin-left:6px">To</span>:'.$_POST[$i."_element".$id.'1'].'</pre></td></tr>';
2798
- }
2799
- break;
2800
- }
2801
- case "type_grading": {
2802
- if (isset($_POST[$i."_hidden_item".$id])) {
2803
- $element = $_POST[$i."_hidden_item".$id];
2804
- $grading = explode(":", $element);
2805
- $items_count = sizeof($grading) - 1;
2806
- $total = "";
2807
- for ($k = 0; $k < $items_count; $k++) {
2808
- if (isset($_POST[$i."_element".$id.$k])) {
2809
- $element .= $grading[$k].":".$_POST[$i."_element".$id.$k]." ";
2810
- $total += $_POST[$i."_element".$id.$k];
2811
- }
2812
- }
2813
- $element .= "Total:".$total;
2814
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$element.'</pre></td></tr>';
2815
- }
2816
- break;
2817
- }
2818
- case "type_matrix": {
2819
- $input_type=$_POST[$i."_input_type".$id];
2820
- $mat_rows = $_POST[$i."_hidden_row".$id];
2821
- $mat_rows = explode('***', $mat_rows);
2822
- $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
2823
- $mat_columns = $_POST[$i."_hidden_column".$id];
2824
- $mat_columns = explode('***', $mat_columns);
2825
- $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
2826
- $row_ids=explode(",",substr($_POST[$i."_row_ids".$id], 0, -1));
2827
- $column_ids=explode(",",substr($_POST[$i."_column_ids".$id], 0, -1));
2828
- $matrix = "<table>";
2829
- $matrix .= '<tr><td></td>';
2830
- for ($k = 0; $k < count($mat_columns); $k++) {
2831
- $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
2832
- }
2833
- $matrix .= '</tr>';
2834
- $aaa = Array();
2835
- $k = 0;
2836
- foreach ($row_ids as $row_id) {
2837
- $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
2838
- if ($input_type=="radio") {
2839
- $mat_radio = (isset($_POST[$i."_input_element".$id.$row_id]) ? $_POST[$i."_input_element".$id.$row_id] : 0);
2840
- if ($mat_radio == 0) {
2841
- $checked = "";
2842
- $aaa[1] = "";
2843
- }
2844
- else {
2845
- $aaa = explode("_", $mat_radio);
2846
- }
2847
- foreach ($column_ids as $column_id) {
2848
- if ($aaa[1] == $column_id) {
2849
- $checked = "checked";
2850
- }
2851
- else {
2852
- $checked = "";
2853
- }
2854
- $matrix .= '<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
2855
- }
2856
- }
2857
- else {
2858
- if ($input_type=="checkbox") {
2859
- foreach($column_ids as $column_id) {
2860
- $checked = $_POST[$i."_input_element".$id.$row_id.'_'.$column_id];
2861
- if ($checked == 1) {
2862
- $checked = "checked";
2863
- }
2864
- else {
2865
- $checked = "";
2866
- }
2867
- $matrix .= '<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
2868
- }
2869
- }
2870
- else {
2871
- if ($input_type=="text") {
2872
- foreach ($column_ids as $column_id) {
2873
- $checked = $_POST[$i."_input_element".$id.$row_id.'_'.$column_id];
2874
- $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
2875
- }
2876
- }
2877
- else {
2878
- foreach ($column_ids as $column_id) {
2879
- $checked = $_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id];
2880
- $matrix .='<td style="text-align:center">'.$checked.'</td>';
2881
- }
2882
- }
2883
- }
2884
- }
2885
- $matrix .= '</tr>';
2886
- $k++;
2887
- }
2888
- $matrix .= '</table>';
2889
- if (isset($matrix)) {
2890
- $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$matrix.'</pre></td></tr>';
2891
- }
2892
- break;
2893
- }
2894
- default:
2895
- break;
2896
- }
2897
- }
2898
- }
2899
- $list = $list . '</table>';
2900
- $list = wordwrap($list, 70, "\n", TRUE);
2901
- // add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
2902
- if ($row->from_mail != '') {
2903
- if ($row->from_name != '') {
2904
- $from_mail = "From: '" . $row->from_name . "' <" . $row->from_mail . ">" . "\r\n";
2905
- }
2906
- else {
2907
- $from_mail = "From: '' <" . $row->from_mail . ">" . "\r\n";
2908
- }
2909
- }
2910
- else {
2911
- $from_mail = '';
2912
- }
2913
- $headers = $from_mail . " Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\n";
2914
- for ($k = 0; $k < count($all_files); $k++) {
2915
- // $attachment[$k] = dirname(__FILE__) . '/uploads/' . $all_files[$k]['name'];
2916
- $attachment[$k]= $all_files[$k]['name'];
2917
- }
2918
- if (isset($cc[0])) {
2919
- foreach ($cc as $c) {
2920
- if ($c) {
2921
- $recipient = $c;
2922
- $subject = $row->title;
2923
- $new_script = wpautop($row->script_mail_user);
2924
- foreach ($label_order_original as $key => $label_each) {
2925
- if (strpos($row->script_mail_user, "%" . $label_each . "%") !== FALSE) {
2926
- $type = $label_type[$key];
2927
- if ($type != "type_submit_reset" or $type != "type_map" or $type != "type_editor" or $type != "type_captcha" or $type != "type_arithmetic_captcha" or $type != "type_recaptcha" or $type != "type_button") {
2928
- $new_value = "";
2929
- switch ($type) {
2930
- case 'type_text':
2931
- case 'type_password':
2932
- case 'type_textarea':
2933
- case "type_date":
2934
- case "type_own_select":
2935
- case "type_country":
2936
- case "type_number": {
2937
- $element = $_POST[$key."_element".$id];
2938
- if (isset($element)) {
2939
- $new_value = $element;
2940
- }
2941
- break;
2942
- }
2943
- case "type_hidden": {
2944
- $element = $_POST[$element_label];
2945
- if (isset($element)) {
2946
- $new_value = $element;
2947
- }
2948
- break;
2949
- }
2950
- case "type_mark_map": {
2951
- $element = $_POST[$key."_long".$id];
2952
- if (isset($element)) {
2953
- $new_value = 'Longitude:'.$_POST[$key."_long".$id].'<br/>Latitude:' . $_POST[$key."_lat".$id];
2954
- }
2955
- break;
2956
- }
2957
- case "type_submitter_mail": {
2958
- $element = $_POST[$key."_element".$id];
2959
- if (isset($element)) {
2960
- $new_value = $element;
2961
- }
2962
- break;
2963
- }
2964
- case "type_time": {
2965
- $hh = $_POST[$key."_hh".$id];
2966
- if (isset($hh)) {
2967
- $ss = $_POST[$key."_ss".$id];
2968
- if (isset($ss)) {
2969
- $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id].':'.$_POST[$key."_ss".$id];
2970
- }
2971
- else {
2972
- $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id];
2973
- }
2974
- $am_pm = $_POST[$key."_am_pm".$id];
2975
- if (isset($am_pm)) {
2976
- $new_value = $new_value.' '.$_POST[$key."_am_pm".$id];
2977
- }
2978
- }
2979
- break;
2980
- }
2981
- case "type_phone": {
2982
- $element_first = $_POST[$key."_element_first".$id];
2983
- if (isset($element_first)) {
2984
- $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
2985
- }
2986
- break;
2987
- }
2988
- case "type_name": {
2989
- $element_first = $_POST[$key."_element_first".$id];
2990
- if (isset($element_first)) {
2991
- $element_title = $_POST[$key."_element_title".$id];
2992
- if (isset($element_title)) {
2993
- $new_value = $_POST[$key."_element_title".$id].' '.$_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id].' '.$_POST[$key."_element_middle".$id];
2994
- }
2995
- else {
2996
- $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
2997
- }
2998
- }
2999
- break;
3000
- }
3001
- case "type_address": {
3002
- if (isset($_POST[$key."_street1".$id])) {
3003
- $new_value = $new_value.$_POST[$key."_street1".$id];
3004
- break;
3005
- }
3006
- if (isset($_POST[$key."_street2".$id])) {
3007
- $new_value = $new_value.$_POST[$key."_street2".$id];
3008
- break;
3009
- }
3010
- if (isset($_POST[$key."_city".$id])) {
3011
- $new_value = $new_value.$_POST[$key."_city".$id];
3012
- break;
3013
- }
3014
- if (isset($_POST[$key."_state".$id])) {
3015
- $new_value = $new_value.$_POST[$key."_state".$id];
3016
- break;
3017
- }
3018
- if (isset($_POST[$key."_postal".$id])) {
3019
- $new_value = $new_value.$_POST[$key."_postal".$id];
3020
- break;
3021
- }
3022
- if (isset($_POST[$key."_country".$id])) {
3023
- $new_value = $new_value.$_POST[$key."_country".$id];
3024
- break;
3025
- }
3026
- }
3027
- case "type_date_fields": {
3028
- $day = $_POST[$key."_day".$id];
3029
- if (isset($day)) {
3030
- $new_value = $_POST[$key."_day".$id].'-'.$_POST[$key."_month".$id].'-'.$_POST[$key."_year".$id];
3031
- }
3032
- break;
3033
- }
3034
- case "type_radio": {
3035
- $element = $_POST[$key."_other_input".$id];
3036
- if (isset($element)) {
3037
- $new_value = $_POST[$key."_other_input".$id];
3038
- break;
3039
- }
3040
- $element = $_POST[$key."_element".$id];
3041
- if (isset($element)) {
3042
- $new_value = $element;
3043
- }
3044
- break;
3045
- }
3046
- case "type_checkbox": {
3047
- $start = -1;
3048
- for ($j = 0; $j < 100; $j++) {
3049
- $element = $_POST[$key."_element".$id.$j];
3050
- if (isset($element)) {
3051
- $start = $j;
3052
- break;
3053
- }
3054
- }
3055
- $other_element_id = -1;
3056
- $is_other = $_POST[$key."_allow_other".$id];
3057
- if ($is_other == "yes") {
3058
- $other_element_id = $_POST[$key."_allow_other_num".$id];
3059
- }
3060
- if ($start != -1) {
3061
- for ($j = $start; $j < 100; $j++) {
3062
- $element = $_POST[$key."_element".$id.$j];
3063
- if (isset($element)) {
3064
- if ($j == $other_element_id) {
3065
- $new_value = $new_value.$_POST[$key."_other_input".$id].'<br>';
3066
- }
3067
- else {
3068
- $new_value = $new_value.$_POST[$key."_element".$id.$j].'<br>';
3069
- }
3070
- }
3071
- }
3072
- }
3073
- break;
3074
- }
3075
- case "type_paypal_price": {
3076
- $new_value = 0;
3077
- if ($_POST[$key."_element_dollars".$id]) {
3078
- $new_value = $_POST[$key."_element_dollars".$id];
3079
- }
3080
- if ($_POST[$key."_element_cents".$id]) {
3081
- $new_value = $new_value.'.'.$_POST[$key."_element_cents".$id];
3082
- }
3083
- $new_value = $new_value.$form_currency;
3084
- break;
3085
- }
3086
- case "type_paypal_select": {
3087
- $new_value = $_POST[$key."_element_label".$id].':'.$_POST[$key."_element".$id].$form_currency;
3088
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3089
- if (isset($element_quantity_label)) {
3090
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3091
- $new_value.='<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3092
- }
3093
- for ($k = 0; $k < 50; $k++) {
3094
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3095
- if (isset($temp_val)) {
3096
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
3097
- }
3098
- }
3099
- break;
3100
- }
3101
- case "type_paypal_radio": {
3102
- $new_value = $_POST[$key."_element_label".$id].' - '.$_POST[$key."_element".$id].$form_currency;
3103
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3104
- if (isset($element_quantity_label)) {
3105
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3106
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3107
- }
3108
- for ($k = 0; $k < 50; $k++) {
3109
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3110
- if (isset($temp_val)) {
3111
- $new_value .= '<br/>' . $_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3112
- }
3113
- }
3114
- break;
3115
- }
3116
- case "type_paypal_shipping": {
3117
- $new_value = $_POST[$key."_element_label".$id].' : '.$_POST[$key."_element".$id].$form_currency;
3118
- break;
3119
- }
3120
- case "type_paypal_checkbox": {
3121
- $start = -1;
3122
- for($j = 0; $j < 100; $j++) {
3123
- $element = $_POST[$key."_element".$id.$j];
3124
- if (isset($element)) {
3125
- $start = $j;
3126
- break;
3127
- }
3128
- }
3129
- if ($start != -1) {
3130
- for ($j = $start; $j<100; $j++) {
3131
- $element = $_POST[$key."_element".$id.$j];
3132
- if (isset($element)) {
3133
- $new_value = $new_value.$_POST[$key."_element".$id.$j."_label"].' - '.(($_POST[$key."_element".$id.$j] == '') ? '0'.$form_currency : $_POST[$key."_element".$id.$j]).$form_currency.'<br>';
3134
- }
3135
- }
3136
- }
3137
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3138
- if (isset($element_quantity_label)) {
3139
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3140
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3141
- }
3142
- for ($k = 0; $k < 50; $k++) {
3143
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3144
- if (isset($temp_val)) {
3145
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3146
- }
3147
- }
3148
- break;
3149
- }
3150
- case "type_star_rating":
3151
- {
3152
- $element=$_POST[$key."_star_amount".$id];
3153
- $selected=(isset($_POST[$key."_selected_star_amount".$id]) ? $_POST[$key."_selected_star_amount".$id] : 0);
3154
-
3155
-
3156
- if(isset($element))
3157
- {
3158
- $new_value=$new_value.$selected.'/'.$element;
3159
- }
3160
- break;
3161
- }
3162
-
3163
-
3164
- case "type_scale_rating":
3165
- {
3166
- $element=$_POST[$key."_scale_amount".$id];
3167
- $selected=(isset($_POST[$key."_scale_radio".$id]) ? $_POST[$key."_scale_radio".$id] : 0);
3168
-
3169
-
3170
- if(isset($element))
3171
- {
3172
- $new_value=$new_value.$selected.'/'.$element;
3173
- }
3174
- break;
3175
- }
3176
-
3177
- case "type_spinner":
3178
- {
3179
-
3180
- if (isset($_POST[$key."_element".$id])) {
3181
- $new_value = $new_value . $_POST[$key."_element".$id];
3182
- }
3183
- break;
3184
- }
3185
-
3186
- case "type_slider":
3187
- {
3188
-
3189
- $element=$_POST[$key."_slider_value".$id];
3190
- if(isset($element))
3191
- {
3192
- $new_value=$new_value.$element;
3193
- }
3194
- break;
3195
- }
3196
- case "type_range":
3197
- {
3198
-
3199
- $element0=$_POST[$key."_element".$id.'0'];
3200
- $element1=$_POST[$key."_element".$id.'1'];
3201
- if(isset($element0) || isset($element1))
3202
- {
3203
- $new_value=$new_value.$element0.'-'.$element1;
3204
- }
3205
- break;
3206
- }
3207
-
3208
- case "type_grading":
3209
- {
3210
- $element=$_POST[$key."_hidden_item".$id];
3211
- $grading = explode(":",$element);
3212
- $items_count = sizeof($grading)-1;
3213
-
3214
- $element = "";
3215
- $total = "";
3216
-
3217
- for($k=0;$k<$items_count;$k++)
3218
-
3219
- {
3220
- $element .= $grading[$k].":".$_POST[$key."_element".$id.$k]." ";
3221
- $total += $_POST[$key."_element".$id.$k];
3222
- }
3223
-
3224
- $element .="Total:".$total;
3225
-
3226
-
3227
- if(isset($element))
3228
- {
3229
- $new_value=$new_value.$element;
3230
- }
3231
- break;
3232
- }
3233
-
3234
- case "type_matrix":
3235
- {
3236
-
3237
-
3238
- $input_type=$_POST[$key."_input_type".$id];
3239
-
3240
- $mat_rows = $_POST[$key."_hidden_row".$id];
3241
- $mat_rows = explode('***', $mat_rows);
3242
- $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
3243
-
3244
- $mat_columns = $_POST[$key."_hidden_column".$id];
3245
- $mat_columns = explode('***', $mat_columns);
3246
- $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
3247
-
3248
- $row_ids=explode(",",substr($_POST[$key."_row_ids".$id], 0, -1));
3249
- $column_ids=explode(",",substr($_POST[$key."_column_ids".$id], 0, -1));
3250
-
3251
-
3252
- $matrix="<table>";
3253
-
3254
- $matrix .='<tr><td></td>';
3255
-
3256
- for( $k=0;$k< count($mat_columns) ;$k++)
3257
- $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
3258
- $matrix .='</tr>';
3259
-
3260
- $aaa=Array();
3261
- $k=0;
3262
- foreach( $row_ids as $row_id){
3263
- $matrix .='<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
3264
-
3265
- if($input_type=="radio"){
3266
-
3267
- $mat_radio = (isset($_POST[$key."_input_element".$id.$row_id]) ? $_POST[$key."_input_element".$id.$row_id] : 0);
3268
- if($mat_radio==0){
3269
- $checked="";
3270
- $aaa[1]="";
3271
- }
3272
- else{
3273
- $aaa=explode("_",$mat_radio);
3274
- }
3275
-
3276
- foreach( $column_ids as $column_id){
3277
- if($aaa[1]==$column_id)
3278
- $checked="checked";
3279
- else
3280
- $checked="";
3281
- $matrix .='<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
3282
-
3283
- }
3284
-
3285
- }
3286
- else{
3287
- if($input_type=="checkbox")
3288
- {
3289
- foreach( $column_ids as $column_id){
3290
- $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3291
- if($checked==1)
3292
- $checked = "checked";
3293
- else
3294
- $checked = "";
3295
-
3296
- $matrix .='<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
3297
-
3298
- }
3299
-
3300
- }
3301
- else
3302
- {
3303
- if($input_type=="text")
3304
- {
3305
-
3306
- foreach( $column_ids as $column_id){
3307
- $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3308
-
3309
- $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
3310
-
3311
- }
3312
-
3313
- }
3314
- else{
3315
- foreach( $column_ids as $column_id){
3316
- $checked = $_POST[$key."_select_yes_no".$id.$row_id.'_'.$column_id];
3317
- $matrix .='<td style="text-align:center">'.$checked.'</td>';
3318
-
3319
-
3320
-
3321
- }
3322
- }
3323
-
3324
- }
3325
-
3326
- }
3327
- $matrix .='</tr>';
3328
- $k++;
3329
- }
3330
- $matrix .='</table>';
3331
-
3332
-
3333
-
3334
-
3335
-
3336
- if(isset($matrix))
3337
- {
3338
- $new_value=$new_value.$matrix;
3339
- }
3340
-
3341
- break;
3342
- }
3343
- default: break;
3344
- }
3345
- $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3346
- }
3347
- }
3348
- }
3349
- if (strpos($new_script, "%all%") !== FALSE) {
3350
- $new_script = str_replace("%all%", $list, $new_script);
3351
- }
3352
- $body = $new_script;
3353
- $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment);
3354
- }
3355
- if ($row->mail) {
3356
- if ($c) {
3357
- // $headers_form_mail = "From: " . $c . " <" . $c . ">" . "\r\n";
3358
- $headers = "From: '" . $c . "' <" . $c . ">" . "\r\n" . "Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\n";
3359
- }
3360
- // else {
3361
- // $headers_form_mail = "";
3362
- // }
3363
- if ($row_mail_one_time) {
3364
- $recipient = $row->mail;
3365
- $subject = $row->title;
3366
- $new_script = wpautop($row->script_mail);
3367
- foreach($label_order_original as $key => $label_each) {
3368
- if (strpos($row->script_mail, "%" . $label_each . "%") !== FALSE) {
3369
- $type = $label_type[$key];
3370
- if ($type != "type_submit_reset" or $type!="type_map" or $type!="type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
3371
- $new_value ="";
3372
- switch ($type) {
3373
- case 'type_text':
3374
- case 'type_password':
3375
- case 'type_textarea':
3376
- case "type_date":
3377
- case "type_own_select":
3378
- case "type_country":
3379
- case "type_number": {
3380
- $element = $_POST[$key."_element".$id];
3381
- if (isset($element)) {
3382
- $new_value = $element;
3383
- }
3384
- break;
3385
- }
3386
- case "type_hidden": {
3387
- $element = $_POST[$element_label];
3388
- if(isset($element))
3389
- {
3390
- $new_value = $element;
3391
- }
3392
- break;
3393
- }
3394
- case "type_mark_map": {
3395
- $element = $_POST[$key."_long".$id];
3396
- if (isset($element)) {
3397
- $new_value = 'Longitude:'.$_POST[$key."_long".$id].'<br/>Latitude:'.$_POST[$key."_lat".$id];
3398
- }
3399
- break;
3400
- }
3401
- case "type_submitter_mail": {
3402
- $element = $_POST[$key."_element".$id];
3403
- if (isset($element)) {
3404
- $new_value = $element;
3405
- }
3406
- break;
3407
- }
3408
- case "type_time": {
3409
- $hh = $_POST[$key."_hh".$id];
3410
- if (isset($hh)) {
3411
- $ss = $_POST[$key."_ss".$id];
3412
- if (isset($ss)) {
3413
- $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id].':'.$_POST[$key."_ss".$id];
3414
- }
3415
- else {
3416
- $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id];
3417
- }
3418
- $am_pm = $_POST[$key."_am_pm".$id];
3419
- if (isset($am_pm)) {
3420
- $new_value = $new_value.' '.$_POST[$key."_am_pm".$id];
3421
- }
3422
- }
3423
- break;
3424
- }
3425
- case "type_phone": {
3426
- $element_first = $_POST[$key."_element_first".$id];
3427
- if (isset($element_first)) {
3428
- $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3429
- }
3430
- break;
3431
- }
3432
- case "type_name": {
3433
- $element_first = $_POST[$key."_element_first".$id];
3434
- if (isset($element_first)) {
3435
- $element_title = $_POST[$key."_element_title".$id];
3436
- if (isset($element_title)) {
3437
- $new_value = $_POST[$key."_element_title".$id].' '.$_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id].' '.$_POST[$key."_element_middle".$id];
3438
- }
3439
- else {
3440
- $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3441
- }
3442
- }
3443
- break;
3444
- }
3445
- case "type_address": {
3446
- $street1 = $_POST[$key."_street1".$id];
3447
- if (isset($_POST[$key."_street1".$id])) {
3448
- $new_value = $new_value.$_POST[$key."_street1".$id];
3449
- break;
3450
- }
3451
- if (isset($_POST[$key."_street2".$id])) {
3452
- $new_value=$new_value.$_POST[$key."_street2".$id];
3453
- break;
3454
- }
3455
- if (isset($_POST[$key."_city".$id])) {
3456
- $new_value=$new_value.$_POST[$key."_city".$id];
3457
- break;
3458
- }
3459
- if (isset($_POST[$key."_state".$id])) {
3460
- $new_value=$new_value.$_POST[$key."_state".$id];
3461
- break;
3462
- }
3463
- if (isset($_POST[$key."_postal".$id])) {
3464
- $new_value=$new_value.$_POST[$key."_postal".$id];
3465
- break;
3466
- }
3467
- if (isset($_POST[$key."_country".$id])) {
3468
- $new_value=$new_value.$_POST[$key."_country".$id];
3469
- break;
3470
- }
3471
- }
3472
- case "type_date_fields": {
3473
- $day = $_POST[$key."_day".$id];
3474
- if (isset($day)) {
3475
- $new_value = $_POST[$key."_day".$id].'-'.$_POST[$key."_month".$id].'-'.$_POST[$key."_year".$id];
3476
- }
3477
- break;
3478
- }
3479
- case "type_radio": {
3480
- $element = $_POST[$key."_other_input".$id];
3481
- if (isset($element)) {
3482
- $new_value = $_POST[$key."_other_input".$id];
3483
- break;
3484
- }
3485
- $element = $_POST[$key."_element".$id];
3486
- if (isset($element)) {
3487
- $new_value = $element;
3488
- }
3489
- break;
3490
- }
3491
- case "type_checkbox": {
3492
- $start = -1;
3493
- for ($j=0; $j<100; $j++) {
3494
- $element = $_POST[$key."_element".$id.$j];
3495
- if (isset($element)) {
3496
- $start = $j;
3497
- break;
3498
- }
3499
- }
3500
- $other_element_id=-1;
3501
- $is_other = $_POST[$key."_allow_other".$id];
3502
- if ($is_other == "yes") {
3503
- $other_element_id = $_POST[$key."_allow_other_num".$id];
3504
- }
3505
- if ($start != -1) {
3506
- for ($j = $start; $j < 100; $j++) {
3507
- $element = $_POST[$key."_element".$id.$j];
3508
- if (isset($element)) {
3509
- if ($j == $other_element_id) {
3510
- $new_value = $new_value.$_POST[$key."_other_input".$id].'<br>';
3511
- }
3512
- else {
3513
- $new_value = $new_value.$_POST[$key."_element".$id.$j].'<br>';
3514
- }
3515
- }
3516
- }
3517
- }
3518
- break;
3519
- }
3520
- case "type_paypal_price": {
3521
- $new_value = 0;
3522
- if ($_POST[$key."_element_dollars".$id]) {
3523
- $new_value = $_POST[$key."_element_dollars".$id];
3524
- }
3525
- if ($_POST[$key."_element_cents".$id]) {
3526
- $new_value = $new_value.'.'.$_POST[$key."_element_cents".$id];
3527
- }
3528
- $new_value = $new_value.$form_currency;
3529
- break;
3530
- }
3531
- case "type_paypal_select": {
3532
- $new_value = $_POST[$key."_element_label".$id].':'.$_POST[$key."_element".$id].$form_currency;
3533
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3534
- if (isset($element_quantity_label)) {
3535
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3536
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3537
- }
3538
- for($k = 0; $k < 50; $k++) {
3539
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3540
- if (isset($temp_val)) {
3541
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3542
- }
3543
- }
3544
- break;
3545
- }
3546
- case "type_paypal_radio": {
3547
- $new_value = $_POST[$key."_element_label".$id].' - '.$_POST[$key."_element".$id].$form_currency;
3548
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3549
- if (isset($element_quantity_label)) {
3550
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3551
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3552
- }
3553
- for ($k = 0; $k < 50; $k++) {
3554
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3555
- if (isset($temp_val)) {
3556
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3557
- }
3558
- }
3559
- break;
3560
- }
3561
- case "type_paypal_shipping": {
3562
- $new_value = $_POST[$key."_element_label".$id].' : '.$_POST[$key."_element".$id].$form_currency;
3563
- break;
3564
- }
3565
- case "type_paypal_checkbox": {
3566
- $start = -1;
3567
- for ($j = 0; $j < 100; $j++) {
3568
- $element = $_POST[$key."_element".$id.$j];
3569
- if (isset($element)) {
3570
- $start = $j;
3571
- break;
3572
- }
3573
- }
3574
- if ($start != -1) {
3575
- for ($j = $start; $j < 100; $j++) {
3576
- $element = $_POST[$key."_element".$id.$j];
3577
- if (isset($element)) {
3578
- $new_value = $new_value.$_POST[$key."_element".$id.$j."_label"].' - '.(($_POST[$key."_element".$id.$j] == '') ? '0'.$form_currency : $_POST[$key."_element".$id.$j]).$form_currency.'<br>';
3579
- }
3580
- }
3581
- }
3582
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3583
- if (isset($element_quantity_label)) {
3584
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3585
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3586
- }
3587
- for ($k = 0; $k < 50; $k++) {
3588
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3589
- if (isset($temp_val)) {
3590
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3591
- }
3592
- }
3593
- break;
3594
- }
3595
- case "type_star_rating": {
3596
- if (isset($_POST[$key."_star_amount".$id])) {
3597
- $selected = (isset($_POST[$key."_selected_star_amount".$id]) ? $_POST[$key."_selected_star_amount".$id] : 0);
3598
- $new_value = $new_value.$selected.'/'.$_POST[$key."_star_amount".$id];
3599
- }
3600
- break;
3601
- }
3602
- case "type_scale_rating": {
3603
- if (isset($_POST[$key."_scale_amount".$id])) {
3604
- $selected = (isset($_POST[$key."_scale_radio".$id]) ? $_POST[$key."_scale_radio".$id] : 0);
3605
- $new_value=$new_value.$selected.'/'.$_POST[$key."_scale_amount".$id];
3606
- }
3607
- break;
3608
- }
3609
- case "type_spinner": {
3610
- if(isset($_POST[$key."_element".$id])) {
3611
- $new_value = $new_value.$_POST[$key."_element".$id];
3612
- }
3613
- break;
3614
- }
3615
- case "type_slider": {
3616
- if (isset($_POST[$key."_slider_value".$id])) {
3617
- $new_value = $new_value.$_POST[$key."_slider_value".$id];
3618
- }
3619
- break;
3620
- }
3621
- case "type_range": {
3622
- if (isset($_POST[$key."_element".$id.'0']) || isset($_POST[$key."_element".$id.'1'])) {
3623
- $new_value=$new_value.$_POST[$key."_element".$id.'0'].'-'.$_POST[$key."_element".$id.'1'];
3624
- }
3625
- break;
3626
- }
3627
-
3628
- case "type_grading":
3629
- {
3630
- $element=$_POST[$key."_hidden_item".$id];
3631
- $grading = explode(":",$element);
3632
- $items_count = sizeof($grading)-1;
3633
-
3634
- $element = "";
3635
- $total = "";
3636
-
3637
- for($k=0;$k<$items_count;$k++) {
3638
- $element .= $grading[$k].":".$_POST[$key."_element".$id.$k]." ";
3639
- $total += $_POST[$key."_element".$id.$k];
3640
- }
3641
-
3642
- $element .="Total:".$total;
3643
-
3644
-
3645
- if(isset($element))
3646
- {
3647
- $new_value=$new_value.$element;
3648
- }
3649
- break;
3650
- }
3651
-
3652
- case "type_matrix":
3653
- {
3654
-
3655
-
3656
- $input_type=$_POST[$key."_input_type".$id];
3657
-
3658
- $mat_rows = $_POST[$key."_hidden_row".$id];
3659
- $mat_rows = explode('***', $mat_rows);
3660
- $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
3661
-
3662
- $mat_columns = $_POST[$key."_hidden_column".$id];
3663
- $mat_columns = explode('***', $mat_columns);
3664
- $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
3665
-
3666
- $row_ids=explode(",",substr($_POST[$key."_row_ids".$id], 0, -1));
3667
- $column_ids=explode(",",substr($_POST[$key."_column_ids".$id], 0, -1));
3668
- $matrix="<table>";
3669
-
3670
- $matrix .='<tr><td></td>';
3671
-
3672
- for( $k=0;$k< count($mat_columns) ;$k++)
3673
- $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
3674
- $matrix .='</tr>';
3675
-
3676
- $aaa=Array();
3677
- $k=0;
3678
- foreach( $row_ids as $row_id){
3679
- $matrix .='<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
3680
-
3681
- if($input_type=="radio"){
3682
-
3683
- $mat_radio = (isset($_POST[$key."_input_element".$id.$row_id]) ? $_POST[$key."_input_element".$id.$row_id] : 0);
3684
- if($mat_radio==0){
3685
- $checked="";
3686
- $aaa[1]="";
3687
- }
3688
- else{
3689
- $aaa=explode("_",$mat_radio);
3690
- }
3691
-
3692
- foreach( $column_ids as $column_id){
3693
- if($aaa[1]==$column_id)
3694
- $checked="checked";
3695
- else
3696
- $checked="";
3697
- $matrix .='<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
3698
-
3699
- }
3700
-
3701
- }
3702
- else{
3703
- if($input_type=="checkbox")
3704
- {
3705
- foreach( $column_ids as $column_id){
3706
- $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3707
- if($checked==1)
3708
- $checked = "checked";
3709
- else
3710
- $checked = "";
3711
-
3712
- $matrix .='<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
3713
-
3714
- }
3715
-
3716
- }
3717
- else
3718
- {
3719
- if($input_type=="text")
3720
- {
3721
-
3722
- foreach( $column_ids as $column_id){
3723
- $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3724
-
3725
- $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
3726
-
3727
- }
3728
-
3729
- }
3730
- else{
3731
- foreach( $column_ids as $column_id){
3732
- $checked = $_POST[$key."_select_yes_no".$id.$row_id.'_'.$column_id];
3733
- $matrix .='<td style="text-align:center">'.$checked.'</td>';
3734
-
3735
-
3736
-
3737
- }
3738
- }
3739
-
3740
- }
3741
-
3742
- }
3743
- $matrix .='</tr>';
3744
- $k++;
3745
- }
3746
- $matrix .='</table>';
3747
-
3748
-
3749
-
3750
-
3751
-
3752
- if(isset($matrix))
3753
- {
3754
- $new_value=$new_value.$matrix;
3755
- }
3756
-
3757
- break;
3758
- }
3759
- default: break;
3760
- }
3761
- $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3762
- }
3763
- }
3764
- }
3765
- if (strpos($new_script, "%all%") !== FALSE) {
3766
- $new_script = str_replace("%all%", $list, $new_script);
3767
- }
3768
- $body = $new_script;
3769
- $mode = 1;
3770
- $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment);
3771
- $row_mail_one_time = 0;
3772
- }
3773
- }
3774
- }
3775
- }
3776
- else {
3777
- if ($row->mail) {
3778
- $recipient = $row->mail;
3779
- $subject = $row->title;
3780
- $new_script = wpautop($row->script_mail);
3781
- foreach($label_order_original as $key => $label_each) {
3782
- if (strpos($row->script_mail, "%" . $label_each . "%") !== FALSE) {
3783
- $type = $label_type[$key];
3784
- if ($type != "type_submit_reset" or $type != "type_map" or $type != "type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
3785
- $new_value = "";
3786
- switch ($type) {
3787
- case 'type_text':
3788
- case 'type_password':
3789
- case 'type_textarea':
3790
- case "type_date":
3791
- case "type_own_select":
3792
- case "type_country":
3793
- case "type_number": {
3794
- $element = $_POST[$key."_element".$id];
3795
- if (isset($element)) {
3796
- $new_value = $element;
3797
- }
3798
- break;
3799
- }
3800
- case "type_hidden": {
3801
- $element = $_POST[$element_label];
3802
- if (isset($element)) {
3803
- $new_value = $element;
3804
- }
3805
- break;
3806
- }
3807
- case "type_mark_map": {
3808
- $element = $_POST[$key."_long".$id];
3809
- if (isset($element)) {
3810
- $new_value = 'Longitude:'.$_POST[$key."_long".$id].'<br/>Latitude:'.$_POST[$key."_lat".$id];
3811
- }
3812
- break;
3813
- }
3814
- case "type_submitter_mail": {
3815
- $element = $_POST[$key."_element".$id];
3816
- if (isset($element)) {
3817
- $new_value = $element;
3818
- }
3819
- break;
3820
- }
3821
- case "type_time": {
3822
- $hh = $_POST[$key."_hh".$id];
3823
- if (isset($hh)) {
3824
- $ss = $_POST[$key."_ss".$id];
3825
- if (isset($ss)) {
3826
- $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id].':'.$_POST[$key."_ss".$id];
3827
- }
3828
- else {
3829
- $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id];
3830
- }
3831
- $am_pm = $_POST[$key."_am_pm".$id];
3832
- if (isset($am_pm)) {
3833
- $new_value = $new_value.' '.$_POST[$key."_am_pm".$id];
3834
- }
3835
- }
3836
- break;
3837
- }
3838
- case "type_phone": {
3839
- $element_first = $_POST[$key."_element_first".$id];
3840
- if (isset($element_first)) {
3841
- $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3842
- }
3843
- break;
3844
- }
3845
- case "type_name": {
3846
- $element_first = $_POST[$key."_element_first".$id];
3847
- if (isset($element_first)) {
3848
- $element_title = $_POST[$key."_element_title".$id];
3849
- if (isset($element_title)) {
3850
- $new_value = $_POST[$key."_element_title".$id].' '.$_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id].' '.$_POST[$key."_element_middle".$id];
3851
- }
3852
- else {
3853
- $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3854
- }
3855
- }
3856
- break;
3857
- }
3858
- case "type_address": {
3859
- if (isset($_POST[$key."_street1".$id])) {
3860
- $new_value = $new_value.$_POST[$key."_street1".$id];
3861
- break;
3862
- }
3863
- if (isset($_POST[$key."_street2".$id])) {
3864
- $new_value = $new_value.$_POST[$key."_street2".$id];
3865
- break;
3866
- }
3867
- if (isset($_POST[$key."_city".$id])) {
3868
- $new_value = $new_value.$_POST[$key."_city".$id];
3869
- break;
3870
- }
3871
- if (isset($_POST[$key."_state".$id])) {
3872
- $new_value = $new_value.$_POST[$key."_state".$id];
3873
- break;
3874
- }
3875
- if (isset($_POST[$key."_postal".$id])) {
3876
- $new_value = $new_value.$_POST[$key."_postal".$id];
3877
- break;
3878
- }
3879
- if (isset($_POST[$key."_country".$id])) {
3880
- $new_value = $new_value.$_POST[$key."_country".$id];
3881
- break;
3882
- }
3883
- }
3884
- case "type_date_fields": {
3885
- $day = $_POST[$key."_day".$id];
3886
- if (isset($day)) {
3887
- $new_value = $_POST[$key."_day".$id].'-'.$_POST[$key."_month".$id].'-'.$_POST[$key."_year".$id];
3888
- }
3889
- break;
3890
- }
3891
- case "type_radio": {
3892
- $element = $_POST[$key."_other_input".$id];
3893
- if (isset($element)) {
3894
- $new_value = $_POST[$key."_other_input".$id];
3895
- break;
3896
- }
3897
- $element = $_POST[$key."_element".$id];
3898
- if (isset($element)) {
3899
- $new_value = $element;
3900
- }
3901
- break;
3902
- }
3903
- case "type_checkbox": {
3904
- $start = -1;
3905
- for ($j = 0; $j < 100; $j++) {
3906
- $element = $_POST[$key."_element".$id.$j];
3907
- if (isset($element)) {
3908
- $start = $j;
3909
- break;
3910
- }
3911
- }
3912
- $other_element_id = -1;
3913
- $is_other = $_POST[$key."_allow_other".$id];
3914
- if ($is_other == "yes") {
3915
- $other_element_id = $_POST[$key."_allow_other_num".$id];
3916
- }
3917
- if ($start != -1) {
3918
- for ($j = $start; $j < 100; $j++) {
3919
- $element = $_POST[$key."_element".$id.$j];
3920
- if (isset($element)) {
3921
- if ($j == $other_element_id) {
3922
- $new_value = $new_value.$_POST[$key."_other_input".$id].'<br>';
3923
- }
3924
- else {
3925
- $new_value = $new_value.$_POST[$key."_element".$id.$j].'<br>';
3926
- }
3927
- }
3928
- }
3929
- }
3930
- break;
3931
- }
3932
- case "type_paypal_price": {
3933
- $new_value = 0;
3934
- if ($_POST[$key."_element_dollars".$id]) {
3935
- $new_value = $_POST[$key."_element_dollars".$id];
3936
- }
3937
- if ($_POST[$key."_element_cents".$id]) {
3938
- $new_value = $new_value.'.'.$_POST[$key."_element_cents".$id];
3939
- }
3940
- $new_value = $new_value.$form_currency;
3941
- break;
3942
- }
3943
- case "type_paypal_select": {
3944
- $new_value = $_POST[$key."_element_label".$id].':'.$_POST[$key."_element".$id].$form_currency;
3945
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3946
- if (isset($element_quantity_label)) {
3947
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3948
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3949
- }
3950
- for ($k = 0; $k < 50; $k++) {
3951
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3952
- if (isset($temp_val)) {
3953
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3954
- }
3955
- }
3956
- break;
3957
- }
3958
- case "type_paypal_radio": {
3959
- $new_value = $_POST[$key."_element_label".$id].' - '.$_POST[$key."_element".$id].$form_currency;
3960
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3961
- if (isset($element_quantity_label)) {
3962
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3963
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3964
- }
3965
- for ($k = 0; $k < 50; $k++) {
3966
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
3967
- if (isset($temp_val)) {
3968
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3969
- }
3970
- }
3971
- break;
3972
- }
3973
- case "type_paypal_shipping": {
3974
- $new_value = $_POST[$key."_element_label".$id].' : '.$_POST[$key."_element".$id].$form_currency;
3975
- break;
3976
- }
3977
- case "type_paypal_checkbox": {
3978
- $start = -1;
3979
- for ($j = 0; $j < 100; $j++) {
3980
- $element = $_POST[$key."_element".$id.$j];
3981
- if (isset($element)) {
3982
- $start = $j;
3983
- break;
3984
- }
3985
- }
3986
- if ($start != -1) {
3987
- for ($j = $start; $j < 100; $j++) {
3988
- $element = $_POST[$key."_element".$id.$j];
3989
- if (isset($element)) {
3990
- $new_value = $new_value.$_POST[$key."_element".$id.$j."_label"].' - '.(($_POST[$key."_element".$id.$j] == '') ? '0'.$form_currency : $_POST[$key."_element".$id.$j]).$form_currency.'<br>';
3991
- }
3992
- }
3993
- }
3994
- $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3995
- if (isset($element_quantity_label)) {
3996
- $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3997
- $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3998
- }
3999
- for ($k = 0; $k < 50; $k++) {
4000
- $temp_val = $_POST[$key."_element_property_value".$id.$k];
4001
- if (isset($temp_val)) {
4002
- $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
4003
- }
4004
- }
4005
- break;
4006
- }
4007
- case "type_star_rating":
4008
- {
4009
- $element=$_POST[$key."_star_amount".$id];
4010
- $selected=(isset($_POST[$key."_selected_star_amount".$id]) ? $_POST[$key."_selected_star_amount".$id] : 0);
4011
- if(isset($element))
4012
- {
4013
- $new_value=$new_value.$selected.'/'.$element;
4014
- }
4015
- break;
4016
- }
4017
-
4018
-
4019
- case "type_scale_rating":
4020
- {
4021
- $element=$_POST[$key."_scale_amount".$id];
4022
- $selected=(isset($_POST[$key."_scale_radio".$id]) ? $_POST[$key."_scale_radio".$id] : 0);
4023
-
4024
-
4025
- if(isset($element))
4026
- {
4027
- $new_value=$new_value.$selected.'/'.$element;
4028
- }
4029
- break;
4030
- }
4031
-
4032
- case "type_spinner":
4033
- {
4034
-
4035
- if(isset($_POST[$key."_element".$id]))
4036
- {
4037
- $new_value=$new_value.$_POST[$key."_element".$id];
4038
- }
4039
- break;
4040
- }
4041
-
4042
- case "type_slider":
4043
- {
4044
-
4045
- $element=$_POST[$key."_slider_value".$id];
4046
- if(isset($element))
4047
- {
4048
- $new_value=$new_value.$element;
4049
- }
4050
- break;
4051
- }
4052
- case "type_range":
4053
- {
4054
-
4055
- $element0=$_POST[$key."_element".$id.'0'];
4056
- $element1=$_POST[$key."_element".$id.'1'];
4057
- if(isset($element0) || isset($element1))
4058
- {
4059
- $new_value=$new_value.$element0.'-'.$element1;
4060
- }
4061
- break;
4062
- }
4063
-
4064
- case "type_grading":
4065
- {
4066
- $element=$_POST[$key."_hidden_item".$id];
4067
- $grading = explode(":",$element);
4068
- $items_count = sizeof($grading)-1;
4069
-
4070
- $element = "";
4071
- $total = "";
4072
-
4073
- for($k=0;$k<$items_count;$k++)
4074
-
4075
- {
4076
- $element .= $grading[$k].":".$_POST[$key."_element".$id.$k]." ";
4077
- $total += $_POST[$key."_element".$id.$k];
4078
- }
4079
-
4080
- $element .="Total:".$total;
4081
-
4082
-
4083
- if(isset($element))
4084
- {
4085
- $new_value=$new_value.$element;
4086
- }
4087
- break;
4088
- }
4089
-
4090
- case "type_matrix":
4091
- {
4092
-
4093
-
4094
- $input_type=$_POST[$key."_input_type".$id];
4095
-
4096
- $mat_rows = $_POST[$key."_hidden_row".$id];
4097
- $mat_rows = explode('***', $mat_rows);
4098
- $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
4099
-
4100
- $mat_columns = $_POST[$key."_hidden_column".$id];
4101
- $mat_columns = explode('***', $mat_columns);
4102
- $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
4103
-
4104
- $row_ids=explode(",",substr($_POST[$key."_row_ids".$id], 0, -1));
4105
- $column_ids=explode(",",substr($_POST[$key."_column_ids".$id], 0, -1));
4106
-
4107
-
4108
- $matrix="<table>";
4109
-
4110
- $matrix .='<tr><td></td>';
4111
-
4112
- for( $k=0;$k< count($mat_columns) ;$k++)
4113
- $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
4114
- $matrix .='</tr>';
4115
-
4116
- $aaa=Array();
4117
- $k=0;
4118
- foreach($row_ids as $row_id)
4119
- {
4120
- $matrix .='<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
4121
-
4122
- if($input_type=="radio"){
4123
-
4124
- $mat_radio = (isset($_POST[$key."_input_element".$id.$row_id]) ? $_POST[$key."_input_element".$id.$row_id] : 0);
4125
- if($mat_radio==0){
4126
- $checked="";
4127
- $aaa[1]="";
4128
- }
4129
- else{
4130
- $aaa=explode("_",$mat_radio);
4131
- }
4132
-
4133
- foreach($column_ids as $column_id){
4134
- if($aaa[1]==$column_id)
4135
- $checked="checked";
4136
- else
4137
- $checked="";
4138
- $matrix .='<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
4139
-
4140
- }
4141
-
4142
- }
4143
- else{
4144
- if($input_type=="checkbox")
4145
- {
4146
- foreach($column_ids as $column_id){
4147
- $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
4148
- if($checked==1)
4149
- $checked = "checked";
4150
- else
4151
- $checked = "";
4152
-
4153
- $matrix .='<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
4154
-
4155
- }
4156
-
4157
- }
4158
- else
4159
- {
4160
- if($input_type=="text")
4161
- {
4162
-
4163
- foreach($column_ids as $column_id){
4164
- $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
4165
-
4166
- $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
4167
-
4168
- }
4169
-
4170
- }
4171
- else{
4172
- foreach($column_ids as $column_id){
4173
- $checked = $_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id];
4174
- $matrix .='<td style="text-align:center">'.$checked.'</td>';
4175
-
4176
-
4177
-
4178
- }
4179
- }
4180
-
4181
- }
4182
-
4183
- }
4184
- $matrix .='</tr>';
4185
- $k++;
4186
- }
4187
- $matrix .='</table>';
4188
-
4189
-
4190
-
4191
-
4192
-
4193
- if(isset($matrix))
4194
- {
4195
- $new_value=$new_value.$matrix;
4196
- }
4197
-
4198
- break;
4199
- }
4200
- default: break;
4201
- }
4202
- $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
4203
- }
4204
- }
4205
- }
4206
- if (strpos($new_script, "%all%") !== FALSE) {
4207
- $new_script = str_replace("%all%", $list, $new_script);
4208
- }
4209
- $body = $new_script;
4210
- $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment);
4211
- }
4212
- }
4213
- if ($row->mail) {
4214
- if ($send != TRUE) {
4215
- $_SESSION['error_or_no' . $id] = 1;
4216
- $msg = addslashes(__('Error, email was not sent.', 'form_maker'));
4217
- }
4218
- else {
4219
- $_SESSION['error_or_no' . $id] = 0;
4220
- $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
4221
- }
4222
- }
4223
- else {
4224
- $_SESSION['error_or_no' . $id] = 0;
4225
- $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
4226
- }
4227
- }
4228
-
4229
- // delete files from uploads (save_upload = 0)
4230
- if($row->save_uploads == 0){
4231
- foreach ($all_files as &$all_file) {
4232
- if (file_exists(ABSPATH.'/'.$all_file['tmp_name'])) {
4233
- unlink(ABSPATH.'/'.$all_file['tmp_name']);
4234
- }
4235
- }
4236
-
4237
- }
4238
- $https = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
4239
- switch ($row->submit_text_type) {
4240
- case "2":
4241
- case "5": {
4242
- if ($row->submit_text_type != 4) {
4243
- $_SESSION['massage_after_submit' . $id] = $msg;
4244
- }
4245
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4246
- if ($row->article_id) {
4247
- $redirect_url = $row->article_id;
4248
- }
4249
- else {
4250
- $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
4251
- }
4252
- break;
4253
- }
4254
- case "3": {
4255
- if ($row->submit_text_type != 4) {
4256
- $_SESSION['massage_after_submit' . $id] = $msg;
4257
- }
4258
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4259
- $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
4260
- break;
4261
- }
4262
- case "4": {
4263
- if ($row->submit_text_type != 4) {
4264
- $_SESSION['massage_after_submit' . $id] = $msg;
4265
- }
4266
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4267
- $redirect_url = $row->url;
4268
- break;
4269
- }
4270
- default: {
4271
- if ($row->submit_text_type != 4) {
4272
- $_SESSION['massage_after_submit' . $id] = $msg;
4273
- }
4274
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4275
- $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
4276
- break;
4277
- }
4278
- }
4279
- if (!$str) {
4280
- wp_redirect($redirect_url);
4281
- exit;
4282
- }
4283
- else {
4284
- $_SESSION['redirect_paypal'.$id] = 1;
4285
-
4286
- $str .= "&return=" . urlencode($redirect_url);
4287
- wp_redirect($str);
4288
- exit;
4289
- }
4290
- }
4291
-
4292
- public static function custom_fields_mail($type, $key, $id, $attachment, $form_currency)
4293
- {
4294
- $new_value ="";
4295
-
4296
- $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
4297
- $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
4298
-
4299
- if($type!="type_submit_reset" or $type!="type_map" or $type!="type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
4300
- switch ($type) {
4301
- case 'type_text':
4302
- case 'type_password':
4303
- case 'type_textarea':
4304
- case "type_date":
4305
- case "type_own_select":
4306
- case "type_country":
4307
- case "type_number": {
4308
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4309
- if(isset($element)) {
4310
- $new_value = $element;
4311
- }
4312
- break;
4313
- }
4314
- case "type_file_upload": {
4315
- if($attachment)
4316
- foreach($attachment as $attachment_temp)
4317
- {
4318
- $uploadedFileNameParts = explode('.',$attachment_temp[1]);
4319
- $uploadedFileExtension = array_pop($uploadedFileNameParts);
4320
-
4321
- $invalidFileExts = array('gif', 'jpg', 'jpeg', 'png', 'swf', 'psd', 'bmp', 'tiff', 'jpc', 'jp2', 'jpf', 'jb2', 'swc', 'aiff', 'wbmp', 'xbm' );
4322
- $extOk = false;
4323
-
4324
- foreach($invalidFileExts as $key => $valuee)
4325
- {
4326
- if(is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension) )) )
4327
- $extOk = true;
4328
- }
4329
-
4330
- if ($extOk == true)
4331
- $new_value .= '<img src="'.site_url().'/'.$attachment_temp.'" alt="'.$attachment_temp[1].'"/>';
4332
-
4333
- }
4334
- break;
4335
- }
4336
- case "type_hidden": {
4337
- $element = isset($_POST[$element_label]) ? $_POST[$element_label] : NULL;
4338
- if(isset($element)) {
4339
- $new_value = $element;
4340
- }
4341
- break;
4342
- }
4343
- case "type_mark_map": {
4344
- $element = isset($_POST['wdform_'.$key."_long".$id]) ? $_POST['wdform_'.$key."_long".$id] : NULL;
4345
- if(isset($element)) {
4346
- $new_value = 'Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$key."_lat".$id]) ? $_POST['wdform_'.$key."_lat".$id] : "");
4347
- }
4348
- break;
4349
- }
4350
- case "type_submitter_mail": {
4351
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4352
- if(isset($element)) {
4353
- $new_value = $element;
4354
- }
4355
- break;
4356
- }
4357
- case "type_time": {
4358
- $hh = isset($_POST['wdform_'.$key."_hh".$id]) ? $_POST['wdform_'.$key."_hh".$id] : NULL;
4359
- if(isset($hh)) {
4360
- $ss = isset($_POST['wdform_'.$key."_ss".$id]) ? $_POST['wdform_'.$key."_ss".$id] : NULL;
4361
- if(isset($ss)) {
4362
- $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "") . ':' . $ss;
4363
- }
4364
- else {
4365
- $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "");
4366
- }
4367
- $am_pm = isset($_POST['wdform_'.$key."_am_pm".$id]) ? $_POST['wdform_'.$key."_am_pm".$id] : NULL;
4368
- if(isset($am_pm)) {
4369
- $new_value = $new_value . ' ' . $am_pm;
4370
- }
4371
- }
4372
- break;
4373
- }
4374
-
4375
- case "type_phone": {
4376
- $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
4377
- if(isset($element_first)) {
4378
- $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
4379
- }
4380
- break;
4381
- }
4382
- case "type_name": {
4383
- $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
4384
- if(isset($element_first)) {
4385
- $element_title = isset($_POST['wdform_'.$key."_element_title".$id]) ? $_POST['wdform_'.$key."_element_title".$id] : NULL;
4386
- if(isset($element_title)) {
4387
- $new_value = $element_title . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$key."_element_middle".$id]) ? $_POST['wdform_'.$key."_element_middle".$id] : "");
4388
- }
4389
- else {
4390
- $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
4391
- }
4392
- }
4393
- break;
4394
- }
4395
- case "type_address": {
4396
- $street1 = isset($_POST['wdform_'.$key."_street1".$id]) ? $_POST['wdform_'.$key."_street1".$id] : NULL;
4397
- if(isset($street1)) {
4398
- $new_value = $street1;
4399
- break;
4400
- }
4401
- $street2 = isset($_POST['wdform_'.$key."_street2".$id]) ? $_POST['wdform_'.$key."_street2".$id] : NULL;
4402
- if(isset($street2)) {
4403
- $new_value = $street2;
4404
- break;
4405
- }
4406
- $city = isset($_POST['wdform_'.$key."_city".$id]) ? $_POST['wdform_'.$key."_city".$id] : NULL;
4407
- if(isset($city)) {
4408
- $new_value = $city;
4409
- break;
4410
- }
4411
- $state = isset($_POST['wdform_'.$key."_state".$id]) ? $_POST['wdform_'.$key."_state".$id] : NULL;
4412
- if(isset($state)) {
4413
- $new_value = $state;
4414
- break;
4415
- }
4416
- $postal = isset($_POST['wdform_'.$key."_postal".$id]) ? $_POST['wdform_'.$key."_postal".$id] : NULL;
4417
- if(isset($postal)) {
4418
- $new_value = $postal;
4419
- break;
4420
- }
4421
- $country = isset($_POST['wdform_'.$key."_country".$id]) ? $_POST['wdform_'.$key."_country".$id] : NULL;
4422
- if(isset($country)) {
4423
- $new_value = $country;
4424
- break;
4425
- }
4426
- break;
4427
- }
4428
- case "type_date_fields": {
4429
- $day = isset($_POST['wdform_'.$key."_day".$id]) ? $_POST['wdform_'.$key."_day".$id] : NULL;
4430
- if(isset($day)) {
4431
- $new_value = $day . '-' . (isset($_POST['wdform_'.$key."_month".$id]) ? $_POST['wdform_'.$key."_month".$id] : "") . '-' . (isset($_POST['wdform_'.$key."_year".$id]) ? $_POST['wdform_'.$key."_year".$id] : "");
4432
- }
4433
- break;
4434
- }
4435
-
4436
- case "type_radio": {
4437
- $element = isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : NULL;
4438
- if(isset($element)) {
4439
- $new_value = $element;
4440
- break;
4441
- }
4442
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4443
- if(isset($element)) {
4444
- $new_value = $element;
4445
- }
4446
- break;
4447
- }
4448
- case "type_checkbox": {
4449
- $start = -1;
4450
- for($j = 0; $j < 100; $j++) {
4451
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4452
- if(isset($element)) {
4453
- $start = $j;
4454
- break;
4455
- }
4456
- }
4457
- $other_element_id = -1;
4458
- $is_other = isset($_POST['wdform_'.$key."_allow_other".$id]) ? $_POST['wdform_'.$key."_allow_other".$id] : "";
4459
- if($is_other == "yes") {
4460
- $other_element_id = isset($_POST['wdform_'.$key."_allow_other_num".$id]) ? $_POST['wdform_'.$key."_allow_other_num".$id] : "";
4461
- }
4462
- if($start != -1) {
4463
- for($j = $start; $j < 100; $j++) {
4464
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4465
- if(isset($element)) {
4466
- if($j == $other_element_id) {
4467
- $new_value = $new_value . (isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : "") . '<br>';
4468
- }
4469
- else {
4470
- $new_value = $new_value . $element . '<br>';
4471
- }
4472
- }
4473
- }
4474
- }
4475
- break;
4476
- }
4477
- case "type_paypal_price": {
4478
- $new_value = 0;
4479
- if(isset($_POST['wdform_'.$key."_element_dollars".$id])) {
4480
- $new_value = $_POST['wdform_'.$key."_element_dollars".$id];
4481
- }
4482
- if(isset($_POST['wdform_'.$key."_element_cents".$id])) {
4483
- $new_value = $new_value . '.' . $_POST['wdform_'.$key."_element_cents".$id];
4484
- }
4485
- $new_value = $new_value . $form_currency;
4486
- break;
4487
- }
4488
- case "type_paypal_select": {
4489
- $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ':' . (isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : "") . $form_currency;
4490
- $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
4491
- $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
4492
- if (isset($element_quantity)) {
4493
- $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
4494
- }
4495
- for($k = 0; $k < 50; $k++) {
4496
- $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
4497
- if(isset($temp_val)) {
4498
- $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
4499
- }
4500
- }
4501
- break;
4502
- }
4503
- case "type_paypal_radio": {
4504
- $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ' - ' . (isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : "") . $form_currency;
4505
- $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
4506
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
4507
- if (isset($element_quantity)) {
4508
- $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
4509
- }
4510
- for($k = 0; $k < 50; $k++) {
4511
- $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
4512
- if(isset($temp_val)) {
4513
- $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
4514
- }
4515
- }
4516
- break;
4517
- }
4518
- case "type_paypal_shipping": {
4519
- $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ' : ' . (isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : "") . $form_currency;
4520
- break;
4521
- }
4522
- case "type_paypal_checkbox": {
4523
- $start = -1;
4524
- for($j = 0; $j < 100; $j++) {
4525
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4526
- if(isset($element)) {
4527
- $start = $j;
4528
- break;
4529
- }
4530
- }
4531
- if($start != -1) {
4532
- for($j = $start; $j < 100; $j++) {
4533
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4534
- if(isset($element)) {
4535
- $new_value = $new_value . (isset($_POST['wdform_'.$key."_element".$id.$j."_label"]) ? $_POST['wdform_'.$key."_element".$id.$j."_label"] : "") . ' - ' . ($element == '' ? '0' . $form_currency : $element) . $form_currency . '<br>';
4536
- }
4537
- }
4538
- }
4539
- $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
4540
- $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
4541
- if (isset($element_quantity)) {
4542
- $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
4543
- }
4544
- for($k = 0; $k < 50; $k++) {
4545
- $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
4546
- if(isset($temp_val)) {
4547
- $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
4548
- }
4549
- }
4550
- break;
4551
- }
4552
- case "type_paypal_total": {
4553
- $element = isset($_POST['wdform_'.$key."_paypal_total".$id]) ? $_POST['wdform_'.$key."_paypal_total".$id] : "";
4554
- $new_value = $new_value . $element;
4555
- break;
4556
- }
4557
- case "type_star_rating": {
4558
- $element = isset($_POST['wdform_'.$key."_star_amount".$id]) ? $_POST['wdform_'.$key."_star_amount".$id] : NULL;
4559
- $selected = isset($_POST['wdform_'.$key."_selected_star_amount".$id]) ? $_POST['wdform_'.$key."_selected_star_amount".$id] : 0;
4560
- if(isset($element)) {
4561
- $new_value = $new_value . $selected . '/' . $element;
4562
- }
4563
- break;
4564
- }
4565
- case "type_scale_rating": {
4566
- $element = isset($_POST['wdform_'.$key."_scale_amount".$id]) ? $_POST['wdform_'.$key."_scale_amount".$id] : NULL;
4567
- $selected = isset($_POST['wdform_'.$key."_scale_radio".$id]) ? $_POST['wdform_'.$key."_scale_radio".$id] : 0;
4568
- if(isset($element)) {
4569
- $new_value = $new_value . $selected . '/' . $element;
4570
- }
4571
- break;
4572
- }
4573
- case "type_spinner": {
4574
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4575
- if(isset($element)) {
4576
- $new_value = $new_value . $element;
4577
- }
4578
- break;
4579
- }
4580
- case "type_slider": {
4581
- $element = isset($_POST['wdform_'.$key."_slider_value".$id]) ? $_POST['wdform_'.$key."_slider_value".$id] : NULL;
4582
- if(isset($element)) {
4583
- $new_value = $new_value . $element;
4584
- }
4585
- break;
4586
- }
4587
- case "type_range": {
4588
- $element0 = isset($_POST['wdform_'.$key."_element".$id.'0']) ? $_POST['wdform_'.$key."_element".$id.'0'] : NULL;
4589
- $element1 = isset($_POST['wdform_'.$key."_element".$id.'1']) ? $_POST['wdform_'.$key."_element".$id.'1'] : NULL;
4590
- if(isset($element0) || isset($element1)) {
4591
- $new_value = $new_value . $element0 . '-' . $element1;
4592
- }
4593
- break;
4594
- }
4595
- case "type_grading": {
4596
- $element = isset($_POST['wdform_'.$key."_hidden_item".$id]) ? $_POST['wdform_'.$key."_hidden_item".$id] : "";
4597
- $grading = explode(":", $element);
4598
- $items_count = sizeof($grading) - 1;
4599
- $element = "";
4600
- $total = "";
4601
- for($k = 0;$k < $items_count; $k++) {
4602
- $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : "") . " ";
4603
- $total += (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : 0);
4604
- }
4605
- $element .="Total:" . $total;
4606
- if(isset($element)) {
4607
- $new_value = $new_value . $element;
4608
- }
4609
- break;
4610
- }
4611
- case "type_matrix": {
4612
- $input_type = isset($_POST['wdform_'.$key."_input_type".$id]) ? $_POST['wdform_'.$key."_input_type".$id] : "";
4613
- $mat_rows = explode("***", isset($_POST['wdform_'.$key."_hidden_row".$id]) ? $_POST['wdform_'.$key."_hidden_row".$id] : "");
4614
- $rows_count = sizeof($mat_rows) - 1;
4615
- $mat_columns = explode("***", isset($_POST['wdform_'.$key."_hidden_column".$id]) ? $_POST['wdform_'.$key."_hidden_column".$id] : "");
4616
- $columns_count = sizeof($mat_columns) - 1;
4617
- $matrix="<table>";
4618
- $matrix .='<tr><td></td>';
4619
- for( $k=1;$k< count($mat_columns) ;$k++) {
4620
- $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
4621
- }
4622
- $matrix .= '</tr>';
4623
- $aaa=Array();
4624
- for($k=1; $k<=$rows_count; $k++) {
4625
- $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
4626
- if($input_type=="radio") {
4627
- $mat_radio = isset($_POST['wdform_'.$key."_input_element".$id.$k]) ? $_POST['wdform_'.$key."_input_element".$id.$k] : 0;
4628
- if($mat_radio == 0) {
4629
- $checked = "";
4630
- $aaa[1] = "";
4631
- }
4632
- else {
4633
- $aaa = explode("_", $mat_radio);
4634
- }
4635
-
4636
- for($j = 1; $j <= $columns_count; $j++) {
4637
- if($aaa[1]==$j) {
4638
- $checked="checked";
4639
- }
4640
- else {
4641
- $checked="";
4642
- }
4643
- $matrix .= '<td style="text-align:center"><input type="radio" ' . $checked . ' disabled /></td>';
4644
- }
4645
- }
4646
- else {
4647
- if($input_type == "checkbox") {
4648
- for($j = 1; $j <= $columns_count; $j++) {
4649
- $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j] : 0;
4650
- if($checked==1) {
4651
- $checked = "checked";
4652
- }
4653
- else {
4654
- $checked = "";
4655
- }
4656
- $matrix .= '<td style="text-align:center"><input type="checkbox" ' . $checked . ' disabled /></td>';
4657
- }
4658
- }
4659
- else {
4660
- if($input_type == "text") {
4661
- for($j = 1; $j <= $columns_count; $j++) {
4662
- $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j] : "";
4663
- $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
4664
- }
4665
- }
4666
- else {
4667
- for($j = 1; $j <= $columns_count; $j++) {
4668
- $checked = isset($_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j] : "";
4669
- $matrix .= '<td style="text-align:center">' . $checked . '</td>';
4670
- }
4671
- }
4672
- }
4673
- }
4674
- $matrix .= '</tr>';
4675
- }
4676
- $matrix .= '</table>';
4677
- if(isset($matrix)) {
4678
- $new_value = $new_value . $matrix;
4679
- }
4680
- break;
4681
- }
4682
- default: break;
4683
- }
4684
- // $new_script = str_replace("%" . $label_each . "%", $new_value, $new_script);
4685
- }
4686
-
4687
- return $new_value;
4688
- }
4689
-
4690
- public function empty_field($element, $mail_emptyfields) {
4691
- if(!$mail_emptyfields)
4692
- if(empty($element))
4693
- return 0;
4694
-
4695
- return 1;
4696
- }
4697
- ////////////////////////////////////////////////////////////////////////////////////////
4698
- // Getters & Setters //
4699
- ////////////////////////////////////////////////////////////////////////////////////////
4700
- ////////////////////////////////////////////////////////////////////////////////////////
4701
- // Private Methods //
4702
- ////////////////////////////////////////////////////////////////////////////////////////
4703
- ////////////////////////////////////////////////////////////////////////////////////////
4704
- // Listeners //
4705
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
4706
  }
1
+ <?php
2
+
3
+ class FMModelForm_maker_fmc {
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 showform($id) {
22
+ global $wpdb;
23
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
24
+ if (!$row || !$row->published) {
25
+ return FALSE;
26
+ }
27
+ if (isset($_GET['test_theme']) && (esc_html(stripslashes($_GET['test_theme'])) != '')) {
28
+ /* From preview.*/
29
+ $theme_id = esc_html(stripslashes($_GET['test_theme']));
30
+ }
31
+ else {
32
+ $theme_id = $row->theme;
33
+ }
34
+ $form_theme = $wpdb->get_var($wpdb->prepare('SELECT css FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
35
+ if (!$form_theme) {
36
+ $form_theme = $wpdb->get_var('SELECT css FROM ' . $wpdb->prefix . 'formmaker_themes');
37
+ if (!$form_theme) {
38
+ return FALSE;
39
+ }
40
+ }
41
+ $label_id = array();
42
+ $label_type = array();
43
+ $label_all = explode('#****#', $row->label_order);
44
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
45
+ foreach ($label_all as $key => $label_each) {
46
+ $label_id_each = explode('#**id**#', $label_each);
47
+ array_push($label_id, $label_id_each[0]);
48
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
49
+ array_push($label_type, $label_order_each[1]);
50
+ }
51
+ return array(
52
+ $row,
53
+ 1,
54
+ $label_id,
55
+ $label_type,
56
+ $form_theme
57
+ );
58
+ }
59
+
60
+ public function savedata($form, $id) {
61
+ $fmc_settings = get_option('fmc_settings');
62
+ $all_files = array();
63
+ $correct = FALSE;
64
+ $id_for_old = $id;
65
+ if (!$form->form_front) {
66
+ $id = '';
67
+ }
68
+ if (isset($_POST["counter" . $id])) {
69
+ $counter = esc_html($_POST["counter" . $id]);
70
+ if (isset($_POST["captcha_input"])) {
71
+ $captcha_input = esc_html($_POST["captcha_input"]);
72
+ $session_wd_captcha_code = isset($_SESSION[$id . '_wd_captcha_code']) ? $_SESSION[$id . '_wd_captcha_code'] : '-';
73
+ if (md5($captcha_input) == $session_wd_captcha_code) {
74
+ $correct = TRUE;
75
+ }
76
+ else {
77
+ ?>
78
+ <script>alert("<?php echo addslashes(__('Error, incorrect Security code.', 'form_maker')); ?>");</script>
79
+ <?php
80
+ }
81
+ }
82
+ elseif (isset($_POST["arithmetic_captcha_input"])) {
83
+ $arithmetic_captcha_input = esc_html($_POST["arithmetic_captcha_input"]);
84
+ $session_wd_arithmetic_captcha_code = isset($_SESSION[$id . '_wd_arithmetic_captcha_code']) ? $_SESSION[$id . '_wd_arithmetic_captcha_code'] : '-';
85
+ if (md5($arithmetic_captcha_input) == $session_wd_arithmetic_captcha_code) {
86
+ $correct = TRUE;
87
+ }
88
+ else {
89
+ ?>
90
+ <script>alert("<?php echo addslashes(__('Error, incorrect Security code.', 'form_maker')); ?>");</script>
91
+ <?php
92
+ }
93
+ }
94
+ elseif (isset($_POST["g-recaptcha-response"])){
95
+ $privatekey= isset($fmc_settings['private_key']) ? $fmc_settings['private_key'] : '';
96
+ $captcha = $_POST['g-recaptcha-response'];
97
+ $url = 'https://www.google.com/recaptcha/api/siteverify';
98
+ $data = array(
99
+ 'secret' => $privatekey,
100
+ 'response' => $captcha,
101
+ 'remoteip' => $_SERVER['REMOTE_ADDR']
102
+ );
103
+
104
+ $curlConfig = array(
105
+ CURLOPT_URL => $url,
106
+ CURLOPT_POST => true,
107
+ CURLOPT_RETURNTRANSFER => true,
108
+ CURLOPT_POSTFIELDS => $data
109
+ );
110
+
111
+ $ch = curl_init();
112
+ curl_setopt_array($ch, $curlConfig);
113
+ $response = curl_exec($ch);
114
+ curl_close($ch);
115
+
116
+ $jsonResponse = json_decode($response);
117
+
118
+ if ($jsonResponse->success == "true")
119
+ $correct = TRUE;
120
+ else {
121
+ ?>
122
+ <script>alert("<?php echo addslashes(__('Error, incorrect Security code.', 'form_maker')); ?>");</script>
123
+ <?php
124
+ }
125
+ }
126
+ else {
127
+ $correct = TRUE;
128
+ }
129
+ if ($correct) {
130
+
131
+ $ip=$_SERVER['REMOTE_ADDR'];
132
+
133
+ global $wpdb;
134
+ $blocked_ip = $wpdb->get_var($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $ip));
135
+ if ($blocked_ip) {
136
+ $_SESSION['massage_after_submit' . $id] = addslashes(__('Your ip is blacklisted. Please contact the website administrator.', 'form_maker'));
137
+ wp_redirect($_SERVER["REQUEST_URI"]);//to be checked
138
+ exit;
139
+ }
140
+
141
+ $result_temp = $this->save_db($counter, $id_for_old);
142
+ $all_files = $result_temp[0];
143
+ if (is_numeric($all_files)) {
144
+ $this->remove($all_files, $id_for_old);
145
+ }
146
+ elseif (isset($counter)) {
147
+ $this->gen_mail($counter, $all_files, $id_for_old, $result_temp[1]);
148
+ }
149
+
150
+ }
151
+ return $all_files;
152
+ }
153
+
154
+ return $all_files;
155
+ }
156
+
157
+ public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
158
+ global $wpdb;
159
+
160
+ $query = "SELECT `".$label_column."` FROM ".$table.$where." ORDER BY ".$order_by;
161
+ if($db_info)
162
+ {
163
+
164
+ $temp = explode('@@@wdfhostwdf@@@',$db_info);
165
+ $host = $temp[0];
166
+ $temp = explode('@@@wdfportwdf@@@',$temp[1]);
167
+ $port = $temp[0];
168
+ $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
169
+ $username = $temp[0];
170
+ $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
171
+ $password = $temp[0];
172
+ $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
173
+ $database = $temp[0];
174
+
175
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
176
+ $choices_labels = $wpdb_temp->get_results($query,ARRAY_N);
177
+ }
178
+ else{
179
+ $choices_labels = $wpdb->get_results($query,ARRAY_N);
180
+ }
181
+ return $choices_labels;
182
+ }
183
+
184
+ public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
185
+ global $wpdb;
186
+
187
+ $query = "SELECT `".$value_column."` FROM ".$table.$where." ORDER BY ".$order_by;
188
+ if($db_info)
189
+ {
190
+ $temp = explode('@@@wdfhostwdf@@@',$db_info);
191
+ $host = $temp[0];
192
+ $temp = explode('@@@wdfportwdf@@@',$temp[1]);
193
+ $port = $temp[0];
194
+ $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
195
+ $username = $temp[0];
196
+ $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
197
+ $password = $temp[0];
198
+ $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
199
+ $database = $temp[0];
200
+
201
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
202
+ $choices_values = $wpdb_temp->get_results($query,ARRAY_N);
203
+ }
204
+ else{
205
+ $choices_values = $wpdb->get_results($query,ARRAY_N);
206
+ }
207
+ return $choices_values;
208
+ }
209
+
210
+ public function save_db($counter, $id) {
211
+ global $wpdb;
212
+ $current_user = wp_get_current_user();
213
+ if ($current_user->ID != 0)
214
+ {
215
+ $wp_userid = $current_user->ID;
216
+ $wp_username = $current_user->display_name;
217
+ $wp_useremail = $current_user->user_email;
218
+ }
219
+ else
220
+ {
221
+ $wp_userid = '';
222
+ $wp_username = '';
223
+ $wp_useremail = '';
224
+ }
225
+ $ip = $_SERVER['REMOTE_ADDR'];
226
+
227
+ $chgnac = TRUE;
228
+ $all_files = array();
229
+ $paypal = array();
230
+ $paypal['item_name'] = array();
231
+ $paypal['quantity'] = array();
232
+ $paypal['amount'] = array();
233
+ $is_amount=false;
234
+ $paypal['on_os'] = array();
235
+ $total = 0;
236
+ $form_currency = '$';
237
+ $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
238
+ $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
239
+ $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id= %d", $id));
240
+ $id_old = $id;
241
+ if (!$form->form_front) {
242
+ $id = '';
243
+ }
244
+ if ($form->payment_currency) {
245
+ $form_currency = $currency_sign[array_search($form->payment_currency, $currency_code)];
246
+ }
247
+ $old = false;
248
+ if(isset($form->form)) {
249
+ $old = true;
250
+ }
251
+ $label_id = array();
252
+ $label_label = array();
253
+ $label_type = array();
254
+
255
+ $disabled_fields = explode(',', (isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : ""));
256
+ $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
257
+
258
+ if($old == false || ($old == true && $form->form=='')) {
259
+ $label_all = explode('#****#',$form->label_order_current);
260
+ }
261
+ else {
262
+ $label_all = explode('#****#',$form->label_order);
263
+ }
264
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
265
+ foreach ($label_all as $key => $label_each) {
266
+ $label_id_each = explode('#**id**#', $label_each);
267
+ array_push($label_id, $label_id_each[0]);
268
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
269
+ array_push($label_label, $label_order_each[0]);
270
+ array_push($label_type, $label_order_each[1]);
271
+ }
272
+ $max = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
273
+ $fvals=array();
274
+ if ($old == FALSE || ($old == TRUE && $form->form == '')) {
275
+ foreach ($label_type as $key => $type) {
276
+ $value = '';
277
+ if ($type == "type_submit_reset" or $type == "type_map" or $type == "type_editor" or $type == "type_captcha" or $type == "type_arithmetic_captcha" or $type == "type_recaptcha" or $type == "type_button" or $type == "type_paypal_total" or $type == "type_send_copy")
278
+ continue;
279
+
280
+ $i = $label_id[$key];
281
+ if(!in_array($i,$disabled_fields)) {
282
+ switch ($type) {
283
+ case 'type_text':
284
+ case 'type_password':
285
+ case 'type_textarea':
286
+ case "type_submitter_mail":
287
+ case "type_date":
288
+ case "type_own_select":
289
+ case "type_country":
290
+ case "type_number": {
291
+ $value = isset($_POST['wdform_'.$i."_element".$id]) ? esc_html($_POST['wdform_'.$i."_element".$id]) : "";
292
+ break;
293
+ }
294
+ case "type_wdeditor": {
295
+ $value = isset($_POST['wdform_'.$i.'_wd_editor'.$id]) ? esc_html($_POST['wdform_'.$i.'_wd_editor'.$id]) : "";
296
+ break;
297
+ }
298
+ case "type_mark_map": {
299
+ $value = (isset($_POST['wdform_'.$i."_long".$id]) ? $_POST['wdform_'.$i."_long".$id] : "") . '***map***' . (isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "");
300
+ break;
301
+ }
302
+ case "type_date_fields": {
303
+ $value = (isset($_POST['wdform_'.$i."_day".$id]) ? $_POST['wdform_'.$i."_day".$id] : "") . '-' . (isset($_POST['wdform_'.$i."_month".$id]) ? $_POST['wdform_'.$i."_month".$id] : "") . '-' . (isset($_POST['wdform_'.$i."_year".$id]) ? $_POST['wdform_'.$i."_year".$id] : "");
304
+ break;
305
+ }
306
+ case "type_time": {
307
+ $ss = isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : NULL;
308
+ if(isset($ss)) {
309
+ $value = (isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : "") . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "") . ':' . (isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : "");
310
+ }
311
+ else {
312
+ $value = (isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : "") . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
313
+ }
314
+ $am_pm = isset($_POST['wdform_'.$i."_am_pm".$id]) ? $_POST['wdform_'.$i."_am_pm".$id] : NULL;
315
+ if(isset($am_pm)) {
316
+ $value = $value . ' ' . $am_pm;
317
+ }
318
+ break;
319
+ }
320
+ case "type_phone": {
321
+ $value = (isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : "") . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "");
322
+ break;
323
+ }
324
+ case "type_name": {
325
+ $element_title = isset($_POST['wdform_'.$i."_element_title".$id]) ? esc_html($_POST['wdform_'.$i."_element_title".$id]) : NULL;
326
+ $element_middle = isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : NULL;
327
+ if(isset($element_title) || isset($element_middle)) {
328
+ $value = (isset($_POST['wdform_'.$i."_element_title".$id]) ? esc_html($_POST['wdform_'.$i."_element_title".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_first".$id]) ? esc_html($_POST['wdform_'.$i."_element_first".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? esc_html($_POST['wdform_'.$i."_element_last".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : "");
329
+ }
330
+ else {
331
+ $value = (isset($_POST['wdform_'.$i."_element_first".$id]) ? esc_html($_POST['wdform_'.$i."_element_first".$id]) : "") . '@@@' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? esc_html($_POST['wdform_'.$i."_element_last".$id]) : "");
332
+ }
333
+ break;
334
+ }
335
+ case "type_file_upload": {
336
+ $files = isset($_FILES['wdform_'.$i.'_file'.$id]) ? $_FILES['wdform_'.$i.'_file'.$id] : NULL;
337
+ foreach($files['name'] as $file_key => $file_name) {
338
+ if($file_name) {
339
+ $untilupload = $form->form_fields;
340
+ $untilupload = substr($untilupload, strpos($untilupload,$i.'*:*id*:*type_file_upload'), -1);
341
+ $untilupload = substr($untilupload, 0, strpos($untilupload,'*:*new_field*:'));
342
+ $untilupload = explode('*:*w_field_label_pos*:*',$untilupload);
343
+ $untilupload = $untilupload[1];
344
+ $untilupload = explode('*:*w_destination*:*',$untilupload);
345
+ $destination = $untilupload[0];
346
+ $destination = str_replace(site_url() . '/', '', $destination);
347
+ $untilupload = $untilupload[1];
348
+ $untilupload = explode('*:*w_extension*:*',$untilupload);
349
+ $extension = $untilupload[0];
350
+ $untilupload = $untilupload[1];
351
+ $untilupload = explode('*:*w_max_size*:*',$untilupload);
352
+ $max_size = $untilupload[0];
353
+ $untilupload = $untilupload[1];
354
+ $fileName = $files['name'][$file_key];
355
+ $fileSize = $files['size'][$file_key];
356
+
357
+ if($fileSize > $max_size * 1024) {
358
+ echo "<script> alert('" . addslashes(__('The file exceeds the allowed size of', 'form_maker')) . $max_size . " KB');</script>";
359
+ return array($max+1);
360
+ }
361
+
362
+ $uploadedFileNameParts = explode('.',$fileName);
363
+ $uploadedFileExtension = array_pop($uploadedFileNameParts);
364
+ $to = strlen($fileName) - strlen($uploadedFileExtension) - 1;
365
+
366
+ $fileNameFree = substr($fileName, 0, $to);
367
+ $invalidFileExts = explode(',', $extension);
368
+ $extOk = false;
369
+
370
+ foreach($invalidFileExts as $key => $valuee) {
371
+ if(is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension)))) {
372
+ $extOk = true;
373
+ }
374
+ }
375
+
376
+ if ($extOk == false) {
377
+ echo "<script> alert('" . addslashes(__('Sorry, you are not allowed to upload this type of file.', 'form_maker')) . "');</script>";
378
+ return array($max+1);
379
+ }
380
+
381
+ $fileTemp = $files['tmp_name'][$file_key];
382
+ $p = 1;
383
+
384
+ if(!file_exists($destination))
385
+ mkdir($destination , 0777);
386
+ if (file_exists($destination . "/" . $fileName)) {
387
+ $fileName1 = $fileName;
388
+ while (file_exists($destination . "/" . $fileName1)) {
389
+ $to = strlen($file_name) - strlen($uploadedFileExtension) - 1;
390
+ $fileName1 = substr($fileName, 0, $to) . '(' . $p . ').' . $uploadedFileExtension;
391
+ // $file['name'] = $fileName;
392
+ $p++;
393
+ }
394
+ $fileName = $fileName1;
395
+ }
396
+
397
+ // for dropbox & google drive integration addons
398
+ $check_both = 0;
399
+ if($form->save_uploads == 0){
400
+ if(defined('WD_FM_DBOX_INT') && is_plugin_active(constant('WD_FM_DBOX_INT'))){
401
+ $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix ."formmaker_dbox_int WHERE form_id=" . $form->id);
402
+ if($enable == 1){
403
+ $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix ."formmaker_dbox_int WHERE form_id=" . $form->id);
404
+
405
+ if((int)$selectable_upload == 1){
406
+ $temp_dir_dbox = explode('\\', $fileTemp);
407
+ $temp_dir_dbox = implode('%%', $temp_dir_dbox);
408
+
409
+ $value.= $temp_dir_dbox . '*@@url@@*' . $fileName;
410
+ }
411
+ else{
412
+ $dlink_dbox = '<a href="'.add_query_arg(array('action' => 'WD_FM_DBOX_INT', 'addon_task' => 'upload_dbox_file', 'id' => $form->id), admin_url('admin-ajax.php')).'&dbox_file_name=' . $fileName . '&dbox_folder_name=/'.$form->title.'" >' . $fileName . '</a>';
413
+
414
+ $value.= $dlink_dbox;
415
+ }
416
+
417
+ $files['tmp_name'][$file_key]=$fileTemp;
418
+ $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
419
+ }
420
+ else
421
+ $check_both ++;
422
+
423
+ }
424
+ else
425
+ $check_both ++;
426
+ if(defined('WD_FM_GDRIVE_INT') && is_plugin_active(constant('WD_FM_GDRIVE_INT'))){
427
+ $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix ."formmaker_gdrive_int WHERE form_id=" . $form->id);
428
+ if($enable == 1){
429
+ $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix ."formmaker_gdrive_int WHERE form_id=" . $form->id);
430
+
431
+ if((int)$selectable_upload == 1){
432
+ $temp_dir_dbox = explode('\\', $fileTemp);
433
+ $temp_dir_dbox = implode('%%', $temp_dir_dbox);
434
+ $value.= 'wdCloudAddon' . $temp_dir_dbox . '*@@url@@*' . $fileName . '*@@url@@*' . $files['type'][$file_key];
435
+ }
436
+ else{
437
+ $dlink_dbox = '<a target="_blank" href="'.add_query_arg(array('action' => 'WD_FM_GDRIVE_INT', 'addon_task' => 'create_drive_link', 'id' => $form->id), admin_url('admin-ajax.php')).'&gdrive_file_name=' . $fileName . '&gdrive_folder_name='.$form->title.'" >' . $fileName . '</a>';
438
+ $value.= $dlink_dbox;
439
+ }
440
+
441
+ $files['tmp_name'][$file_key]=$fileTemp;
442
+ $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
443
+ }
444
+ else
445
+ $check_both ++;
446
+
447
+ }
448
+ else
449
+ $check_both ++;
450
+
451
+ }
452
+ //
453
+ if($check_both != 0){
454
+ $value.= '';
455
+ $files['tmp_name'][$file_key]=$fileTemp;
456
+ $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
457
+ }
458
+ // dropbox and google drive integration addons
459
+ if($form->save_uploads == 1){
460
+ if(!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
461
+ echo "<script> alert('" . addslashes(__('Error, file cannot be moved.', 'form_maker')) . "');</script>";
462
+ return array($max+1);
463
+ }
464
+ $value.= site_url() . '/' . $destination . '/' . $fileName . '*@@url@@*';
465
+ $files['tmp_name'][$file_key]=$destination . "/" . $fileName;
466
+ $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
467
+
468
+ }
469
+ array_push($all_files,$temp_file);
470
+ }
471
+ }
472
+ break;
473
+ }
474
+
475
+ case 'type_address': {
476
+ $value = '*#*#*#';
477
+ $element = isset($_POST['wdform_'.$i."_street1".$id]) ? esc_html($_POST['wdform_'.$i."_street1".$id]) : NULL;
478
+ if(isset($element)) {
479
+ $value = $element;
480
+ break;
481
+ }
482
+
483
+ $element = isset($_POST['wdform_'.$i."_street2".$id]) ? esc_html($_POST['wdform_'.$i."_street2".$id]) : NULL;
484
+ if(isset($element)) {
485
+ $value = $element;
486
+ break;
487
+ }
488
+
489
+ $element = isset($_POST['wdform_'.$i."_city".$id]) ? esc_html($_POST['wdform_'.$i."_city".$id]) : NULL;
490
+ if(isset($element)) {
491
+ $value = $element;
492
+ break;
493
+ }
494
+
495
+ $element = isset($_POST['wdform_'.$i."_state".$id]) ? esc_html($_POST['wdform_'.$i."_state".$id]) : NULL;
496
+ if(isset($element)) {
497
+ $value = $element;
498
+ break;
499
+ }
500
+
501
+ $element = isset($_POST['wdform_'.$i."_postal".$id]) ? esc_html($_POST['wdform_'.$i."_postal".$id]) : NULL;
502
+ if(isset($element)) {
503
+ $value = $element;
504
+ break;
505
+ }
506
+
507
+ $element = isset($_POST['wdform_'.$i."_country".$id]) ? esc_html($_POST['wdform_'.$i."_country".$id]) : NULL;
508
+ if(isset($element)) {
509
+ $value = $element;
510
+ break;
511
+ }
512
+ break;
513
+ }
514
+
515
+ case "type_hidden": {
516
+ $value = isset($_POST[$label_label[$key]]) ? esc_html($_POST[$label_label[$key]]) : "";
517
+ break;
518
+ }
519
+
520
+ case "type_radio": {
521
+ $element = isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL;
522
+ if(isset($element)) {
523
+ $value = $element;
524
+ break;
525
+ }
526
+ $value = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "";
527
+ break;
528
+ }
529
+
530
+ case "type_checkbox": {
531
+ $start = -1;
532
+ $value = '';
533
+ for($j = 0; $j < 100; $j++) {
534
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
535
+ if(isset($element)) {
536
+ $start = $j;
537
+ break;
538
+ }
539
+ }
540
+
541
+ $other_element_id = -1;
542
+ $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
543
+ if($is_other == "yes") {
544
+ $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
545
+ }
546
+
547
+ if($start != -1) {
548
+ for($j = $start; $j < 100; $j++) {
549
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
550
+ if(isset($element)) {
551
+ if($j == $other_element_id) {
552
+ $value = $value . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '***br***';
553
+ }
554
+ else {
555
+ $value = $value . (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "") . '***br***';
556
+ }
557
+ }
558
+ }
559
+ }
560
+ break;
561
+ }
562
+
563
+ case "type_paypal_price": {
564
+ $value = isset($_POST['wdform_'.$i."_element_dollars".$id]) ? $_POST['wdform_'.$i."_element_dollars".$id] : 0;
565
+
566
+ $value = (int) preg_replace('/\D/', '', $value);
567
+
568
+ if(isset($_POST['wdform_'.$i."_element_cents".$id])) {
569
+ $value = $value . '.' . ( preg_replace('/\D/', '', $_POST['wdform_'.$i."_element_cents".$id]));
570
+ }
571
+
572
+ $total += (float)($value);
573
+ $paypal_option = array();
574
+
575
+ if($value != 0) {
576
+ $quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : 1);
577
+ array_push ($paypal['item_name'], $label_label[$key]);
578
+ array_push ($paypal['quantity'], $quantity);
579
+ array_push ($paypal['amount'], $value);
580
+ $is_amount=true;
581
+ array_push ($paypal['on_os'], $paypal_option);
582
+ }
583
+ $value = $value . $form_currency;
584
+ break;
585
+ }
586
+
587
+ case "type_paypal_select": {
588
+ if(isset($_POST['wdform_'.$i."_element_label".$id]) && $_POST['wdform_'.$i."_element".$id] !='') {
589
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
590
+ }
591
+ else {
592
+ $value = '';
593
+ }
594
+ $quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : 1);
595
+ $total += (float)(isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : 0) * $quantity;
596
+ array_push ($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : ""));
597
+ array_push ($paypal['quantity'], $quantity);
598
+ array_push ($paypal['amount'], (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : ""));
599
+ if(isset($_POST['wdform_'.$i."_element".$id]) && $_POST['wdform_'.$i."_element".$id] != 0) {
600
+ $is_amount=true;
601
+ }
602
+ $element_quantity = isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
603
+ if(isset($element_quantity) && $value != '') {
604
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : "") . ': ' . $_POST['wdform_'.$i."_element_quantity".$id] . '***quantity***';
605
+ }
606
+ $paypal_option = array();
607
+ $paypal_option['on'] = array();
608
+ $paypal_option['os'] = array();
609
+
610
+ for($k = 0; $k < 50; $k++) {
611
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
612
+ if(isset($temp_val) && $value != '') {
613
+ array_push ($paypal_option['on'], (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : ""));
614
+ array_push ($paypal_option['os'], (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : ""));
615
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : "") . '***property***';
616
+ }
617
+ }
618
+ array_push ($paypal['on_os'], $paypal_option);
619
+ break;
620
+ }
621
+
622
+ case "type_paypal_radio": {
623
+ if(isset($_POST['wdform_'.$i."_element_label".$id])) {
624
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
625
+ }
626
+ else {
627
+ $value = '';
628
+ }
629
+ $quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : 1);
630
+ $total += (float)(isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : 0) * $quantity;
631
+ array_push ($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : ""));
632
+ array_push ($paypal['quantity'], $quantity);
633
+ array_push ($paypal['amount'], (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : 0));
634
+ if(isset($_POST['wdform_'.$i."_element".$id]) && $_POST['wdform_'.$i."_element".$id] != 0) {
635
+ $is_amount=true;
636
+ }
637
+
638
+ $element_quantity = isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
639
+ if(isset($element_quantity) && $value != '') {
640
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : "") . ': ' . $_POST['wdform_'.$i."_element_quantity".$id] . '***quantity***';
641
+ }
642
+
643
+ $paypal_option = array();
644
+ $paypal_option['on'] = array();
645
+ $paypal_option['os'] = array();
646
+
647
+ for($k = 0; $k < 50; $k++) {
648
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
649
+ if(isset($temp_val) && $value != '') {
650
+ array_push ($paypal_option['on'], (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : ""));
651
+ array_push ($paypal_option['os'], $_POST['wdform_'.$i."_property".$id.$k]);
652
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $_POST['wdform_'.$i."_property".$id.$k] . '***property***';
653
+ }
654
+ }
655
+ array_push ($paypal['on_os'], $paypal_option);
656
+ break;
657
+ }
658
+
659
+ case "type_paypal_shipping": {
660
+ if(isset($_POST['wdform_'.$i."_element_label".$id])) {
661
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
662
+ }
663
+ else {
664
+ $value = '';
665
+ }
666
+ $value = (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : "") . ' - ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
667
+ $paypal['shipping'] = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "";
668
+ break;
669
+ }
670
+
671
+ case "type_paypal_checkbox": {
672
+ $start = -1;
673
+ $value = '';
674
+ for($j = 0; $j < 100; $j++) {
675
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
676
+ if(isset($element)) {
677
+ $start = $j;
678
+ break;
679
+ }
680
+ }
681
+
682
+ $other_element_id = -1;
683
+ $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
684
+ if($is_other == "yes") {
685
+ $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
686
+ }
687
+
688
+ if($start != -1) {
689
+ for($j = $start; $j < 100; $j++) {
690
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
691
+ if(isset($element)) {
692
+ if($j == $other_element_id) {
693
+ $value = $value . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '***br***';
694
+ }
695
+ else {
696
+ $value = $value . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "") . ' - ' . (isset($_POST['wdform_'.$i."_element".$id.$j]) && $_POST['wdform_'.$i."_element".$id.$j] == '' ? '0' : (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "")) . $form_currency . '***br***';
697
+ $quantity = ((isset($_POST['wdform_' . $i . "_element_quantity" . $id]) && ($_POST['wdform_' . $i . "_element_quantity" . $id] >= 1)) ? $_POST['wdform_'.$i . "_element_quantity" . $id] : 1);
698
+ $total += (float)(isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : 0) * (float)($quantity);
699
+ array_push ($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : ""));
700
+ array_push ($paypal['quantity'], $quantity);
701
+ array_push ($paypal['amount'], (isset($_POST['wdform_'.$i."_element".$id.$j]) ? ($_POST['wdform_'.$i."_element".$id.$j] == '' ? '0' : $_POST['wdform_'.$i."_element".$id.$j]) : ""));
702
+ if (isset($_POST['wdform_'.$i."_element".$id.$j]) && $_POST['wdform_'.$i."_element".$id.$j] != 0) {
703
+ $is_amount = TRUE;
704
+ }
705
+ $paypal_option = array();
706
+ $paypal_option['on'] = array();
707
+ $paypal_option['os'] = array();
708
+
709
+ for($k = 0; $k < 50; $k++) {
710
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
711
+ if(isset($temp_val)) {
712
+ array_push ($paypal_option['on'], isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "");
713
+ array_push ($paypal_option['os'], $_POST['wdform_'.$i."_property".$id.$k]);
714
+ }
715
+ }
716
+ array_push ($paypal['on_os'], $paypal_option);
717
+ }
718
+ }
719
+ }
720
+
721
+ $element_quantity = isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
722
+ if(isset($element_quantity)) {
723
+ $value .= (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : "") . ': ' . $_POST['wdform_'.$i."_element_quantity".$id] . '***quantity***';
724
+ }
725
+ for($k = 0; $k < 50; $k++) {
726
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
727
+ if(isset($temp_val)) {
728
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $_POST['wdform_'.$i."_property".$id.$k] . '***property***';
729
+ }
730
+ }
731
+ }
732
+ break;
733
+ }
734
+
735
+ case "type_star_rating": {
736
+ if(isset($_POST['wdform_'.$i."_selected_star_amount".$id]) && $_POST['wdform_'.$i."_selected_star_amount".$id] == "") {
737
+ $selected_star_amount = 0;
738
+ }
739
+ else {
740
+ $selected_star_amount = isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : 0;
741
+ }
742
+ $value = $selected_star_amount . '/' . (isset($_POST['wdform_'.$i."_star_amount".$id]) ? $_POST['wdform_'.$i."_star_amount".$id] : "");
743
+ break;
744
+ }
745
+
746
+ case "type_scale_rating": {
747
+ $value = (isset($_POST['wdform_'.$i."_scale_radio".$id]) ? $_POST['wdform_'.$i."_scale_radio".$id] : 0) . '/' . (isset($_POST['wdform_'.$i."_scale_amount".$id]) ? $_POST['wdform_'.$i."_scale_amount".$id] : "");
748
+ break;
749
+ }
750
+
751
+ case "type_spinner": {
752
+ $value = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "";
753
+ break;
754
+ }
755
+
756
+ case "type_slider": {
757
+ $value = isset($_POST['wdform_'.$i."_slider_value".$id]) ? $_POST['wdform_'.$i."_slider_value".$id] : "";
758
+ break;
759
+ }
760
+
761
+ case "type_range": {
762
+ $value = (isset($_POST['wdform_'.$i."_element".$id.'0']) ? $_POST['wdform_'.$i."_element".$id.'0'] : "") . '-' . (isset($_POST['wdform_'.$i."_element".$id.'1']) ? $_POST['wdform_'.$i."_element".$id.'1'] : "");
763
+ break;
764
+ }
765
+
766
+ case "type_grading": {
767
+ $value = "";
768
+ $items = explode(":", isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "");
769
+ for($k = 0; $k < sizeof($items) - 1; $k++) {
770
+ $value .= (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : "") . ':';
771
+ }
772
+ $value .= (isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "") . '***grading***';
773
+ break;
774
+ }
775
+
776
+ case "type_matrix": {
777
+ $rows_of_matrix = explode("***", isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "");
778
+ $rows_count = sizeof($rows_of_matrix) - 1;
779
+ $column_of_matrix = explode("***", isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "");
780
+ $columns_count = sizeof($column_of_matrix) - 1;
781
+
782
+ if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "radio") {
783
+ $input_value = "";
784
+ for($k = 1; $k <= $rows_count; $k++) {
785
+ $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k]) ? $_POST['wdform_'.$i."_input_element".$id.$k] : 0) . "***";
786
+ }
787
+ }
788
+ if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "checkbox") {
789
+ $input_value = "";
790
+ for($k = 1; $k <= $rows_count; $k++) {
791
+ for($j = 1; $j <= $columns_count; $j++) {
792
+ $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : 0)."***";
793
+ }
794
+ }
795
+ }
796
+
797
+ if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "text") {
798
+ $input_value = "";
799
+ for($k = 1; $k <= $rows_count; $k++) {
800
+ for($j = 1; $j <= $columns_count; $j++) {
801
+ $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? esc_html($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) : "") . "***";
802
+ }
803
+ }
804
+ }
805
+
806
+ if(isset($_POST['wdform_'.$i."_input_type".$id]) && $_POST['wdform_'.$i."_input_type".$id] == "select") {
807
+ $input_value = "";
808
+ for($k = 1; $k <= $rows_count; $k++) {
809
+ for($j = 1; $j <= $columns_count; $j++) {
810
+ $input_value .= (isset($_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j] : "") . "***";
811
+ }
812
+ }
813
+ }
814
+
815
+ $value = $rows_count . (isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "") . '***' . $columns_count . (isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "") . '***' . (isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : "") . '***' . $input_value . '***matrix***';
816
+ break;
817
+ }
818
+
819
+ }
820
+
821
+ if($type == "type_address") {
822
+ if( $value == '*#*#*#') {
823
+ continue;
824
+ }
825
+ }
826
+ if($type == "type_text" or $type == "type_password" or $type == "type_textarea" or $type == "type_name" or $type == "type_submitter_mail" or $type == "type_number" or $type == "type_phone")
827
+ {
828
+ $untilupload = $form->form_fields;
829
+ $untilupload = substr($untilupload, strpos($untilupload, $i.'*:*id*:*'.$type), -1);
830
+ $untilupload = substr($untilupload, 0, strpos($untilupload, '*:*new_field*:'));
831
+ $untilupload = explode('*:*w_required*:*', $untilupload);
832
+ $untilupload = $untilupload[1];
833
+ $untilupload = explode('*:*w_unique*:*', $untilupload);
834
+ $unique_element = $untilupload[0];
835
+ if(strlen($unique_element)>3)
836
+ $unique_element = substr($unique_element, -3);
837
+
838
+ if($unique_element == 'yes') {
839
+ $unique = $wpdb->get_col($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id= %d and element_label= %s and element_value= %s", $id, $i, addslashes($value)));
840
+ if ($unique) {
841
+ echo "<script> alert('" . addslashes(__('This field %s requires a unique entry and this value was already submitted.', 'form_maker')) . "'.replace('%s','" . $label_label[$key] . "'));</script>";
842
+ return array($max + 1);
843
+ }
844
+ }
845
+ }
846
+ $save_or_no = TRUE;
847
+ $fvals['{'.$i.'}']=str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***"), array(" ", "", " ", " ", " ", ", "), addslashes($value));
848
+ if ($form->savedb) {
849
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
850
+ 'form_id' => $id,
851
+ 'element_label' => $i,
852
+ 'element_value' => stripslashes($value),
853
+ 'group_id' => ($max + 1),
854
+ 'date' => date('Y-m-d H:i:s'),
855
+ 'ip' => $_SERVER['REMOTE_ADDR'],
856
+ 'user_id_wd' => $current_user->ID,
857
+ ), array(
858
+ '%d',
859
+ '%s',
860
+ '%s',
861
+ '%d',
862
+ '%s',
863
+ '%s',
864
+ '%d'
865
+ ));
866
+ }
867
+ if (!$save_or_no) {
868
+ return FALSE;
869
+ }
870
+ $chgnac = FALSE;
871
+ }
872
+ else{
873
+ $fvals['{'.$i.'}']='';
874
+ }
875
+ }
876
+ }
877
+ else {
878
+ foreach ($label_type as $key => $type) {
879
+ $value = '';
880
+ if ($type == "type_submit_reset" or $type == "type_map" or $type == "type_editor" or $type == "type_captcha" or $type == "type_arithmetic_captcha" or $type == "type_recaptcha" or $type == "type_button" or $type=="type_paypal_total")
881
+ continue;
882
+ $i = $label_id[$key];
883
+ if ($type != "type_address") {
884
+ $deleted = isset($_POST[$i . "_type" . $id]) ? $_POST[$i . "_type" . $id] : NULL;
885
+ if (!isset($deleted))
886
+ break;
887
+ }
888
+ if ($type == 'type_paypal_total') {
889
+ continue;
890
+ }
891
+ switch ($type) {
892
+ case 'type_text':
893
+ case 'type_password':
894
+ case 'type_textarea':
895
+ case "type_submitter_mail":
896
+ case "type_date":
897
+ case "type_own_select":
898
+ case "type_country":
899
+ case "type_number": {
900
+ $value = isset($_POST[$i . "_element" . $id]) ? esc_html($_POST[$i . "_element" . $id]) : "";
901
+ break;
902
+ }
903
+ case "type_mark_map": {
904
+ $value = (isset($_POST[$i . "_long" . $id]) ? $_POST[$i . "_long" . $id] : "") . '***map***' . (isset($_POST[$i . "_lat" . $id]) ? $_POST[$i . "_lat" . $id] : "");
905
+ break;
906
+ }
907
+ case "type_date_fields": {
908
+ $value = (isset($_POST[$i . "_day" . $id]) ? $_POST[$i . "_day" . $id] : "") . '-' . (isset($_POST[$i . "_month" . $id]) ? $_POST[$i . "_month" . $id] : "") . '-' . (isset($_POST[$i . "_year" . $id]) ? $_POST[$i . "_year" . $id] : "");
909
+ break;
910
+ }
911
+ case "type_time": {
912
+ $ss = isset($_POST[$i . "_ss" . $id]) ? $_POST[$i . "_ss" . $id] : NULL;
913
+ if (isset($ss)) {
914
+ $value = (isset($_POST[$i . "_hh" . $id]) ? $_POST[$i . "_hh" . $id] : "") . ':' . (isset($_POST[$i . "_mm" . $id]) ? $_POST[$i . "_mm" . $id] : "") . ':' . $ss;
915
+ }
916
+ else {
917
+ $value = (isset($_POST[$i . "_hh" . $id]) ? $_POST[$i . "_hh" . $id] : "") . ':' . (isset($_POST[$i . "_mm" . $id]) ? $_POST[$i . "_mm" . $id] : "");
918
+ }
919
+ $am_pm = isset($_POST[$i . "_am_pm" . $id]) ? $_POST[$i . "_am_pm" . $id] : NULL;
920
+ if (isset($am_pm))
921
+ $value = $value . ' ' . $am_pm;
922
+ break;
923
+ }
924
+ case "type_phone": {
925
+ $value = (isset($_POST[$i . "_element_first" . $id]) ? $_POST[$i . "_element_first" . $id] : "") . ' ' . (isset($_POST[$i . "_element_last" . $id]) ? $_POST[$i . "_element_last" . $id] : "");
926
+ break;
927
+ }
928
+ case "type_name": {
929
+ $element_title = isset($_POST[$i . "_element_title" . $id]) ? esc_html($_POST[$i . "_element_title" . $id]) : NULL;
930
+ if (isset($element_title)) {
931
+ $value = $element_title . ' ' . (isset($_POST[$i . "_element_first" . $id]) ? esc_html($_POST[$i . "_element_first" . $id]) : "") . ' ' . (isset($_POST[$i . "_element_last" . $id]) ? esc_html($_POST[$i . "_element_last" . $id]) : "") . ' ' . (isset($_POST[$i . "_element_middle" . $id]) ? esc_html($_POST[$i . "_element_middle" . $id]) : "");
932
+ }
933
+ else {
934
+ $value = (isset($_POST[$i . "_element_first" . $id]) ? esc_html($_POST[$i . "_element_first" . $id]) : "") . ' ' . (isset($_POST[$i . "_element_last" . $id]) ? esc_html($_POST[$i . "_element_last" . $id]) : "");
935
+ }
936
+ break;
937
+ }
938
+ case "type_file_upload": {
939
+ $file = isset($_FILES[$i . '_file' . $id]) ? $_FILES[$i . '_file' . $id] : NULL;
940
+ if ($file['name']) {
941
+ $untilupload = $form->form;
942
+ $pos1 = strpos($untilupload, "***destinationskizb" . $i . "***");
943
+ $pos2 = strpos($untilupload, "***destinationverj" . $i . "***");
944
+ $destination = substr($untilupload, $pos1 + (23 + (strlen($i) - 1)), $pos2 - $pos1 - (23 + (strlen($i) - 1)));
945
+ $pos1 = strpos($untilupload, "***extensionskizb" . $i . "***");
946
+ $pos2 = strpos($untilupload, "***extensionverj" . $i . "***");
947
+ $extension = substr($untilupload, $pos1 + (21 + (strlen($i) - 1)), $pos2 - $pos1 - (21 + (strlen($i) - 1)));
948
+ $pos1 = strpos($untilupload, "***max_sizeskizb" . $i . "***");
949
+ $pos2 = strpos($untilupload, "***max_sizeverj" . $i . "***");
950
+ $max_size = substr($untilupload, $pos1 + (20 + (strlen($i) - 1)), $pos2 - $pos1 - (20 + (strlen($i) - 1)));
951
+ $fileName = $file['name'];
952
+ $destination = str_replace(site_url() . '/', '', $destination);
953
+ $fileSize = $file['size'];
954
+ if ($fileSize > $max_size * 1024) {
955
+ echo "<script> alert('" . addslashes(__('The file exceeds the allowed size of', 'form_maker')) . $max_size . " KB');</script>";
956
+ return array($max + 1);
957
+ }
958
+ $uploadedFileNameParts = explode('.', $fileName);
959
+ $uploadedFileExtension = array_pop($uploadedFileNameParts);
960
+ $to = strlen($fileName) - strlen($uploadedFileExtension) - 1;
961
+ $fileNameFree = substr($fileName, 0, $to);
962
+ $invalidFileExts = explode(',', $extension);
963
+ $extOk = FALSE;
964
+ foreach ($invalidFileExts as $key => $value) {
965
+ if (is_numeric(strpos(strtolower($value), strtolower($uploadedFileExtension)))) {
966
+ $extOk = TRUE;
967
+ }
968
+ }
969
+ if ($extOk == FALSE) {
970
+ echo "<script> alert('" . addslashes(__('Sorry, you are not allowed to upload this type of file.', 'form_maker')) . "');</script>";
971
+ return array($max + 1);
972
+ }
973
+ $fileTemp = $file['tmp_name'];
974
+ $p = 1;
975
+
976
+ if(!file_exists($destination))
977
+ mkdir($destination , 0777);
978
+
979
+ if (file_exists($destination . "/" . $fileName)) {
980
+ $fileName1 = $filename;
981
+ while (file_exists($destination . "/" . $fileName1)) {
982
+ $to = strlen($file['name']) - strlen($uploadedFileExtension) - 1;
983
+ $fileName1 = substr($fileName, 0, $to) . '(' . $p . ').' . $uploadedFileExtension;
984
+ $file['name'] = $fileName;
985
+ $p++;
986
+ }
987
+ $fileName = $fileName1;
988
+ }
989
+ if (is_dir(ABSPATH . $destination)) {
990
+ if (!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
991
+ echo "<script> alert('" . addslashes(__('Error, file cannot be moved.', 'form_maker')) . "');</script>";
992
+ return array($max + 1);
993
+ }
994
+ }
995
+ else {
996
+ echo "<script> alert('" . addslashes(__('Error, file destination does not exist.', 'form_maker')) . "');</script>";
997
+ return array($max + 1);
998
+ }
999
+ $value = site_url() . '/' . $destination . '/' . $fileName . '*@@url@@*';
1000
+ $file['tmp_name'] = $destination . "/" . $fileName;
1001
+ $file['name'] = ABSPATH . $destination . "/" . $fileName;
1002
+ // $temp_file = array( "name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key]);
1003
+ array_push($all_files, $file);
1004
+ }
1005
+ break;
1006
+ }
1007
+ case 'type_address': {
1008
+ $value = '*#*#*#';
1009
+ if (isset($_POST[$i . "_street1" . $id])) {
1010
+ $value = esc_html($_POST[$i . "_street1" . $id]);
1011
+ break;
1012
+ }
1013
+ if (isset($_POST[$i . "_street2" . $id])) {
1014
+ $value = esc_html($_POST[$i . "_street2" . $id]);
1015
+ break;
1016
+ }
1017
+ if (isset($_POST[$i . "_city" . $id])) {
1018
+ $value = esc_html($_POST[$i . "_city" . $id]);
1019
+ break;
1020
+ }
1021
+ if (isset($_POST[$i . "_state" . $id])) {
1022
+ $value = esc_html($_POST[$i . "_state" . $id]);
1023
+ break;
1024
+ }
1025
+ if (isset($_POST[$i . "_postal" . $id])) {
1026
+ $value = esc_html($_POST[$i . "_postal" . $id]);
1027
+ break;
1028
+ }
1029
+ if (isset($_POST[$i . "_country" . $id])) {
1030
+ $value = esc_html($_POST[$i . "_country" . $id]);
1031
+ break;
1032
+ }
1033
+ break;
1034
+ }
1035
+ case "type_hidden": {
1036
+ $value = isset($_POST[$label_label[$key]]) ? $_POST[$label_label[$key]] : "";
1037
+ break;
1038
+ }
1039
+ case "type_radio": {
1040
+ $element = isset($_POST[$i . "_other_input" . $id]) ? $_POST[$i . "_other_input" . $id] : NULL;
1041
+ if (isset($element)) {
1042
+ $value = $element;
1043
+ break;
1044
+ }
1045
+ $value = isset($_POST[$i . "_element" . $id]) ? $_POST[$i . "_element" . $id] : "";
1046
+ break;
1047
+ }
1048
+ case "type_checkbox": {
1049
+ $start = -1;
1050
+ $value = '';
1051
+ for ($j = 0; $j < 100; $j++) {
1052
+ if (isset($_POST[$i . "_element" . $id . $j])) {
1053
+ $start = $j;
1054
+ break;
1055
+ }
1056
+ }
1057
+ $other_element_id = -1;
1058
+ $is_other = isset($_POST[$i . "_allow_other" . $id]) ? $_POST[$i . "_allow_other" . $id] : "";
1059
+ if ($is_other == "yes") {
1060
+ $other_element_id = isset($_POST[$i . "_allow_other_num" . $id]) ? $_POST[$i . "_allow_other_num" . $id] : "";
1061
+ }
1062
+ if ($start != -1) {
1063
+ for ($j = $start; $j < 100; $j++) {
1064
+ if (isset($_POST[$i . "_element" . $id . $j])) {
1065
+ if ($j == $other_element_id) {
1066
+ $value = $value . (isset($_POST[$i . "_other_input" . $id]) ? $_POST[$i . "_other_input" . $id] : "") . '***br***';
1067
+ }
1068
+ else {
1069
+ $value = $value . $_POST[$i . "_element" . $id . $j] . '***br***';
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+ break;
1075
+ }
1076
+ case "type_paypal_price": {
1077
+ $value = 0;
1078
+ if (isset($_POST[$i."_element_dollars".$id])) {
1079
+ $value = $_POST[$i . "_element_dollars" . $id];
1080
+ }
1081
+ $value = (int) preg_replace('/\D/', '', $value);
1082
+ if (isset($_POST[$i . "_element_cents" . $id])) {
1083
+ $value = $value . '.' . (preg_replace('/\D/', '', $_POST[$i . "_element_cents" . $id]));
1084
+ }
1085
+ $total += (float)($value);
1086
+ $paypal_option = array();
1087
+ if ($value != 0) {
1088
+ array_push($paypal['item_name'], $label_label[$key]);
1089
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1090
+ array_push($paypal['quantity'], $quantity);
1091
+ array_push($paypal['amount'], $value);
1092
+ $is_amount=true;
1093
+ array_push($paypal['on_os'], $paypal_option);
1094
+ }
1095
+ $value = $value . $form_currency;
1096
+ break;
1097
+ }
1098
+ case "type_paypal_select": {
1099
+ $value = '';
1100
+ $value = (isset($_POST[$i . "_element_label" . $id]) ? $_POST[$i . "_element_label" . $id] : "") . ' : ' . (isset($_POST[$i . "_element" . $id]) ? $_POST[$i . "_element" . $id] : "") . $form_currency;
1101
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1102
+ $total += (float)(isset($_POST[$i . "_element" . $id]) ? $_POST[$i . "_element" . $id] : 0) * (float)($quantity);
1103
+ array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST[$i."_element_label".$id]) ? $_POST[$i."_element_label".$id] : ""));
1104
+ array_push($paypal['quantity'], $quantity);
1105
+ array_push($paypal['amount'], isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "");
1106
+ if(isset($_POST[$i."_element".$id]) && $_POST[$i."_element".$id] != 0) {
1107
+ $is_amount=true;
1108
+ }
1109
+ $element_quantity_label = isset($_POST[$i."_element_quantity_label".$id]) ? $_POST[$i."_element_quantity_label".$id] : NULL;
1110
+ if (isset($element_quantity_label)) {
1111
+ $value .= '***br***' . $element_quantity_label . ': ' . $quantity;
1112
+ }
1113
+ $paypal_option=array();
1114
+ $paypal_option['on']=array();
1115
+ $paypal_option['os']=array();
1116
+ for($k=0; $k<50; $k++) {
1117
+ $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1118
+ if(isset($temp_val)) {
1119
+ array_push($paypal_option['on'], isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "");
1120
+ array_push($paypal_option['os'], $temp_val);
1121
+ $value .= '***br***' . (isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
1122
+ }
1123
+ }
1124
+ array_push($paypal['on_os'], $paypal_option);
1125
+ break;
1126
+ }
1127
+ case "type_paypal_radio": {
1128
+ $value = '';
1129
+ if (isset($_POST[$i."_element_label".$id]) && ($_POST[$i."_element_label".$id] != '')) {
1130
+ $value = $_POST[$i."_element_label".$id] . ' - ' . (isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "") . $form_currency;
1131
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1132
+ $total+=(float)(isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : 0)*(float)($quantity);
1133
+ array_push($paypal['item_name'], $label_label[$key] . ' ' . $_POST[$i."_element_label".$id]);
1134
+ array_push($paypal['quantity'], $quantity);
1135
+ array_push($paypal['amount'], isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "");
1136
+ if(isset($_POST[$i."_element".$id]) && $_POST[$i."_element".$id] != 0) {
1137
+ $is_amount=true;
1138
+ }
1139
+ $element_quantity_label = isset($_POST[$i."_element_quantity_label".$id]) ? $_POST[$i."_element_quantity_label".$id] : NULL;
1140
+ if (isset($element_quantity_label)) {
1141
+ $value .= '***br***' . $element_quantity_label . ': ' . $quantity;
1142
+ }
1143
+ $paypal_option = array();
1144
+ $paypal_option['on'] = array();
1145
+ $paypal_option['os'] = array();
1146
+ for ($k = 0; $k < 50; $k++) {
1147
+ $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1148
+ if(isset($temp_val)) {
1149
+ array_push ($paypal_option['on'], isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "");
1150
+ array_push ($paypal_option['os'], $temp_val);
1151
+ $value .= '***br***' . (isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
1152
+ }
1153
+ }
1154
+ array_push ($paypal['on_os'], $paypal_option);
1155
+ }
1156
+ break;
1157
+ }
1158
+ case "type_paypal_shipping": {
1159
+ $value = '';
1160
+ if (isset($_POST[$i."_element_label".$id]) && ($_POST[$i."_element_label".$id] != '')) {
1161
+ $value = $_POST[$i."_element_label".$id] . ' - ' . (isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "") . $form_currency;
1162
+ $paypal['shipping'] = isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : "";
1163
+ }
1164
+ break;
1165
+ }
1166
+ case "type_paypal_checkbox": {
1167
+ $start = -1;
1168
+ $value = '';
1169
+ for ($j = 0; $j < 100; $j++) {
1170
+ if (isset($_POST[$i."_element".$id.$j])) {
1171
+ $start = $j;
1172
+ break;
1173
+ }
1174
+ }
1175
+ $other_element_id = -1;
1176
+ $is_other = isset($_POST[$i."_allow_other".$id]) ? $_POST[$i."_allow_other".$id] : "";
1177
+ if ($is_other == "yes") {
1178
+ $other_element_id = isset($_POST[$i."_allow_other_num".$id]) ? $_POST[$i."_allow_other_num".$id] : "";
1179
+ }
1180
+ if ($start != -1) {
1181
+ for ($j = $start; $j < 100; $j++) {
1182
+ if (isset($_POST[$i."_element".$id.$j])) {
1183
+ if ($j == $other_element_id) {
1184
+ $value = $value . (isset($_POST[$i."_other_input".$id]) ? $_POST[$i."_other_input".$id] : "") . '***br***';
1185
+ }
1186
+ else {
1187
+ $value = $value . (isset($_POST[$i."_element".$id.$j."_label"]) ? $_POST[$i."_element".$id.$j."_label"] : "") . ' - ' . ($_POST[$i."_element".$id.$j] == '' ? '0' : $_POST[$i."_element".$id.$j]) . $form_currency . '***br***';
1188
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1189
+ $total += (float)(isset($_POST[$i."_element".$id.$j]) ? $_POST[$i."_element".$id.$j] : 0) * (float)($quantity);
1190
+ array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST[$i."_element".$id.$j."_label"]) ? $_POST[$i."_element".$id.$j."_label"] : ""));
1191
+ array_push($paypal['quantity'], $quantity);
1192
+ array_push($paypal['amount'], ($_POST[$i."_element".$id.$j] == '') ? '0' : $_POST[$i."_element".$id.$j]);
1193
+ if (isset($_POST[$i."_element".$id.$j]) && $_POST[$i."_element".$id.$j] != 0) {
1194
+ $is_amount = TRUE;
1195
+ }
1196
+ $paypal_option = array();
1197
+ $paypal_option['on'] = array();
1198
+ $paypal_option['os'] = array();
1199
+ for ($k = 0; $k < 50; $k++) {
1200
+ $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1201
+ if (isset($temp_val)) {
1202
+ array_push ($paypal_option['on'], isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "");
1203
+ array_push ($paypal_option['os'], $temp_val);
1204
+ }
1205
+ }
1206
+ array_push ($paypal['on_os'], $paypal_option);
1207
+ }
1208
+ }
1209
+ }
1210
+ $element_quantity_label = isset($_POST[$i."_element_quantity_label".$id]) ? $_POST[$i."_element_quantity_label".$id] : NULL;
1211
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
1212
+ if (isset($element_quantity_label)) {
1213
+ $value .= $element_quantity_label . ': ' . $quantity . '***br***';
1214
+ }
1215
+ for ($k = 0; $k < 50; $k++) {
1216
+ $temp_val = isset($_POST[$i."_element_property_value".$id.$k]) ? $_POST[$i."_element_property_value".$id.$k] : NULL;
1217
+ if (isset($temp_val)) {
1218
+ $value .= (isset($_POST[$i."_element_property_label".$id.$k]) ? $_POST[$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val . '***br***';
1219
+ }
1220
+ }
1221
+ }
1222
+ break;
1223
+ }
1224
+ case "type_star_rating": {
1225
+ if (isset($_POST[$i."_selected_star_amount".$id]) && $_POST[$i."_selected_star_amount".$id] != "") {
1226
+ $selected_star_amount = $_POST[$i."_selected_star_amount".$id];
1227
+ }
1228
+ else {
1229
+ $selected_star_amount = 0;
1230
+ }
1231
+ $value = (isset($_POST[$i."_star_amount".$id]) ? $_POST[$i."_star_amount".$id] : '').'***'.$selected_star_amount.'***'.(isset($_POST[$i."_star_color".$id]) ? $_POST[$i."_star_color".$id] : '').'***star_rating***';
1232
+ break;
1233
+ }
1234
+ case "type_scale_rating": {
1235
+ $value = (isset($_POST[$i."_scale_radio".$id]) ? $_POST[$i."_scale_radio".$id] : 0).'/'.(isset($_POST[$i."_scale_amount".$id]) ? $_POST[$i."_scale_amount".$id] : '');
1236
+ break;
1237
+ }
1238
+ case "type_spinner": {
1239
+ $value = (isset($_POST[$i."_element".$id]) ? $_POST[$i."_element".$id] : '');
1240
+ break;
1241
+ }
1242
+ case "type_slider": {
1243
+ $value = (isset($_POST[$i."_slider_value".$id]) ? $_POST[$i."_slider_value".$id] : '');
1244
+ break;
1245
+ }
1246
+ case "type_range": {
1247
+ $value = (isset($_POST[$i."_element".$id . '0']) ? $_POST[$i."_element".$id . '0'] : '') .'-'.(isset($_POST[$i."_element".$id.'1']) ? $_POST[$i."_element".$id.'1'] : '');
1248
+ break;
1249
+ }
1250
+ case "type_grading": {
1251
+ $value = "";
1252
+ if (isset($_POST[$i."_hidden_item".$id])) {
1253
+ $items = explode(":", $_POST[$i."_hidden_item".$id]);
1254
+ for ($k = 0; $k < sizeof($items) - 1; $k++) {
1255
+ if (isset($_POST[$i."_element".$id.$k])) {
1256
+ $value .= $_POST[$i."_element".$id.$k].':';
1257
+ }
1258
+ }
1259
+ $value .= $_POST[$i."_hidden_item".$id].'***grading***';
1260
+ }
1261
+ break;
1262
+ }
1263
+ case "type_matrix": {
1264
+ $rows_of_matrix = explode("***", isset($_POST[$i."_hidden_row".$id]) ? $_POST[$i."_hidden_row".$id] : "");
1265
+ $rows_count = sizeof($rows_of_matrix) - 1;
1266
+ $column_of_matrix = explode("***", isset($_POST[$i."_hidden_column".$id]) ? $_POST[$i."_hidden_column".$id] : "");
1267
+ $columns_count = sizeof($column_of_matrix) - 1;
1268
+ $row_ids = explode(",", substr(isset($_POST[$i."_row_ids".$id]) ? $_POST[$i."_row_ids".$id] : "", 0, -1));
1269
+ $column_ids = explode(",", substr(isset($_POST[$i."_column_ids".$id]) ? $_POST[$i."_column_ids".$id] : "", 0, -1));
1270
+ if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "radio") {
1271
+ $input_value="";
1272
+ foreach($row_ids as $row_id) {
1273
+ $input_value.=(isset($_POST[$i."_input_element".$id.$row_id]) ? $_POST[$i."_input_element".$id.$row_id] : 0)."***";
1274
+ }
1275
+ }
1276
+ if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "checkbox") {
1277
+ $input_value="";
1278
+ foreach($row_ids as $row_id)
1279
+ foreach($column_ids as $column_id)
1280
+ $input_value .= (isset($_POST[$i."_input_element".$id.$row_id.'_'.$column_id]) ? $_POST[$i."_input_element".$id.$row_id.'_'.$column_id] : 0)."***";
1281
+ }
1282
+ if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "text") {
1283
+ $input_value="";
1284
+ foreach($row_ids as $row_id)
1285
+ foreach($column_ids as $column_id)
1286
+ $input_value .= (isset($_POST[$i."_input_element".$id.$row_id.'_'.$column_id]) ? esc_html($_POST[$i."_input_element".$id.$row_id.'_'.$column_id]) : "")."***";
1287
+ }
1288
+ if (isset($_POST[$i."_input_type".$id]) && $_POST[$i."_input_type".$id] == "select") {
1289
+ $input_value="";
1290
+ foreach($row_ids as $row_id)
1291
+ foreach($column_ids as $column_id)
1292
+ $input_value .= (isset($_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id]) ? $_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id] : "")."***";
1293
+ }
1294
+ $value = $rows_count . '***' . (isset($_POST[$i."_hidden_row".$id]) ? $_POST[$i."_hidden_row".$id] : "") . $columns_count . '***' . (isset($_POST[$i."_hidden_column".$id]) ? $_POST[$i."_hidden_column".$id] : "") . (isset($_POST[$i."_input_type".$id]) ? $_POST[$i."_input_type".$id] : "") . '***' .$input_value . '***matrix***';
1295
+ break;
1296
+ }
1297
+ }
1298
+ if ($type == "type_address") {
1299
+ if ($value == '*#*#*#') {
1300
+ // break; ?????????????????????????????????????????????????????
1301
+ continue;
1302
+ }
1303
+ }
1304
+ $unique_element = isset($_POST[$i . "_unique" . $id]) ? $_POST[$i . "_unique" . $id] : "";
1305
+ if ($unique_element == 'yes') {
1306
+ $unique = $wpdb->get_col($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id= %d and element_label= %s and element_value= %s", $id_old, $i, addslashes($value)));
1307
+ if ($unique) {
1308
+ echo "<script> alert('" . addslashes(__('This field %s requires a unique entry and this value was already submitted.', 'form_maker')) . "'.replace('%s','" . $label_label[$key] . "'));</script>";
1309
+ return array($max + 1);
1310
+ }
1311
+ }
1312
+
1313
+ $r = $wpdb->prefix . "formmaker_submits";
1314
+
1315
+ $save_or_no = $wpdb->insert($r, array(
1316
+ 'form_id' => $id_old,
1317
+ 'element_label' => $i,
1318
+ 'element_value' => stripslashes($value),
1319
+ 'group_id' => ($max + 1),
1320
+ 'date' => date('Y-m-d H:i:s'),
1321
+ 'ip' => $ip,
1322
+ 'user_id_wd' => $current_user->ID,
1323
+ ), array(
1324
+ '%d',
1325
+ '%s',
1326
+ '%s',
1327
+ '%d',
1328
+ '%s',
1329
+ '%s',
1330
+ '%d'
1331
+ ));
1332
+ if (!$save_or_no) {
1333
+ return FALSE;
1334
+ }
1335
+ $chgnac = FALSE;
1336
+ }
1337
+ }
1338
+
1339
+
1340
+ $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
1341
+ $user_fields = array("subid"=>$subid, "ip"=>$ip, "userid"=>$wp_userid, "username"=>$wp_username, "useremail"=>$wp_useremail);
1342
+
1343
+ $queries = $wpdb->get_results( $wpdb->prepare("SELECT * FROM " .$wpdb->prefix. "formmaker_query WHERE form_id=%d",(int)$id ));
1344
+ if($queries)
1345
+ {
1346
+ foreach($queries as $query)
1347
+ {
1348
+ $temp = explode('***wdfcon_typewdf***',$query->details);
1349
+ $con_type = $temp[0];
1350
+ $temp = explode('***wdfcon_methodwdf***',$temp[1]);
1351
+ $con_method = $temp[0];
1352
+ $temp = explode('***wdftablewdf***',$temp[1]);
1353
+ $table_cur = $temp[0];
1354
+ $temp = explode('***wdfhostwdf***',$temp[1]);
1355
+ $host = $temp[0];
1356
+ $temp = explode('***wdfportwdf***',$temp[1]);
1357
+ $port = $temp[0];
1358
+ $temp = explode('***wdfusernamewdf***',$temp[1]);
1359
+ $username = $temp[0];
1360
+ $temp = explode('***wdfpasswordwdf***',$temp[1]);
1361
+ $password = $temp[0];
1362
+ $temp = explode('***wdfdatabasewdf***',$temp[1]);
1363
+ $database = $temp[0];
1364
+
1365
+ $query=str_replace(array_keys($fvals), $fvals ,$query->query);
1366
+ foreach($user_fields as $user_key=>$user_field)
1367
+ $query=str_replace('{'.$user_key.'}', $user_field , $query);
1368
+
1369
+ if($con_type == 'remote')
1370
+ {
1371
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
1372
+ $wpdb_temp->query($query);
1373
+ }
1374
+ else {
1375
+ $wpdb->query($query);
1376
+ }
1377
+ }
1378
+ // $wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
1379
+ }
1380
+
1381
+ $addons = array('WD_FM_MAILCHIMP' => 'MailChimp', 'WD_FM_REG' => 'Registration');
1382
+ foreach($addons as $addon => $addon_name)
1383
+ {
1384
+ if (defined($addon) && is_plugin_active(constant($addon))) {
1385
+ $_GET['addon_task']='frontend';
1386
+ $_GET['form_id']=$id;
1387
+ $GLOBALS['fvals']=$fvals;
1388
+ do_action($addon.'_init');
1389
+ }
1390
+ }
1391
+
1392
+ $str = '';
1393
+
1394
+ if ($form->paypal_mode) {
1395
+ if ($paypal['item_name']) {
1396
+ if ($is_amount) {
1397
+ $tax = $form->tax;
1398
+ $currency = $form->payment_currency;
1399
+ $business = $form->paypal_email;
1400
+ $ip = $_SERVER['REMOTE_ADDR'];
1401
+ $total2 = round($total, 2);
1402
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1403
+ 'form_id' => $id,
1404
+ 'element_label' => 'item_total',
1405
+ 'element_value' => $total2 . $form_currency,
1406
+ 'group_id' => ($max + 1),
1407
+ 'date' => date('Y-m-d H:i:s'),
1408
+ 'ip' => $ip,
1409
+ 'user_id_wd' => $current_user->ID,
1410
+ ), array(
1411
+ '%d',
1412
+ '%s',
1413
+ '%s',
1414
+ '%d',
1415
+ '%s',
1416
+ '%s',
1417
+ '%d'
1418
+ ));
1419
+ if (!$save_or_no) {
1420
+ return false;
1421
+ }
1422
+ $total = $total + ($total * $tax) / 100;
1423
+ if (isset($paypal['shipping'])) {
1424
+ $total = $total + $paypal['shipping'];
1425
+ }
1426
+ $total = round($total, 2);
1427
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1428
+ 'form_id' => $id,
1429
+ 'element_label' => 'total',
1430
+ 'element_value' => $total . $form_currency,
1431
+ 'group_id' => ($max + 1),
1432
+ 'date' => date('Y-m-d H:i:s'),
1433
+ 'ip' => $ip,
1434
+ 'user_id_wd' => $current_user->ID,
1435
+ ), array(
1436
+ '%d',
1437
+ '%s',
1438
+ '%s',
1439
+ '%d',
1440
+ '%s',
1441
+ '%s',
1442
+ '%d'
1443
+ ));
1444
+ if (!$save_or_no) {
1445
+ return false;
1446
+ }
1447
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1448
+ 'form_id' => $id,
1449
+ 'element_label' => '0',
1450
+ 'element_value' => 'In progress',
1451
+ 'group_id' => ($max + 1),
1452
+ 'date' => date('Y-m-d H:i:s'),
1453
+ 'ip' => $ip,
1454
+ 'user_id_wd' => $current_user->ID,
1455
+ ), array(
1456
+ '%d',
1457
+ '%s',
1458
+ '%s',
1459
+ '%d',
1460
+ '%s',
1461
+ '%s',
1462
+ '%d'
1463
+ ));
1464
+ if (!$save_or_no) {
1465
+ return false;
1466
+ }
1467
+ $str = '';
1468
+ if ($form->checkout_mode==1 || $form->checkout_mode == "production") {
1469
+ $str .= "https://www.paypal.com/cgi-bin/webscr?";
1470
+ }
1471
+ else {
1472
+ $str .= "https://www.sandbox.paypal.com/cgi-bin/webscr?";
1473
+ }
1474
+ $str .= "currency_code=" . $currency;
1475
+ $str .= "&business=" . urlencode($business);
1476
+ $str .= "&cmd=" . "_cart";
1477
+ $str .= "&notify_url=" . admin_url('admin-ajax.php?action=checkpaypal%26form_id=' . $id . '%26group_id=' . ($max + 1));
1478
+ $str .= "&upload=" . "1";
1479
+ $str .= "&charset=UTF-8";
1480
+ if (isset($paypal['shipping'])) {
1481
+ $str = $str . "&shipping_1=" . $paypal['shipping'];
1482
+ // $str=$str."&weight_cart=".$paypal['shipping'];
1483
+ // $str=$str."&shipping2=3".$paypal['shipping'];
1484
+ $str = $str."&no_shipping=2";
1485
+ }
1486
+ $i=0;
1487
+ foreach ($paypal['item_name'] as $pkey => $pitem_name) {
1488
+ if($paypal['amount'][$pkey]) {
1489
+ $i++;
1490
+ $str = $str."&item_name_".$i."=".urlencode($pitem_name);
1491
+ $str = $str."&amount_".$i."=".$paypal['amount'][$pkey];
1492
+ $str = $str."&quantity_".$i."=".$paypal['quantity'][$pkey];
1493
+ if ($tax) {
1494
+ $str = $str . "&tax_rate_" . $i . "=" . $tax;
1495
+ }
1496
+ if ($paypal['on_os'][$pkey]) {
1497
+ foreach ($paypal['on_os'][$pkey]['on'] as $on_os_key => $on_item_name) {
1498
+ $str = $str."&on".$on_os_key."_".$i."=".$on_item_name;
1499
+ $str = $str."&os".$on_os_key."_".$i."=".$paypal['on_os'][$pkey]['os'][$on_os_key];
1500
+ }
1501
+ }
1502
+ }
1503
+ }
1504
+ }
1505
+ }
1506
+ }
1507
+
1508
+ if($form->mail_verify){
1509
+ unset($_SESSION['hash']);
1510
+ unset($_SESSION['gid']);
1511
+ $ip = $_SERVER['REMOTE_ADDR'];
1512
+ $_SESSION['gid'] = $max+1;
1513
+ $send_tos = explode('**',$form->send_to);
1514
+ if($send_tos){
1515
+ foreach($send_tos as $send_index => $send_to)
1516
+ {
1517
+ $_SESSION['hash'][] = md5($ip.time().rand());
1518
+ $send_to = str_replace('*', '',$send_to);
1519
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
1520
+ 'form_id' => $id,
1521
+ 'element_label' => 'verifyInfo@'.$send_to,
1522
+ 'element_value' => $_SESSION['hash'][$send_index]."**".$form->mail_verify_expiretime."**".$send_to,
1523
+ 'group_id' => ($max + 1),
1524
+ 'date' => date('Y-m-d H:i:s'),
1525
+ 'ip' => $ip,
1526
+ 'user_id_wd' => $current_user->ID,
1527
+ ), array(
1528
+ '%d',
1529
+ '%s',
1530
+ '%s',
1531
+ '%d',
1532
+ '%s',
1533
+ '%s',
1534
+ '%d'
1535
+ ));
1536
+ if (!$save_or_no) {
1537
+ return false;
1538
+ }
1539
+ }
1540
+ }
1541
+ }
1542
+
1543
+
1544
+ if ($chgnac) {
1545
+ global $wpdb;
1546
+ if ($form->submit_text_type != 4) {
1547
+ $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Nothing was submitted.', 'form_maker')));
1548
+ }
1549
+ $_SESSION['error_or_no' . $id] = 1;
1550
+ $_SESSION['form_submit_type' . $id] = $form->submit_text_type . "," . $form->id;
1551
+ wp_redirect($_SERVER["REQUEST_URI"]);
1552
+ exit;
1553
+ }
1554
+
1555
+ $addons = array('WD_FM_GDRIVE_INT' => 'GDriveInt', 'WD_FM_DBOX_INT' => 'DboxInt', 'WD_FM_POST_GEN' => 'PostGen', 'WD_FM_PUSHOVER' => 'Pushover'); // the sequence is important for google drive and drop box addons !!!!!!!!!!
1556
+ foreach($addons as $addon => $addon_name) {
1557
+ if (defined($addon) && is_plugin_active(constant($addon))) {
1558
+ $_GET['addon_task'] = 'frontend';
1559
+ $_GET['form_id'] = $id;
1560
+ $GLOBALS['all_files'] = json_encode($all_files);
1561
+ $GLOBALS['form_currency'] = $form_currency;
1562
+ do_action($addon.'_init');
1563
+ }
1564
+ }
1565
+ return array($all_files, $str);
1566
+ }
1567
+
1568
+ public function remove($group_id) {
1569
+ global $wpdb;
1570
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id= %d', $group_id));
1571
+ }
1572
+
1573
+ public function get_after_submission_text($form_id) {
1574
+ global $wpdb;
1575
+ $submit_text = $wpdb->get_var("SELECT submit_text FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
1576
+ $current_user = wp_get_current_user();
1577
+ if ($current_user->ID != 0){
1578
+ $userid = $current_user->ID;
1579
+ $username = $current_user->display_name;
1580
+ $useremail = $current_user->user_email;
1581
+ } else{
1582
+ $userid = '';
1583
+ $username = '';
1584
+ $useremail = '';
1585
+ }
1586
+ $ip = $_SERVER['REMOTE_ADDR'];
1587
+ $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
1588
+ $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $form_id));
1589
+
1590
+ $old = false;
1591
+ if(isset($row->form)) {
1592
+ $old = true;
1593
+ }
1594
+ $label_order_original = array();
1595
+ $label_order_ids = array();
1596
+ $submission_array = array();
1597
+ if($old == false || ($old == true && $row->form == '')) {
1598
+ $label_all = explode('#****#',$row->label_order_current);
1599
+ } else {
1600
+ $label_all = explode('#****#',$row->label_order);
1601
+ }
1602
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
1603
+ foreach ($label_all as $key => $label_each) {
1604
+ $label_id_each = explode('#**id**#', $label_each);
1605
+ $label_id = $label_id_each[0];
1606
+ array_push($label_order_ids, $label_id);
1607
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
1608
+ $label_order_original[$label_id] = $label_order_each[0];
1609
+ }
1610
+
1611
+ $submissions_row = $wpdb->get_results($wpdb->prepare("SELECT `element_label`, `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=%d AND group_id=%d", $form_id, $subid));
1612
+ foreach ($submissions_row as $sub_row){
1613
+ $submission_array[$sub_row->element_label] = $sub_row->element_value;
1614
+ }
1615
+
1616
+ foreach($label_order_original as $key => $label_each) {
1617
+ if(strpos($submit_text, "%".$label_each."%")>-1) {
1618
+ $submit_text = str_replace("%".$label_each."%", $submission_array[$key], $submit_text);
1619
+ }
1620
+ }
1621
+
1622
+ $custom_fields = array( "subid"=>$subid, "ip"=>$ip, "userid"=>$userid, "username"=>$username, "useremail"=>$useremail);
1623
+ foreach($custom_fields as $key=>$custom_field)
1624
+ {
1625
+ if(strpos($submit_text, "%".$key."%")>-1)
1626
+ $submit_text = str_replace("%".$key."%", $custom_field, $submit_text);
1627
+ }
1628
+ $submit_text = str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***", "***star_rating***"), array(" ", "", " ", " ", " ", ", ", " "), $submit_text);
1629
+
1630
+ return $submit_text;
1631
+ }
1632
+
1633
+ public function increment_views_count($id) {
1634
+ global $wpdb;
1635
+ $vives_form = $wpdb->get_var($wpdb->prepare("SELECT views FROM " . $wpdb->prefix . "formmaker_views WHERE form_id=%d", $id));
1636
+ if (isset($vives_form)) {
1637
+ $vives_form = $vives_form + 1;
1638
+ $wpdb->update($wpdb->prefix . "formmaker_views", array(
1639
+ 'views' => $vives_form,
1640
+ ), array('form_id' => $id), array(
1641
+ '%d',
1642
+ ), array('%d'));
1643
+ }
1644
+ else {
1645
+ $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
1646
+ 'form_id' => $id,
1647
+ 'views' => 1
1648
+ ), array(
1649
+ '%d',
1650
+ '%d'
1651
+ ));
1652
+ }
1653
+ }
1654
+
1655
+ public function gen_mail($counter, $all_files, $id, $str) {
1656
+ // checking save uploads option
1657
+ global $wpdb;
1658
+ $save_uploads = $wpdb->get_var("SELECT save_uploads FROM " . $wpdb->prefix ."formmaker WHERE id=" . $id);
1659
+ if($save_uploads == 0){
1660
+ $destination = 'wp-content/uploads/tmpAddon';
1661
+ if(!file_exists($destination))
1662
+ mkdir($destination , 0777);
1663
+
1664
+ foreach($all_files as &$all_file){
1665
+ $fileTemp = $all_file['tmp_name'];
1666
+ $fileName = $all_file['name'];
1667
+ if(!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
1668
+ echo "<script> alert('" . addslashes(__('Error, file cannot be moved.', 'form_maker')) . "');</script>";
1669
+ return array($max+1);
1670
+ }
1671
+
1672
+ $all_file['tmp_name'] = $destination . "/" . $fileName;
1673
+ }
1674
+ }
1675
+ $ip = $_SERVER['REMOTE_ADDR'];
1676
+ $replyto = '';
1677
+ global $wpdb;
1678
+ $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $id));
1679
+ if (!$row->form_front) {
1680
+ $id = '';
1681
+ }
1682
+
1683
+ $custom_fields = array('ip', 'useremail', 'username', 'subid', 'all' );
1684
+ $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
1685
+
1686
+ $current_user = wp_get_current_user();
1687
+ if ($current_user->ID != 0)
1688
+ {
1689
+ $username = $current_user->display_name;
1690
+ $useremail = $current_user->user_email;
1691
+ }
1692
+ else
1693
+ {
1694
+ $username = '';
1695
+ $useremail = '';
1696
+ }
1697
+
1698
+ $label_order_original = array();
1699
+ $label_order_ids = array();
1700
+ $label_label = array();
1701
+ $label_type = array();
1702
+ $total = 0;
1703
+ $form_currency = '$';
1704
+ $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
1705
+ $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
1706
+ if ($row->payment_currency) {
1707
+ $form_currency = $currency_sign[array_search($row->payment_currency, $currency_code)];
1708
+ }
1709
+
1710
+ $old = false;
1711
+ if(isset($row->form)) {
1712
+ $old = true;
1713
+ }
1714
+
1715
+ $cc = array();
1716
+ $row_mail_one_time = 1;
1717
+ $label_type = array();
1718
+
1719
+ if($old == false || ($old == true && $row->form == '')) {
1720
+ $label_all = explode('#****#',$row->label_order_current);
1721
+ }
1722
+ else {
1723
+ $label_all = explode('#****#',$row->label_order);
1724
+ }
1725
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
1726
+ foreach ($label_all as $key => $label_each) {
1727
+ $label_id_each = explode('#**id**#', $label_each);
1728
+ $label_id = $label_id_each[0];
1729
+ array_push($label_order_ids, $label_id);
1730
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
1731
+ $label_order_original[$label_id] = $label_order_each[0];
1732
+ $label_type[$label_id] = $label_order_each[1];
1733
+ array_push($label_label, $label_order_each[0]);
1734
+ array_push($label_type, $label_order_each[1]);
1735
+ }
1736
+
1737
+ $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
1738
+ $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
1739
+
1740
+ $list='<table border="1" cellpadding="3" cellspacing="0" style="width:600px;">';
1741
+ $list_text_mode = '';
1742
+ if($old == false || ($old == true && $row->form == '')) {
1743
+ foreach($label_order_ids as $key => $label_order_id) {
1744
+ $i = $label_order_id;
1745
+ $type = $label_type[$i];
1746
+
1747
+ if($type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button") {
1748
+ $element_label=$label_order_original[$i];
1749
+ if(!in_array($i,$disabled_fields)) {
1750
+ switch ($type) {
1751
+ case 'type_text':
1752
+ case 'type_password':
1753
+ case 'type_textarea':
1754
+ case "type_date":
1755
+ case "type_own_select":
1756
+ case "type_country":
1757
+ case "type_number": {
1758
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
1759
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1760
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
1761
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1762
+ }
1763
+
1764
+ break;
1765
+ }
1766
+ case "type_hidden": {
1767
+ $element = isset($_POST[$element_label]) ? $_POST[$element_label] : NULL;
1768
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1769
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
1770
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1771
+ }
1772
+ break;
1773
+ }
1774
+ case "type_mark_map": {
1775
+ $element = isset($_POST['wdform_'.$i."_long".$id]) ? $_POST['wdform_'.$i."_long".$id] : NULL;
1776
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1777
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "") . '</td></tr>';
1778
+ $list_text_mode=$list_text_mode.$element_label.' - Longitude:'.$element.' Latitude:'.(isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "")."\r\n";
1779
+ }
1780
+ break;
1781
+ }
1782
+ case "type_submitter_mail": {
1783
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
1784
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1785
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
1786
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1787
+ }
1788
+ break;
1789
+ }
1790
+
1791
+ case "type_time": {
1792
+ $hh = isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : NULL;
1793
+ if(isset($hh) && ($this->empty_field($hh, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_mm".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_ss".$id], $row->mail_emptyfields))) {
1794
+ $ss = isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : NULL;
1795
+ if(isset($ss)) {
1796
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "") . ':' . $ss;
1797
+ $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "").':'.$ss;
1798
+ }
1799
+ else {
1800
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
1801
+ $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
1802
+ }
1803
+ $am_pm = isset($_POST['wdform_'.$i."_am_pm".$id]) ? $_POST['wdform_'.$i."_am_pm".$id] : NULL;
1804
+ if(isset($am_pm)) {
1805
+ $list = $list . ' ' . $am_pm . '</td></tr>';
1806
+ $list_text_mode=$list_text_mode.$am_pm."\r\n";
1807
+ }
1808
+ else {
1809
+ $list = $list.'</td></tr>';
1810
+ $list_text_mode=$list_text_mode."\r\n";
1811
+ }
1812
+ }
1813
+ break;
1814
+ }
1815
+
1816
+ case "type_phone": {
1817
+ $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
1818
+ if(isset($element_first) && $this->empty_field($element_first, $row->mail_emptyfields)) {
1819
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
1820
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
1821
+ }
1822
+ break;
1823
+ }
1824
+
1825
+ case "type_name": {
1826
+ $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
1827
+ if(isset($element_first)) {
1828
+ $element_title = isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : NULL;
1829
+ $element_middle = isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : NULL;
1830
+ if((isset($element_title) || isset($element_middle)) && ($this->empty_field($element_title, $row->mail_emptyfields) || $this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_middle".$id], $row->mail_emptyfields))) {
1831
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . (isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '') . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "") . '</td></tr>';
1832
+ $list_text_mode=$list_text_mode.$element_label.' - '.(isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '').' '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "").' '.(isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "")."\r\n";
1833
+ }
1834
+ else {
1835
+ if($this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields)) {
1836
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
1837
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
1838
+ }
1839
+ }
1840
+ }
1841
+ break;
1842
+ }
1843
+
1844
+ case "type_address": {
1845
+ $element = isset($_POST['wdform_'.$i."_street1".$id]) ? $_POST['wdform_'.$i."_street1".$id] : NULL;
1846
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1847
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1848
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1849
+ break;
1850
+ }
1851
+ $element = isset($_POST['wdform_'.$i."_street2".$id]) ? $_POST['wdform_'.$i."_street2".$id] : NULL;
1852
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1853
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1854
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1855
+ break;
1856
+ }
1857
+ $element = isset($_POST['wdform_'.$i."_city".$id]) ? $_POST['wdform_'.$i."_city".$id] : NULL;
1858
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1859
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1860
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1861
+ break;
1862
+ }
1863
+ $element = isset($_POST['wdform_'.$i."_state".$id]) ? $_POST['wdform_'.$i."_state".$id] : NULL;
1864
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1865
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1866
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1867
+ break;
1868
+ }
1869
+ $element = isset($_POST['wdform_'.$i."_postal".$id]) ? $_POST['wdform_'.$i."_postal".$id] : NULL;
1870
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1871
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1872
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1873
+ break;
1874
+ }
1875
+ $element = isset($_POST['wdform_'.$i."_country".$id]) ? $_POST['wdform_'.$i."_country".$id] : NULL;
1876
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1877
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
1878
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
1879
+ break;
1880
+ }
1881
+ break;
1882
+ }
1883
+
1884
+ case "type_date_fields": {
1885
+ $day = isset($_POST['wdform_'.$i."_day".$id]) ? $_POST['wdform_'.$i."_day".$id] : NULL;
1886
+ $month = isset($_POST['wdform_'.$i."_month".$id]) ? $_POST['wdform_'.$i."_month".$id] : "";
1887
+ $year = isset($_POST['wdform_'.$i."_year".$id]) ? $_POST['wdform_'.$i."_year".$id] : "";
1888
+ if(isset($day) && $this->empty_field($day, $row->mail_emptyfields)) {
1889
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' .(($day || $month || $year) ? $day . '-' . $month . '-' . $year : '' ). '</td></tr>';
1890
+ $list_text_mode=$list_text_mode.$element_label.(($day || $month || $year) ? $day.'-'.$month.'-'.$year : '')."\r\n";
1891
+ }
1892
+ break;
1893
+ }
1894
+
1895
+ case "type_radio": {
1896
+ $element = isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL;
1897
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1898
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
1899
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1900
+ break;
1901
+ }
1902
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
1903
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
1904
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
1905
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
1906
+ }
1907
+ break;
1908
+ }
1909
+
1910
+ case "type_checkbox": {
1911
+ $start = -1;
1912
+ for($j = 0; $j < 100; $j++) {
1913
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
1914
+ if(isset($element)) {
1915
+ $start = $j;
1916
+ break;
1917
+ }
1918
+ }
1919
+ $other_element_id = -1;
1920
+ $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
1921
+ if($is_other == "yes") {
1922
+ $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
1923
+ }
1924
+
1925
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
1926
+ {
1927
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
1928
+ $list_text_mode=$list_text_mode.$element_label.' - ';
1929
+ }
1930
+
1931
+ if($start != -1) {
1932
+ for($j = $start; $j < 100; $j++) {
1933
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
1934
+ if(isset($element)) {
1935
+ if($j == $other_element_id) {
1936
+ $list = $list . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '<br>';
1937
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "").', ';
1938
+ }
1939
+ else {
1940
+ $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "") . '<br>';
1941
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "").', ';
1942
+ }
1943
+ }
1944
+ }
1945
+ }
1946
+
1947
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
1948
+ {
1949
+ $list = $list . '</td></tr>';
1950
+ $list_text_mode=$list_text_mode."\r\n";
1951
+ }
1952
+ break;
1953
+ }
1954
+
1955
+ case "type_paypal_price": {
1956
+ $value = 0;
1957
+ if(isset($_POST['wdform_'.$i."_element_dollars".$id])) {
1958
+ $value = $_POST['wdform_'.$i."_element_dollars".$id];
1959
+ }
1960
+ if(isset($_POST['wdform_'.$i."_element_cents".$id]) && $_POST['wdform_'.$i."_element_cents".$id]) {
1961
+ $value = $value . '.' . $_POST['wdform_'.$i."_element_cents".$id];
1962
+ }
1963
+
1964
+ if($this->empty_field($value, $row->mail_emptyfields) && $value!='.')
1965
+ {
1966
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . $form_currency . '</td></tr>';
1967
+ $list_text_mode=$list_text_mode.$element_label.' - '.$value.$form_currency."\r\n";
1968
+ }
1969
+ break;
1970
+ }
1971
+
1972
+ case "type_paypal_select": {
1973
+ if(isset($_POST['wdform_'.$i."_element_label".$id]) && $_POST['wdform_'.$i."_element".$id] != '') {
1974
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
1975
+ }
1976
+ else {
1977
+ $value='';
1978
+ }
1979
+ $element_quantity_label = (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) && $_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
1980
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
1981
+ if($value != '' && isset($element_quantity)) {
1982
+ $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
1983
+ }
1984
+ for($k = 0; $k < 50; $k++) {
1985
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
1986
+ if(isset($temp_val)) {
1987
+ $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
1988
+ }
1989
+ }
1990
+
1991
+ if($this->empty_field($value, $row->mail_emptyfields))
1992
+ {
1993
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
1994
+ $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
1995
+ }
1996
+ break;
1997
+ }
1998
+
1999
+ case "type_paypal_radio": {
2000
+ if(isset($_POST['wdform_'.$i."_element".$id])) {
2001
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
2002
+
2003
+ $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2004
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2005
+ if (isset($element_quantity)) {
2006
+ $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2007
+ }
2008
+ for($k = 0; $k < 50; $k++) {
2009
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
2010
+ if(isset($temp_val)) {
2011
+ $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2012
+ }
2013
+ }
2014
+ }
2015
+ else {
2016
+ $value='';
2017
+ }
2018
+
2019
+ if($this->empty_field($value, $row->mail_emptyfields))
2020
+ {
2021
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2022
+ $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
2023
+ }
2024
+ break;
2025
+ }
2026
+
2027
+ case "type_paypal_shipping": {
2028
+ if(isset($_POST['wdform_'.$i."_element".$id])) {
2029
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "") . $form_currency;
2030
+
2031
+ if($this->empty_field($value, $row->mail_emptyfields))
2032
+ {
2033
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2034
+ $list_text_mode=$list_text_mode.$element_label.' - '.$value."\r\n";
2035
+ }
2036
+ }
2037
+ else {
2038
+ $value='';
2039
+ }
2040
+
2041
+ break;
2042
+ }
2043
+
2044
+ case "type_paypal_checkbox": {
2045
+
2046
+ $start = -1;
2047
+ for($j = 0; $j < 100; $j++) {
2048
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2049
+ if(isset($element)) {
2050
+ $start=$j;
2051
+ break;
2052
+ }
2053
+ }
2054
+
2055
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2056
+ {
2057
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2058
+ $list_text_mode=$list_text_mode.$element_label.' - ';
2059
+ }
2060
+ if($start!=-1) {
2061
+ for($j = $start; $j < 100; $j++) {
2062
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2063
+ if(isset($element)) {
2064
+ $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "") . ' - ' . ($element == '' ? '0' . $form_currency : $element) . $form_currency . '<br>';
2065
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "").' - '.($element == '' ? '0' . $form_currency : $element).$form_currency.', ';
2066
+ }
2067
+ }
2068
+ }
2069
+ $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2070
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2071
+ if (isset($element_quantity)) {
2072
+ $list = $list . '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2073
+ $list_text_mode=$list_text_mode.$element_quantity_label . ': ' . $element_quantity.', ';
2074
+ }
2075
+ for($k = 0; $k < 50; $k++) {
2076
+ $temp_val = isset($_POST['wdform_'.$i."_element_property_value".$id.$k]) ? $_POST['wdform_'.$i."_element_property_value".$id.$k] : NULL;
2077
+ if(isset($temp_val)) {
2078
+ $list = $list . '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2079
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val.', ';
2080
+ }
2081
+ }
2082
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2083
+ {
2084
+ $list = $list . '</td></tr>';
2085
+ $list_text_mode=$list_text_mode."\r\n";
2086
+ }
2087
+ break;
2088
+ }
2089
+
2090
+ case "type_paypal_total": {
2091
+ $element = isset($_POST['wdform_'.$i."_paypal_total".$id]) ? $_POST['wdform_'.$i."_paypal_total".$id] : "";
2092
+ if($this->empty_field($element, $row->mail_emptyfields))
2093
+ {
2094
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2095
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2096
+ }
2097
+ break;
2098
+ }
2099
+
2100
+ case "type_star_rating": {
2101
+ $element = isset($_POST['wdform_'.$i."_star_amount".$id]) ? $_POST['wdform_'.$i."_star_amount".$id] : NULL;
2102
+ $selected = isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : 0;
2103
+ if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2104
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2105
+ $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2106
+ }
2107
+ break;
2108
+ }
2109
+
2110
+ case "type_scale_rating": {
2111
+ $element = isset($_POST['wdform_'.$i."_scale_amount".$id]) ? $_POST['wdform_'.$i."_scale_amount".$id] : NULL;
2112
+ $selected = isset($_POST['wdform_'.$i."_scale_radio".$id]) ? $_POST['wdform_'.$i."_scale_radio".$id] : 0;
2113
+ if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2114
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2115
+ $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2116
+ }
2117
+ break;
2118
+ }
2119
+
2120
+ case "type_spinner": {
2121
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2122
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2123
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2124
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2125
+ }
2126
+ break;
2127
+ }
2128
+
2129
+ case "type_slider": {
2130
+ $element = isset($_POST['wdform_'.$i."_slider_value".$id]) ? $_POST['wdform_'.$i."_slider_value".$id] : NULL;
2131
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2132
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2133
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2134
+ }
2135
+ break;
2136
+ }
2137
+
2138
+ case "type_range": {
2139
+ $element0 = isset($_POST['wdform_'.$i."_element".$id.'0']) ? $_POST['wdform_'.$i."_element".$id.'0'] : NULL;
2140
+ $element1 = isset($_POST['wdform_'.$i."_element".$id.'1']) ? $_POST['wdform_'.$i."_element".$id.'1'] : NULL;
2141
+ if((isset($element0) && $this->empty_field($element0, $row->mail_emptyfields)) || (isset($element1) && $this->empty_field($element1, $row->mail_emptyfields))) {
2142
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >From:' . $element0 . '<span style="margin-left:6px">To</span>:' . $element1 . '</td></tr>';
2143
+ $list_text_mode=$list_text_mode.$element_label.' - From:'.$element0.' To:'.$element1."\r\n";
2144
+ }
2145
+ break;
2146
+ }
2147
+
2148
+ case "type_grading": {
2149
+ $element = isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "";
2150
+ $grading = explode(":", $element);
2151
+ $items_count = sizeof($grading) - 1;
2152
+ $element = "";
2153
+ $total = "";
2154
+ $form_empty_field = 1;
2155
+ for($k = 0;$k < $items_count; $k++) {
2156
+ $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : "") . " ";
2157
+ $total += (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : 0);
2158
+ if(isset($_POST['wdform_'.$i."_element".$id.'_'.$k]))
2159
+ $form_empty_field = 0;
2160
+ }
2161
+ $element .= "Total:" . $total;
2162
+ if(isset($element) && $this->empty_field($form_empty_field, $row->mail_emptyfields)) {
2163
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2164
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2165
+ }
2166
+ break;
2167
+ }
2168
+
2169
+ case "type_matrix": {
2170
+ $input_type = isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : "";
2171
+ $mat_rows = explode("***", isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "");
2172
+ $rows_count = sizeof($mat_rows) - 1;
2173
+ $mat_columns = explode("***", isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "");
2174
+ $columns_count = sizeof($mat_columns) - 1;
2175
+ $matrix = "<table>";
2176
+ $matrix .= '<tr><td></td>';
2177
+ for($k = 1; $k < count($mat_columns); $k++) {
2178
+ $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
2179
+ }
2180
+ $matrix .= '</tr>';
2181
+ $aaa = Array();
2182
+ for($k = 1; $k <= $rows_count; $k++) {
2183
+ $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
2184
+ if($input_type == "radio") {
2185
+ $mat_radio = isset($_POST['wdform_'.$i."_input_element".$id.$k]) ? $_POST['wdform_'.$i."_input_element".$id.$k] : 0;
2186
+ if($mat_radio == 0) {
2187
+ $checked = "";
2188
+ $aaa[1] = "";
2189
+ }
2190
+ else {
2191
+ $aaa = explode("_", $mat_radio);
2192
+ }
2193
+ for($j = 1; $j <= $columns_count; $j++) {
2194
+ if($aaa[1] == $j) {
2195
+ $checked = "checked";
2196
+ }
2197
+ else {
2198
+ $checked = "";
2199
+ }
2200
+ $matrix .= '<td style="text-align:center"><input type="radio" ' . $checked . ' disabled /></td>';
2201
+ }
2202
+ }
2203
+ else {
2204
+ if($input_type == "checkbox") {
2205
+ for($j = 1; $j <= $columns_count; $j++) {
2206
+ $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : "";
2207
+ if($checked == 1) {
2208
+ $checked = "checked";
2209
+ }
2210
+ else {
2211
+ $checked = "";
2212
+ }
2213
+ $matrix .= '<td style="text-align:center"><input type="checkbox" ' . $checked . ' disabled /></td>';
2214
+ }
2215
+ }
2216
+ else {
2217
+ if($input_type == "text") {
2218
+ for($j = 1; $j <= $columns_count; $j++) {
2219
+ $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : "";
2220
+ $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
2221
+ }
2222
+ }
2223
+ else {
2224
+ for($j = 1; $j <= $columns_count; $j++) {
2225
+ $checked = isset($_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j] : "";
2226
+ $matrix .= '<td style="text-align:center">' . $checked . '</td>';
2227
+ }
2228
+ }
2229
+ }
2230
+ }
2231
+ $matrix .= '</tr>';
2232
+ }
2233
+ $matrix .= '</table>';
2234
+ if(isset($matrix)) {
2235
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $matrix . '</td></tr>';
2236
+ }
2237
+ break;
2238
+ }
2239
+ default: break;
2240
+ }
2241
+ }
2242
+ }
2243
+ }
2244
+
2245
+ $list = $list . '</table>';
2246
+ if($row->sendemail) {
2247
+ $fromname = $row->mail_from_name_user;
2248
+ if($row->mail_subject_user)
2249
+ $subject = $row->mail_subject_user;
2250
+ else
2251
+ $subject = $row->title;
2252
+ if($row->reply_to_user) {
2253
+ $replyto = $row->reply_to_user;
2254
+ }
2255
+ $attachment_user = array();
2256
+ if ($row->mail_attachment_user) {
2257
+ for ($k = 0; $k < count($all_files); $k++) {
2258
+ if (isset($all_files[$k]['tmp_name'])) {
2259
+ $attachment_user[$k] = $all_files[$k]['tmp_name'];
2260
+ }
2261
+ }
2262
+ }
2263
+
2264
+ if ($row->mail_mode_user) {
2265
+ $content_type = "text/html";
2266
+ $mode = 1;
2267
+ $list_user = wordwrap($list, 70, "\n", true);
2268
+ $new_script = wpautop($row->script_mail_user);
2269
+ }
2270
+ else {
2271
+ $content_type = "text/plain";
2272
+ $mode = 0;
2273
+ $list_user = wordwrap($list_text_mode, 1000, "\n", true);
2274
+ $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail_user);
2275
+ }
2276
+
2277
+ foreach($label_order_original as $key => $label_each) {
2278
+ $type=$label_type[$key];
2279
+ $key1 = $type == 'type_hidden' ? $label_each : $key;
2280
+ if(strpos($row->script_mail_user, "%".$label_each."%")>-1) {
2281
+ $new_value = $this->custom_fields_mail($type, $key1, $id, $attachment_user, '');
2282
+ $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
2283
+ }
2284
+
2285
+ if(strpos($fromname, "%".$label_each."%")>-1) {
2286
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2287
+ if(substr($new_value, -2)==', ') {
2288
+ $new_value = substr($new_value, 0, -2);
2289
+ }
2290
+ $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
2291
+ }
2292
+
2293
+ if(strpos($subject, "%".$label_each."%")>-1) {
2294
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2295
+ if(substr($new_value, -2)==', ') {
2296
+ $new_value = substr($new_value, 0, -2);
2297
+ }
2298
+ $subject = str_replace("%".$label_each."%", $new_value, $subject);
2299
+ }
2300
+ }
2301
+
2302
+ $recipient = '';
2303
+ $cca = $row->mail_cc_user;
2304
+ $bcc = $row->mail_bcc_user;
2305
+ if ($row->mail_from_user != '') {
2306
+ if ($fromname != '') {
2307
+ $from = "From: '" . $fromname . "' <" . $row->mail_from_user . ">" . "\r\n";
2308
+ }
2309
+ else {
2310
+ $from = "From: '' <" . $row->mail_from_user . ">" . "\r\n";
2311
+ }
2312
+ }
2313
+ else {
2314
+ $from = '';
2315
+ }
2316
+
2317
+ $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
2318
+ if ($replyto) {
2319
+ $headers .= "Reply-To: <" . $replyto . ">\r\n";
2320
+ }
2321
+ if ($cca) {
2322
+ $headers .= "Cc: <" . $cca . ">\r\n";
2323
+ }
2324
+ if ($bcc) {
2325
+ $headers .= "Bcc: <" . $bcc . ">\r\n";
2326
+ }
2327
+
2328
+ $custom_fields_value = array( $ip, $useremail, $username, $subid, $list_user );
2329
+ foreach($custom_fields as $key=>$custom_field)
2330
+ {
2331
+ if(strpos($new_script, "%".$custom_field."%")>-1)
2332
+ $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
2333
+
2334
+ if($key==2 || $key==3)
2335
+ {
2336
+ if(strpos($fromname, "%".$custom_field."%")>-1)
2337
+ $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
2338
+
2339
+ if(strpos($subject, "%".$custom_field."%")>-1)
2340
+ $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
2341
+ }
2342
+ }
2343
+ $body = $new_script;
2344
+ $GLOBALS['attachment_user'] = array();
2345
+ $GLOBALS['attachment'] = array();
2346
+ if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
2347
+ $_GET['addon_task'] = 'frontend';
2348
+ $_GET['form_id'] = $id;
2349
+ $_GET['form_currency'] = $form_currency;
2350
+ $GLOBALS['custom_fields_value'] = $custom_fields_value;
2351
+ do_action('WD_FM_PDF_init');
2352
+ }
2353
+ if(!empty($GLOBALS['attachment_user']))
2354
+ array_push($attachment_user, $GLOBALS['attachment_user']);
2355
+
2356
+ if($row->send_to) {
2357
+ $send_tos = explode('**',$row->send_to);
2358
+ $send_copy = isset($_POST["wdform_send_copy_".$id]) ? $_POST["wdform_send_copy_".$id] : NULL;
2359
+ if(isset($send_copy)) {
2360
+ $send=true;
2361
+ }
2362
+ else {
2363
+ $mail_verification_post_id = (int)$wpdb->get_var($wpdb->prepare('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
2364
+ $verification_link = get_post( $mail_verification_post_id );
2365
+ foreach($send_tos as $index => $send_to) {
2366
+ $recipient = isset($_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id]) ? $_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id] : NULL;
2367
+ if(strpos($new_script, "%Verification link%")>-1 && $verification_link !== NULL) {
2368
+ $ver_link = $row->mail_mode_user ? "<a href =".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id)).">".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id))."</a><br/>" : add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id));
2369
+
2370
+ $body = $row->mail_verify ? str_replace("%Verification link%", $ver_link, $new_script) : str_replace("%Verification link%", '', $new_script);
2371
+ }
2372
+
2373
+ if($recipient) {
2374
+ $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment_user);
2375
+ }
2376
+ }
2377
+ }
2378
+ }
2379
+ }
2380
+
2381
+ if($row->sendemail) {
2382
+ if($row->reply_to) {
2383
+ $replyto = isset($_POST['wdform_'.$row->reply_to."_element".$id]) ? $_POST['wdform_'.$row->reply_to."_element".$id] : NULL;
2384
+ if(!isset($replyto)) {
2385
+ $replyto = $row->reply_to;
2386
+ }
2387
+ }
2388
+ $recipient = $row->mail;
2389
+ if($row->mail_subject) {
2390
+ $subject = $row->mail_subject;
2391
+ }
2392
+ else {
2393
+ $subject = $row->title;
2394
+ }
2395
+
2396
+ if ($row->from_name) {
2397
+ $fromname = $row->from_name;
2398
+ }
2399
+ else {
2400
+ $fromname = '';
2401
+ }
2402
+ $attachment = array();
2403
+ if ($row->mail_attachment) {
2404
+ for ($k = 0; $k < count($all_files); $k++) {
2405
+ if (isset($all_files[$k]['tmp_name'])) {
2406
+ $attachment[$k] = $all_files[$k]['tmp_name'];
2407
+ }
2408
+ }
2409
+ }
2410
+ if(!empty($GLOBALS['attachment']))
2411
+ array_push($attachment, $GLOBALS['attachment']);
2412
+
2413
+
2414
+ if ($row->mail_mode) {
2415
+ $content_type = "text/html";
2416
+ $mode = 1;
2417
+ $list = wordwrap($list, 70, "\n", true);
2418
+ $new_script = wpautop($row->script_mail);
2419
+ }
2420
+ else {
2421
+ $content_type = "text/plain";
2422
+ $mode = 0;
2423
+ $list = $list_text_mode;
2424
+ $list = wordwrap($list, 1000, "\n", true);
2425
+ $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail);
2426
+ }
2427
+
2428
+ foreach($label_order_original as $key => $label_each) {
2429
+ $type=$label_type[$key];
2430
+ $key1 = $type == 'type_hidden' ? $label_each : $key;
2431
+ if(strpos($row->script_mail, "%".$label_each."%")>-1) {
2432
+ $new_value = $this->custom_fields_mail($type, $key1, $id, $attachment, '');
2433
+ $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
2434
+ }
2435
+
2436
+ if(strpos($fromname, "%".$label_each."%")>-1) {
2437
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2438
+ if(substr($new_value, -2)==', ') {
2439
+ $new_value = substr($new_value, 0, -2);
2440
+ }
2441
+ $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
2442
+ }
2443
+
2444
+ if(strpos($fromname, "%username%")>-1){
2445
+ $fromname = str_replace("%username%", $username, $fromname);
2446
+ }
2447
+
2448
+ if(strpos($subject, "%".$label_each."%")>-1) {
2449
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
2450
+ if(substr($new_value, -2)==', ') {
2451
+ $new_value = substr($new_value, 0, -2);
2452
+ }
2453
+ $subject = str_replace("%".$label_each."%", $new_value, $subject);
2454
+ }
2455
+ }
2456
+
2457
+ if ($row->from_mail) {
2458
+ $from = isset($_POST['wdform_'.$row->from_mail."_element".$id]) ? $_POST['wdform_'.$row->from_mail."_element".$id] : NULL;
2459
+ if (!isset($from)) {
2460
+ $from = $row->from_mail;
2461
+ }
2462
+ $from = "From: '" . $fromname . "' <" . $from . ">" . "\r\n";
2463
+ }
2464
+ else {
2465
+ $from = "";
2466
+ }
2467
+
2468
+ $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
2469
+ if ($replyto) {
2470
+ $headers .= "Reply-To: <" . $replyto . ">\r\n";
2471
+ }
2472
+ $cca = $row->mail_cc;
2473
+ $bcc = $row->mail_bcc;
2474
+ if ($cca) {
2475
+ $headers .= "Cc: <" . $cca . ">\r\n";
2476
+ }
2477
+ if ($bcc) {
2478
+ $headers .= "Bcc: <" . $bcc . ">\r\n";
2479
+ }
2480
+
2481
+ $custom_fields_value = array( $ip, $useremail, $username, $subid, $list );
2482
+ foreach($custom_fields as $key=>$custom_field)
2483
+ {
2484
+ if(strpos($new_script, "%".$custom_field."%")>-1)
2485
+ $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
2486
+
2487
+ if($key==2 || $key==3)
2488
+ {
2489
+ if(strpos($fromname, "%".$custom_field."%")>-1)
2490
+ $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
2491
+
2492
+ if(strpos($subject, "%".$custom_field."%")>-1)
2493
+ $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
2494
+ }
2495
+ }
2496
+ $admin_body = $new_script;
2497
+ if($recipient) {
2498
+ $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($admin_body), $headers, $attachment);
2499
+ }
2500
+ }
2501
+
2502
+ $_SESSION['error_or_no' . $id] = 0;
2503
+ $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
2504
+ $succes = 1;
2505
+
2506
+ if($row->sendemail)
2507
+ if($row->mail || $row->send_to) {
2508
+ if ($send) {
2509
+ if ($send !== true ) {
2510
+ $_SESSION['error_or_no' . $id] = 1;
2511
+ $msg = addslashes(__('Error, email was not sent.', 'form_maker'));
2512
+ $succes = 0;
2513
+ }
2514
+ else {
2515
+ $_SESSION['error_or_no' . $id] = 0;
2516
+ $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
2517
+ }
2518
+ }
2519
+ }
2520
+
2521
+ $fm_email_params = $row->sendemail ? array('admin_body' => $admin_body, 'body' => $body, 'subject' => $subject, 'headers' => $headers, 'attachment' => $attachment, 'attachment_user' => $attachment_user) : array();
2522
+
2523
+ $addons = array('WD_FM_EMAIL_COND' => 'Email Conditions');
2524
+ $addons_array = array();
2525
+ foreach($addons as $addon => $addon_name) {
2526
+ if (defined($addon) && is_plugin_active(constant($addon))) {
2527
+ $_GET['addon_task'] = 'frontend';
2528
+ $_GET['form_id'] = $id;
2529
+ $GLOBALS['fm_email_params'] = $fm_email_params;
2530
+ $GLOBALS['form_currency'] = $form_currency;
2531
+ $GLOBALS['custom_fields_value'] = isset($custom_fields_value) ? $custom_fields_value : array();
2532
+ do_action($addon.'_init');
2533
+ }
2534
+ }
2535
+ }
2536
+ else { /* Old form.*/
2537
+ foreach ($label_order_ids as $key => $label_order_id) {
2538
+ $i = $label_order_id;
2539
+ $type = $_POST[$i . "_type" . $id];
2540
+ if (isset($_POST[$i . "_type" . $id]))
2541
+ if ($type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button") {
2542
+ $element_label = $label_order_original[$i];
2543
+ switch ($type) {
2544
+ case 'type_text':
2545
+ case 'type_password':
2546
+ case 'type_textarea':
2547
+ case "type_date":
2548
+ case "type_own_select":
2549
+ case "type_country":
2550
+ case "type_number":
2551
+ {
2552
+ $element = $_POST[$i . "_element" . $id];
2553
+ if (isset($_POST[$i . "_element" . $id])) {
2554
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2555
+ }
2556
+ break;
2557
+ }
2558
+ case "type_hidden": {
2559
+ $element = $_POST[$element_label];
2560
+ if (isset($element)) {
2561
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2562
+ }
2563
+ break;
2564
+ }
2565
+ case "type_submitter_mail":
2566
+ {
2567
+ $element = $_POST[$i . "_element" . $id];
2568
+ if (isset($_POST[$i . "_element" . $id])) {
2569
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2570
+ if ($_POST[$i . "_send" . $id] == "yes")
2571
+ array_push($cc, $element);
2572
+ }
2573
+ break;
2574
+ }
2575
+ case "type_time":
2576
+ {
2577
+ $hh = $_POST[$i . "_hh" . $id];
2578
+ if (isset($_POST[$i . "_hh" . $id])) {
2579
+ $ss = $_POST[$i . "_ss" . $id];
2580
+ if (isset($_POST[$i . "_ss" . $id]))
2581
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_hh" . $id] . ':' . $_POST[$i . "_mm" . $id] . ':' . $_POST[$i . "_ss" . $id];
2582
+ else
2583
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_hh" . $id] . ':' . $_POST[$i . "_mm" . $id];
2584
+ $am_pm = $_POST[$i . "_am_pm" . $id];
2585
+ if (isset($_POST[$i . "_am_pm" . $id]))
2586
+ $list = $list . ' ' . $_POST[$i . "_am_pm" . $id] . '</td></tr>';
2587
+ else
2588
+ $list = $list . '</td></tr>';
2589
+ }
2590
+ break;
2591
+ }
2592
+ case "type_phone":
2593
+ {
2594
+ $element_first = $_POST[$i . "_element_first" . $id];
2595
+ if (isset($_POST[$i . "_element_first" . $id])) {
2596
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_element_first" . $id] . ' ' . $_POST[$i . "_element_last" . $id] . '</td></tr>';
2597
+ }
2598
+ break;
2599
+ }
2600
+ case "type_name":
2601
+ {
2602
+ $element_first = $_POST[$i . "_element_first" . $id];
2603
+ if (isset($_POST[$i . "_element_first" . $id])) {
2604
+ $element_title = $_POST[$i . "_element_title" . $id];
2605
+ if (isset($_POST[$i . "_element_title" . $id]))
2606
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_element_title" . $id] . ' ' . $_POST[$i . "_element_first" . $id] . ' ' . $_POST[$i . "_element_last" . $id] . ' ' . $_POST[$i . "_element_middle" . $id] . '</td></tr>';
2607
+ else
2608
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_element_first" . $id] . ' ' . $_POST[$i . "_element_last" . $id] . '</td></tr>';
2609
+ }
2610
+ break;
2611
+ }
2612
+ case "type_mark_map":
2613
+ {
2614
+ if (isset($_POST[$i . "_long" . $id])) {
2615
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >Longitude:' . $_POST[$i . "_long" . $id] . '<br/>Latitude:' . $_POST[$i . "_lat" . $id] . '</td></tr>';
2616
+ }
2617
+ break;
2618
+ }
2619
+ case "type_address":
2620
+ {
2621
+ if (isset($_POST[$i . "_street1" . $id]))
2622
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_street1" . $id] . '</td></tr>';
2623
+ $i++;
2624
+ if (isset($_POST[$i."_street2".$id]))
2625
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_street2" . $id] . '</td></tr>';
2626
+ $i++;
2627
+ if (isset($_POST[$i."_city".$id]))
2628
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_city" . $id] . '</td></tr>';
2629
+ $i++;
2630
+ if (isset($_POST[$i."_state".$id]))
2631
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_state" . $id] . '</td></tr>';
2632
+ $i++;
2633
+ if (isset($_POST[$i."_postal".$id]))
2634
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_postal" . $id] . '</td></tr>';
2635
+ $i++;
2636
+ if (isset($_POST[$i."_country".$id]))
2637
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $_POST[$i . "_country" . $id] . '</td></tr>';
2638
+ $i++;
2639
+ break;
2640
+ }
2641
+ case "type_date_fields":
2642
+ {
2643
+ $day = $_POST[$i . "_day" . $id];
2644
+ if (isset($_POST[$i . "_day" . $id])) {
2645
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_day" . $id] . '-' . $_POST[$i . "_month" . $id] . '-' . $_POST[$i . "_year" . $id] . '</td></tr>';
2646
+ }
2647
+ break;
2648
+ }
2649
+ case "type_radio":
2650
+ {
2651
+ $element = $_POST[$i . "_other_input" . $id];
2652
+ if (isset($_POST[$i . "_other_input" . $id])) {
2653
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $_POST[$i . "_other_input" . $id] . '</td></tr>';
2654
+ break;
2655
+ }
2656
+ $element = $_POST[$i . "_element" . $id];
2657
+ if (isset($_POST[$i . "_element" . $id])) {
2658
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td ><pre style="margin:0px; padding:0px">' . $element . '</pre></td></tr>';
2659
+ }
2660
+ break;
2661
+ }
2662
+ case "type_checkbox":
2663
+ {
2664
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2665
+ $start = -1;
2666
+ for ($j = 0; $j < 100; $j++) {
2667
+ if (isset($_POST[$i . "_element" . $id . $j])) {
2668
+ $start = $j;
2669
+ break;
2670
+ }
2671
+ }
2672
+ $other_element_id = -1;
2673
+ $is_other = $_POST[$i . "_allow_other" . $id];
2674
+ if ($is_other == "yes") {
2675
+ $other_element_id = $_POST[$i . "_allow_other_num" . $id];
2676
+ }
2677
+ if ($start != -1) {
2678
+ for ($j = $start; $j < 100; $j++) {
2679
+ $element = $_POST[$i . "_element" . $id . $j];
2680
+ if (isset($_POST[$i . "_element" . $id . $j]))
2681
+ if ($j == $other_element_id) {
2682
+ $list = $list . $_POST[$i . "_other_input" . $id] . '<br>';
2683
+ }
2684
+ else
2685
+ $list = $list . $_POST[$i . "_element" . $id . $j] . '<br>';
2686
+ }
2687
+ $list = $list . '</td></tr>';
2688
+ }
2689
+ break;
2690
+ }
2691
+ case "type_paypal_price": {
2692
+ $value = 0;
2693
+ if ($_POST[$i."_element_dollars".$id]) {
2694
+ $value = $_POST[$i."_element_dollars".$id];
2695
+ }
2696
+ if ($_POST[$i."_element_cents".$id]) {
2697
+ $value = $value.'.'.$_POST[$i."_element_cents".$id];
2698
+ }
2699
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td >'.$value.$form_currency.'</td></tr>';
2700
+ break;
2701
+ }
2702
+ case "type_paypal_select": {
2703
+ $value = $_POST[$i."_element_label".$id].':'.$_POST[$i."_element".$id].$form_currency;
2704
+ $element_quantity_label = $_POST[$i."_element_quantity_label".$id];
2705
+ if (isset($element_quantity_label)) {
2706
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
2707
+ $value .= '<br/>'.$_POST[$i."_element_quantity_label".$id].': '.$quantity;
2708
+ }
2709
+ for ($k = 0; $k < 50; $k++) {
2710
+ $temp_val = $_POST[$i."_element_property_value".$id.$k];
2711
+ if (isset($temp_val)) {
2712
+ $value .= '<br/>'.$_POST[$i."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
2713
+ }
2714
+ }
2715
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$value.'</pre></td></tr>';
2716
+ break;
2717
+ }
2718
+ case "type_paypal_radio": {
2719
+ $value = $_POST[$i."_element_label".$id].' - '.$_POST[$i."_element".$id].$form_currency;
2720
+ $element_quantity_label = $_POST[$i."_element_quantity_label".$id];
2721
+ if (isset($element_quantity_label)) {
2722
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
2723
+ $value .= '<br/>' . $_POST[$i."_element_quantity_label".$id] . ': ' . $quantity;
2724
+ }
2725
+ for ($k = 0; $k < 50; $k++) {
2726
+ $temp_val = $_POST[$i."_element_property_value".$id.$k];
2727
+ if (isset($temp_val)) {
2728
+ $value .= '<br/>'.$_POST[$i."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
2729
+ }
2730
+ }
2731
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$value.'</pre></td></tr>';
2732
+ break;
2733
+ }
2734
+ case "type_paypal_shipping": {
2735
+ $value = $_POST[$i."_element_label".$id].' - '.$_POST[$i."_element".$id].$form_currency;
2736
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$value.'</pre></td></tr>';
2737
+ break;
2738
+ }
2739
+ case "type_paypal_checkbox": {
2740
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td >';
2741
+ $start = -1;
2742
+ for ($j = 0; $j < 100; $j++) {
2743
+ $element = $_POST[$i."_element".$id.$j];
2744
+ if (isset($element)) {
2745
+ $start = $j;
2746
+ break;
2747
+ }
2748
+ }
2749
+ if ($start != -1) {
2750
+ for ($j = $start; $j < 100; $j++) {
2751
+ $element = $_POST[$i."_element".$id.$j];
2752
+ if (isset($element)) {
2753
+ $list = $list.$_POST[$i."_element".$id.$j."_label"].' - '.($_POST[$i."_element".$id.$j]=='' ? '0'.$form_currency : $_POST[$i."_element".$id.$j]).$form_currency.'<br>';
2754
+ }
2755
+ }
2756
+ }
2757
+ $element_quantity_label = $_POST[$i."_element_quantity_label".$id];
2758
+ if (isset($element_quantity_label)) {
2759
+ $quantity = ((isset($_POST[$i . "_element_quantity" . $id]) && ($_POST[$i . "_element_quantity" . $id] >= 1)) ? $_POST[$i . "_element_quantity" . $id] : 1);
2760
+ $list = $list.'<br/>'.$_POST[$i."_element_quantity_label".$id].': '.$quantity;
2761
+ }
2762
+ for ($k = 0; $k < 50; $k++) {
2763
+ $temp_val = $_POST[$i."_element_property_value".$id.$k];
2764
+ if (isset($temp_val)) {
2765
+ $list = $list.'<br/>'.$_POST[$i."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
2766
+ }
2767
+ }
2768
+ $list = $list.'</td></tr>';
2769
+ break;
2770
+ }
2771
+ case "type_star_rating": {
2772
+ $selected = (isset($_POST[$i."_selected_star_amount".$id]) ? $_POST[$i."_selected_star_amount".$id] : 0);
2773
+ if (isset($_POST[$i."_star_amount".$id])) {
2774
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$selected.'/'.$_POST[$i."_star_amount".$id].'</pre></td></tr>';
2775
+ }
2776
+ break;
2777
+ }
2778
+ case "type_scale_rating": {
2779
+ $selected = (isset($_POST[$i."_scale_radio".$id]) ? $_POST[$i."_scale_radio".$id] : 0);
2780
+ if (isset($_POST[$i."_scale_amount".$id])) {
2781
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$selected.'/'.$_POST[$i."_scale_radio".$id].'</pre></td></tr>';
2782
+ }
2783
+ break;
2784
+ }
2785
+ case "type_spinner": {
2786
+ if (isset($_POST[$i."_element".$id])) {
2787
+ $list=$list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$_POST[$i."_element".$id].'</pre></td></tr>';
2788
+ }
2789
+ break;
2790
+ }
2791
+ case "type_slider": {
2792
+ if (isset($_POST[$i."_slider_value".$id])) {
2793
+ $list=$list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$_POST[$i."_slider_value".$id].'</pre></td></tr>';
2794
+ }
2795
+ break;
2796
+ }
2797
+ case "type_range": {
2798
+ if(isset($_POST[$i."_element".$id.'0']) || isset($_POST[$i."_element".$id.'1'])) {
2799
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">From:'.$_POST[$i."_element".$id.'0'].'<span style="margin-left:6px">To</span>:'.$_POST[$i."_element".$id.'1'].'</pre></td></tr>';
2800
+ }
2801
+ break;
2802
+ }
2803
+ case "type_grading": {
2804
+ if (isset($_POST[$i."_hidden_item".$id])) {
2805
+ $element = $_POST[$i."_hidden_item".$id];
2806
+ $grading = explode(":", $element);
2807
+ $items_count = sizeof($grading) - 1;
2808
+ $total = "";
2809
+ for ($k = 0; $k < $items_count; $k++) {
2810
+ if (isset($_POST[$i."_element".$id.$k])) {
2811
+ $element .= $grading[$k].":".$_POST[$i."_element".$id.$k]." ";
2812
+ $total += $_POST[$i."_element".$id.$k];
2813
+ }
2814
+ }
2815
+ $element .= "Total:".$total;
2816
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$element.'</pre></td></tr>';
2817
+ }
2818
+ break;
2819
+ }
2820
+ case "type_matrix": {
2821
+ $input_type=$_POST[$i."_input_type".$id];
2822
+ $mat_rows = $_POST[$i."_hidden_row".$id];
2823
+ $mat_rows = explode('***', $mat_rows);
2824
+ $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
2825
+ $mat_columns = $_POST[$i."_hidden_column".$id];
2826
+ $mat_columns = explode('***', $mat_columns);
2827
+ $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
2828
+ $row_ids=explode(",",substr($_POST[$i."_row_ids".$id], 0, -1));
2829
+ $column_ids=explode(",",substr($_POST[$i."_column_ids".$id], 0, -1));
2830
+ $matrix = "<table>";
2831
+ $matrix .= '<tr><td></td>';
2832
+ for ($k = 0; $k < count($mat_columns); $k++) {
2833
+ $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
2834
+ }
2835
+ $matrix .= '</tr>';
2836
+ $aaa = Array();
2837
+ $k = 0;
2838
+ foreach ($row_ids as $row_id) {
2839
+ $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
2840
+ if ($input_type=="radio") {
2841
+ $mat_radio = (isset($_POST[$i."_input_element".$id.$row_id]) ? $_POST[$i."_input_element".$id.$row_id] : 0);
2842
+ if ($mat_radio == 0) {
2843
+ $checked = "";
2844
+ $aaa[1] = "";
2845
+ }
2846
+ else {
2847
+ $aaa = explode("_", $mat_radio);
2848
+ }
2849
+ foreach ($column_ids as $column_id) {
2850
+ if ($aaa[1] == $column_id) {
2851
+ $checked = "checked";
2852
+ }
2853
+ else {
2854
+ $checked = "";
2855
+ }
2856
+ $matrix .= '<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
2857
+ }
2858
+ }
2859
+ else {
2860
+ if ($input_type=="checkbox") {
2861
+ foreach($column_ids as $column_id) {
2862
+ $checked = $_POST[$i."_input_element".$id.$row_id.'_'.$column_id];
2863
+ if ($checked == 1) {
2864
+ $checked = "checked";
2865
+ }
2866
+ else {
2867
+ $checked = "";
2868
+ }
2869
+ $matrix .= '<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
2870
+ }
2871
+ }
2872
+ else {
2873
+ if ($input_type=="text") {
2874
+ foreach ($column_ids as $column_id) {
2875
+ $checked = $_POST[$i."_input_element".$id.$row_id.'_'.$column_id];
2876
+ $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
2877
+ }
2878
+ }
2879
+ else {
2880
+ foreach ($column_ids as $column_id) {
2881
+ $checked = $_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id];
2882
+ $matrix .='<td style="text-align:center">'.$checked.'</td>';
2883
+ }
2884
+ }
2885
+ }
2886
+ }
2887
+ $matrix .= '</tr>';
2888
+ $k++;
2889
+ }
2890
+ $matrix .= '</table>';
2891
+ if (isset($matrix)) {
2892
+ $list = $list.'<tr valign="top"><td >'.$element_label.'</td><td ><pre style="margin:0px; padding:0px">'.$matrix.'</pre></td></tr>';
2893
+ }
2894
+ break;
2895
+ }
2896
+ default:
2897
+ break;
2898
+ }
2899
+ }
2900
+ }
2901
+ $list = $list . '</table>';
2902
+ $list = wordwrap($list, 70, "\n", TRUE);
2903
+ // add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
2904
+ if ($row->from_mail != '') {
2905
+ if ($row->from_name != '') {
2906
+ $from_mail = "From: '" . $row->from_name . "' <" . $row->from_mail . ">" . "\r\n";
2907
+ }
2908
+ else {
2909
+ $from_mail = "From: '' <" . $row->from_mail . ">" . "\r\n";
2910
+ }
2911
+ }
2912
+ else {
2913
+ $from_mail = '';
2914
+ }
2915
+ $headers = $from_mail . " Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\n";
2916
+ for ($k = 0; $k < count($all_files); $k++) {
2917
+ // $attachment[$k] = dirname(__FILE__) . '/uploads/' . $all_files[$k]['name'];
2918
+ $attachment[$k]= $all_files[$k]['name'];
2919
+ }
2920
+ if (isset($cc[0])) {
2921
+ foreach ($cc as $c) {
2922
+ if ($c) {
2923
+ $recipient = $c;
2924
+ $subject = $row->title;
2925
+ $new_script = wpautop($row->script_mail_user);
2926
+ foreach ($label_order_original as $key => $label_each) {
2927
+ if (strpos($row->script_mail_user, "%" . $label_each . "%") !== FALSE) {
2928
+ $type = $label_type[$key];
2929
+ if ($type != "type_submit_reset" or $type != "type_map" or $type != "type_editor" or $type != "type_captcha" or $type != "type_arithmetic_captcha" or $type != "type_recaptcha" or $type != "type_button") {
2930
+ $new_value = "";
2931
+ switch ($type) {
2932
+ case 'type_text':
2933
+ case 'type_password':
2934
+ case 'type_textarea':
2935
+ case "type_date":
2936
+ case "type_own_select":
2937
+ case "type_country":
2938
+ case "type_number": {
2939
+ $element = $_POST[$key."_element".$id];
2940
+ if (isset($element)) {
2941
+ $new_value = $element;
2942
+ }
2943
+ break;
2944
+ }
2945
+ case "type_hidden": {
2946
+ $element = $_POST[$element_label];
2947
+ if (isset($element)) {
2948
+ $new_value = $element;
2949
+ }
2950
+ break;
2951
+ }
2952
+ case "type_mark_map": {
2953
+ $element = $_POST[$key."_long".$id];
2954
+ if (isset($element)) {
2955
+ $new_value = 'Longitude:'.$_POST[$key."_long".$id].'<br/>Latitude:' . $_POST[$key."_lat".$id];
2956
+ }
2957
+ break;
2958
+ }
2959
+ case "type_submitter_mail": {
2960
+ $element = $_POST[$key."_element".$id];
2961
+ if (isset($element)) {
2962
+ $new_value = $element;
2963
+ }
2964
+ break;
2965
+ }
2966
+ case "type_time": {
2967
+ $hh = $_POST[$key."_hh".$id];
2968
+ if (isset($hh)) {
2969
+ $ss = $_POST[$key."_ss".$id];
2970
+ if (isset($ss)) {
2971
+ $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id].':'.$_POST[$key."_ss".$id];
2972
+ }
2973
+ else {
2974
+ $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id];
2975
+ }
2976
+ $am_pm = $_POST[$key."_am_pm".$id];
2977
+ if (isset($am_pm)) {
2978
+ $new_value = $new_value.' '.$_POST[$key."_am_pm".$id];
2979
+ }
2980
+ }
2981
+ break;
2982
+ }
2983
+ case "type_phone": {
2984
+ $element_first = $_POST[$key."_element_first".$id];
2985
+ if (isset($element_first)) {
2986
+ $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
2987
+ }
2988
+ break;
2989
+ }
2990
+ case "type_name": {
2991
+ $element_first = $_POST[$key."_element_first".$id];
2992
+ if (isset($element_first)) {
2993
+ $element_title = $_POST[$key."_element_title".$id];
2994
+ if (isset($element_title)) {
2995
+ $new_value = $_POST[$key."_element_title".$id].' '.$_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id].' '.$_POST[$key."_element_middle".$id];
2996
+ }
2997
+ else {
2998
+ $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
2999
+ }
3000
+ }
3001
+ break;
3002
+ }
3003
+ case "type_address": {
3004
+ if (isset($_POST[$key."_street1".$id])) {
3005
+ $new_value = $new_value.$_POST[$key."_street1".$id];
3006
+ break;
3007
+ }
3008
+ if (isset($_POST[$key."_street2".$id])) {
3009
+ $new_value = $new_value.$_POST[$key."_street2".$id];
3010
+ break;
3011
+ }
3012
+ if (isset($_POST[$key."_city".$id])) {
3013
+ $new_value = $new_value.$_POST[$key."_city".$id];
3014
+ break;
3015
+ }
3016
+ if (isset($_POST[$key."_state".$id])) {
3017
+ $new_value = $new_value.$_POST[$key."_state".$id];
3018
+ break;
3019
+ }
3020
+ if (isset($_POST[$key."_postal".$id])) {
3021
+ $new_value = $new_value.$_POST[$key."_postal".$id];
3022
+ break;
3023
+ }
3024
+ if (isset($_POST[$key."_country".$id])) {
3025
+ $new_value = $new_value.$_POST[$key."_country".$id];
3026
+ break;
3027
+ }
3028
+ }
3029
+ case "type_date_fields": {
3030
+ $day = $_POST[$key."_day".$id];
3031
+ if (isset($day)) {
3032
+ $new_value = $_POST[$key."_day".$id].'-'.$_POST[$key."_month".$id].'-'.$_POST[$key."_year".$id];
3033
+ }
3034
+ break;
3035
+ }
3036
+ case "type_radio": {
3037
+ $element = $_POST[$key."_other_input".$id];
3038
+ if (isset($element)) {
3039
+ $new_value = $_POST[$key."_other_input".$id];
3040
+ break;
3041
+ }
3042
+ $element = $_POST[$key."_element".$id];
3043
+ if (isset($element)) {
3044
+ $new_value = $element;
3045
+ }
3046
+ break;
3047
+ }
3048
+ case "type_checkbox": {
3049
+ $start = -1;
3050
+ for ($j = 0; $j < 100; $j++) {
3051
+ $element = $_POST[$key."_element".$id.$j];
3052
+ if (isset($element)) {
3053
+ $start = $j;
3054
+ break;
3055
+ }
3056
+ }
3057
+ $other_element_id = -1;
3058
+ $is_other = $_POST[$key."_allow_other".$id];
3059
+ if ($is_other == "yes") {
3060
+ $other_element_id = $_POST[$key."_allow_other_num".$id];
3061
+ }
3062
+ if ($start != -1) {
3063
+ for ($j = $start; $j < 100; $j++) {
3064
+ $element = $_POST[$key."_element".$id.$j];
3065
+ if (isset($element)) {
3066
+ if ($j == $other_element_id) {
3067
+ $new_value = $new_value.$_POST[$key."_other_input".$id].'<br>';
3068
+ }
3069
+ else {
3070
+ $new_value = $new_value.$_POST[$key."_element".$id.$j].'<br>';
3071
+ }
3072
+ }
3073
+ }
3074
+ }
3075
+ break;
3076
+ }
3077
+ case "type_paypal_price": {
3078
+ $new_value = 0;
3079
+ if ($_POST[$key."_element_dollars".$id]) {
3080
+ $new_value = $_POST[$key."_element_dollars".$id];
3081
+ }
3082
+ if ($_POST[$key."_element_cents".$id]) {
3083
+ $new_value = $new_value.'.'.$_POST[$key."_element_cents".$id];
3084
+ }
3085
+ $new_value = $new_value.$form_currency;
3086
+ break;
3087
+ }
3088
+ case "type_paypal_select": {
3089
+ $new_value = $_POST[$key."_element_label".$id].':'.$_POST[$key."_element".$id].$form_currency;
3090
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3091
+ if (isset($element_quantity_label)) {
3092
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3093
+ $new_value.='<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3094
+ }
3095
+ for ($k = 0; $k < 50; $k++) {
3096
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3097
+ if (isset($temp_val)) {
3098
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$i."_element_property_value".$id.$k];
3099
+ }
3100
+ }
3101
+ break;
3102
+ }
3103
+ case "type_paypal_radio": {
3104
+ $new_value = $_POST[$key."_element_label".$id].' - '.$_POST[$key."_element".$id].$form_currency;
3105
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3106
+ if (isset($element_quantity_label)) {
3107
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3108
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3109
+ }
3110
+ for ($k = 0; $k < 50; $k++) {
3111
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3112
+ if (isset($temp_val)) {
3113
+ $new_value .= '<br/>' . $_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3114
+ }
3115
+ }
3116
+ break;
3117
+ }
3118
+ case "type_paypal_shipping": {
3119
+ $new_value = $_POST[$key."_element_label".$id].' : '.$_POST[$key."_element".$id].$form_currency;
3120
+ break;
3121
+ }
3122
+ case "type_paypal_checkbox": {
3123
+ $start = -1;
3124
+ for($j = 0; $j < 100; $j++) {
3125
+ $element = $_POST[$key."_element".$id.$j];
3126
+ if (isset($element)) {
3127
+ $start = $j;
3128
+ break;
3129
+ }
3130
+ }
3131
+ if ($start != -1) {
3132
+ for ($j = $start; $j<100; $j++) {
3133
+ $element = $_POST[$key."_element".$id.$j];
3134
+ if (isset($element)) {
3135
+ $new_value = $new_value.$_POST[$key."_element".$id.$j."_label"].' - '.(($_POST[$key."_element".$id.$j] == '') ? '0'.$form_currency : $_POST[$key."_element".$id.$j]).$form_currency.'<br>';
3136
+ }
3137
+ }
3138
+ }
3139
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3140
+ if (isset($element_quantity_label)) {
3141
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3142
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3143
+ }
3144
+ for ($k = 0; $k < 50; $k++) {
3145
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3146
+ if (isset($temp_val)) {
3147
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3148
+ }
3149
+ }
3150
+ break;
3151
+ }
3152
+ case "type_star_rating":
3153
+ {
3154
+ $element=$_POST[$key."_star_amount".$id];
3155
+ $selected=(isset($_POST[$key."_selected_star_amount".$id]) ? $_POST[$key."_selected_star_amount".$id] : 0);
3156
+
3157
+
3158
+ if(isset($element))
3159
+ {
3160
+ $new_value=$new_value.$selected.'/'.$element;
3161
+ }
3162
+ break;
3163
+ }
3164
+
3165
+
3166
+ case "type_scale_rating":
3167
+ {
3168
+ $element=$_POST[$key."_scale_amount".$id];
3169
+ $selected=(isset($_POST[$key."_scale_radio".$id]) ? $_POST[$key."_scale_radio".$id] : 0);
3170
+
3171
+
3172
+ if(isset($element))
3173
+ {
3174
+ $new_value=$new_value.$selected.'/'.$element;
3175
+ }
3176
+ break;
3177
+ }
3178
+
3179
+ case "type_spinner":
3180
+ {
3181
+
3182
+ if (isset($_POST[$key."_element".$id])) {
3183
+ $new_value = $new_value . $_POST[$key."_element".$id];
3184
+ }
3185
+ break;
3186
+ }
3187
+
3188
+ case "type_slider":
3189
+ {
3190
+
3191
+ $element=$_POST[$key."_slider_value".$id];
3192
+ if(isset($element))
3193
+ {
3194
+ $new_value=$new_value.$element;
3195
+ }
3196
+ break;
3197
+ }
3198
+ case "type_range":
3199
+ {
3200
+
3201
+ $element0=$_POST[$key."_element".$id.'0'];
3202
+ $element1=$_POST[$key."_element".$id.'1'];
3203
+ if(isset($element0) || isset($element1))
3204
+ {
3205
+ $new_value=$new_value.$element0.'-'.$element1;
3206
+ }
3207
+ break;
3208
+ }
3209
+
3210
+ case "type_grading":
3211
+ {
3212
+ $element=$_POST[$key."_hidden_item".$id];
3213
+ $grading = explode(":",$element);
3214
+ $items_count = sizeof($grading)-1;
3215
+
3216
+ $element = "";
3217
+ $total = "";
3218
+
3219
+ for($k=0;$k<$items_count;$k++)
3220
+
3221
+ {
3222
+ $element .= $grading[$k].":".$_POST[$key."_element".$id.$k]." ";
3223
+ $total += $_POST[$key."_element".$id.$k];
3224
+ }
3225
+
3226
+ $element .="Total:".$total;
3227
+
3228
+
3229
+ if(isset($element))
3230
+ {
3231
+ $new_value=$new_value.$element;
3232
+ }
3233
+ break;
3234
+ }
3235
+
3236
+ case "type_matrix":
3237
+ {
3238
+
3239
+
3240
+ $input_type=$_POST[$key."_input_type".$id];
3241
+
3242
+ $mat_rows = $_POST[$key."_hidden_row".$id];
3243
+ $mat_rows = explode('***', $mat_rows);
3244
+ $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
3245
+
3246
+ $mat_columns = $_POST[$key."_hidden_column".$id];
3247
+ $mat_columns = explode('***', $mat_columns);
3248
+ $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
3249
+
3250
+ $row_ids=explode(",",substr($_POST[$key."_row_ids".$id], 0, -1));
3251
+ $column_ids=explode(",",substr($_POST[$key."_column_ids".$id], 0, -1));
3252
+
3253
+
3254
+ $matrix="<table>";
3255
+
3256
+ $matrix .='<tr><td></td>';
3257
+
3258
+ for( $k=0;$k< count($mat_columns) ;$k++)
3259
+ $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
3260
+ $matrix .='</tr>';
3261
+
3262
+ $aaa=Array();
3263
+ $k=0;
3264
+ foreach( $row_ids as $row_id){
3265
+ $matrix .='<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
3266
+
3267
+ if($input_type=="radio"){
3268
+
3269
+ $mat_radio = (isset($_POST[$key."_input_element".$id.$row_id]) ? $_POST[$key."_input_element".$id.$row_id] : 0);
3270
+ if($mat_radio==0){
3271
+ $checked="";
3272
+ $aaa[1]="";
3273
+ }
3274
+ else{
3275
+ $aaa=explode("_",$mat_radio);
3276
+ }
3277
+
3278
+ foreach( $column_ids as $column_id){
3279
+ if($aaa[1]==$column_id)
3280
+ $checked="checked";
3281
+ else
3282
+ $checked="";
3283
+ $matrix .='<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
3284
+
3285
+ }
3286
+
3287
+ }
3288
+ else{
3289
+ if($input_type=="checkbox")
3290
+ {
3291
+ foreach( $column_ids as $column_id){
3292
+ $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3293
+ if($checked==1)
3294
+ $checked = "checked";
3295
+ else
3296
+ $checked = "";
3297
+
3298
+ $matrix .='<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
3299
+
3300
+ }
3301
+
3302
+ }
3303
+ else
3304
+ {
3305
+ if($input_type=="text")
3306
+ {
3307
+
3308
+ foreach( $column_ids as $column_id){
3309
+ $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3310
+
3311
+ $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
3312
+
3313
+ }
3314
+
3315
+ }
3316
+ else{
3317
+ foreach( $column_ids as $column_id){
3318
+ $checked = $_POST[$key."_select_yes_no".$id.$row_id.'_'.$column_id];
3319
+ $matrix .='<td style="text-align:center">'.$checked.'</td>';
3320
+
3321
+
3322
+
3323
+ }
3324
+ }
3325
+
3326
+ }
3327
+
3328
+ }
3329
+ $matrix .='</tr>';
3330
+ $k++;
3331
+ }
3332
+ $matrix .='</table>';
3333
+
3334
+
3335
+
3336
+
3337
+
3338
+ if(isset($matrix))
3339
+ {
3340
+ $new_value=$new_value.$matrix;
3341
+ }
3342
+
3343
+ break;
3344
+ }
3345
+ default: break;
3346
+ }
3347
+ $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3348
+ }
3349
+ }
3350
+ }
3351
+ if (strpos($new_script, "%all%") !== FALSE) {
3352
+ $new_script = str_replace("%all%", $list, $new_script);
3353
+ }
3354
+ $body = $new_script;
3355
+ $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment);
3356
+ }
3357
+ if ($row->mail) {
3358
+ if ($c) {
3359
+ // $headers_form_mail = "From: " . $c . " <" . $c . ">" . "\r\n";
3360
+ $headers = "From: '" . $c . "' <" . $c . ">" . "\r\n" . "Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\n";
3361
+ }
3362
+ // else {
3363
+ // $headers_form_mail = "";
3364
+ // }
3365
+ if ($row_mail_one_time) {
3366
+ $recipient = $row->mail;
3367
+ $subject = $row->title;
3368
+ $new_script = wpautop($row->script_mail);
3369
+ foreach($label_order_original as $key => $label_each) {
3370
+ if (strpos($row->script_mail, "%" . $label_each . "%") !== FALSE) {
3371
+ $type = $label_type[$key];
3372
+ if ($type != "type_submit_reset" or $type!="type_map" or $type!="type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
3373
+ $new_value ="";
3374
+ switch ($type) {
3375
+ case 'type_text':
3376
+ case 'type_password':
3377
+ case 'type_textarea':
3378
+ case "type_date":
3379
+ case "type_own_select":
3380
+ case "type_country":
3381
+ case "type_number": {
3382
+ $element = $_POST[$key."_element".$id];
3383
+ if (isset($element)) {
3384
+ $new_value = $element;
3385
+ }
3386
+ break;
3387
+ }
3388
+ case "type_hidden": {
3389
+ $element = $_POST[$element_label];
3390
+ if(isset($element))
3391
+ {
3392
+ $new_value = $element;
3393
+ }
3394
+ break;
3395
+ }
3396
+ case "type_mark_map": {
3397
+ $element = $_POST[$key."_long".$id];
3398
+ if (isset($element)) {
3399
+ $new_value = 'Longitude:'.$_POST[$key."_long".$id].'<br/>Latitude:'.$_POST[$key."_lat".$id];
3400
+ }
3401
+ break;
3402
+ }
3403
+ case "type_submitter_mail": {
3404
+ $element = $_POST[$key."_element".$id];
3405
+ if (isset($element)) {
3406
+ $new_value = $element;
3407
+ }
3408
+ break;
3409
+ }
3410
+ case "type_time": {
3411
+ $hh = $_POST[$key."_hh".$id];
3412
+ if (isset($hh)) {
3413
+ $ss = $_POST[$key."_ss".$id];
3414
+ if (isset($ss)) {
3415
+ $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id].':'.$_POST[$key."_ss".$id];
3416
+ }
3417
+ else {
3418
+ $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id];
3419
+ }
3420
+ $am_pm = $_POST[$key."_am_pm".$id];
3421
+ if (isset($am_pm)) {
3422
+ $new_value = $new_value.' '.$_POST[$key."_am_pm".$id];
3423
+ }
3424
+ }
3425
+ break;
3426
+ }
3427
+ case "type_phone": {
3428
+ $element_first = $_POST[$key."_element_first".$id];
3429
+ if (isset($element_first)) {
3430
+ $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3431
+ }
3432
+ break;
3433
+ }
3434
+ case "type_name": {
3435
+ $element_first = $_POST[$key."_element_first".$id];
3436
+ if (isset($element_first)) {
3437
+ $element_title = $_POST[$key."_element_title".$id];
3438
+ if (isset($element_title)) {
3439
+ $new_value = $_POST[$key."_element_title".$id].' '.$_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id].' '.$_POST[$key."_element_middle".$id];
3440
+ }
3441
+ else {
3442
+ $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3443
+ }
3444
+ }
3445
+ break;
3446
+ }
3447
+ case "type_address": {
3448
+ $street1 = $_POST[$key."_street1".$id];
3449
+ if (isset($_POST[$key."_street1".$id])) {
3450
+ $new_value = $new_value.$_POST[$key."_street1".$id];
3451
+ break;
3452
+ }
3453
+ if (isset($_POST[$key."_street2".$id])) {
3454
+ $new_value=$new_value.$_POST[$key."_street2".$id];
3455
+ break;
3456
+ }
3457
+ if (isset($_POST[$key."_city".$id])) {
3458
+ $new_value=$new_value.$_POST[$key."_city".$id];
3459
+ break;
3460
+ }
3461
+ if (isset($_POST[$key."_state".$id])) {
3462
+ $new_value=$new_value.$_POST[$key."_state".$id];
3463
+ break;
3464
+ }
3465
+ if (isset($_POST[$key."_postal".$id])) {
3466
+ $new_value=$new_value.$_POST[$key."_postal".$id];
3467
+ break;
3468
+ }
3469
+ if (isset($_POST[$key."_country".$id])) {
3470
+ $new_value=$new_value.$_POST[$key."_country".$id];
3471
+ break;
3472
+ }
3473
+ }
3474
+ case "type_date_fields": {
3475
+ $day = $_POST[$key."_day".$id];
3476
+ if (isset($day)) {
3477
+ $new_value = $_POST[$key."_day".$id].'-'.$_POST[$key."_month".$id].'-'.$_POST[$key."_year".$id];
3478
+ }
3479
+ break;
3480
+ }
3481
+ case "type_radio": {
3482
+ $element = $_POST[$key."_other_input".$id];
3483
+ if (isset($element)) {
3484
+ $new_value = $_POST[$key."_other_input".$id];
3485
+ break;
3486
+ }
3487
+ $element = $_POST[$key."_element".$id];
3488
+ if (isset($element)) {
3489
+ $new_value = $element;
3490
+ }
3491
+ break;
3492
+ }
3493
+ case "type_checkbox": {
3494
+ $start = -1;
3495
+ for ($j=0; $j<100; $j++) {
3496
+ $element = $_POST[$key."_element".$id.$j];
3497
+ if (isset($element)) {
3498
+ $start = $j;
3499
+ break;
3500
+ }
3501
+ }
3502
+ $other_element_id=-1;
3503
+ $is_other = $_POST[$key."_allow_other".$id];
3504
+ if ($is_other == "yes") {
3505
+ $other_element_id = $_POST[$key."_allow_other_num".$id];
3506
+ }
3507
+ if ($start != -1) {
3508
+ for ($j = $start; $j < 100; $j++) {
3509
+ $element = $_POST[$key."_element".$id.$j];
3510
+ if (isset($element)) {
3511
+ if ($j == $other_element_id) {
3512
+ $new_value = $new_value.$_POST[$key."_other_input".$id].'<br>';
3513
+ }
3514
+ else {
3515
+ $new_value = $new_value.$_POST[$key."_element".$id.$j].'<br>';
3516
+ }
3517
+ }
3518
+ }
3519
+ }
3520
+ break;
3521
+ }
3522
+ case "type_paypal_price": {
3523
+ $new_value = 0;
3524
+ if ($_POST[$key."_element_dollars".$id]) {
3525
+ $new_value = $_POST[$key."_element_dollars".$id];
3526
+ }
3527
+ if ($_POST[$key."_element_cents".$id]) {
3528
+ $new_value = $new_value.'.'.$_POST[$key."_element_cents".$id];
3529
+ }
3530
+ $new_value = $new_value.$form_currency;
3531
+ break;
3532
+ }
3533
+ case "type_paypal_select": {
3534
+ $new_value = $_POST[$key."_element_label".$id].':'.$_POST[$key."_element".$id].$form_currency;
3535
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3536
+ if (isset($element_quantity_label)) {
3537
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3538
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3539
+ }
3540
+ for($k = 0; $k < 50; $k++) {
3541
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3542
+ if (isset($temp_val)) {
3543
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3544
+ }
3545
+ }
3546
+ break;
3547
+ }
3548
+ case "type_paypal_radio": {
3549
+ $new_value = $_POST[$key."_element_label".$id].' - '.$_POST[$key."_element".$id].$form_currency;
3550
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3551
+ if (isset($element_quantity_label)) {
3552
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3553
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3554
+ }
3555
+ for ($k = 0; $k < 50; $k++) {
3556
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3557
+ if (isset($temp_val)) {
3558
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3559
+ }
3560
+ }
3561
+ break;
3562
+ }
3563
+ case "type_paypal_shipping": {
3564
+ $new_value = $_POST[$key."_element_label".$id].' : '.$_POST[$key."_element".$id].$form_currency;
3565
+ break;
3566
+ }
3567
+ case "type_paypal_checkbox": {
3568
+ $start = -1;
3569
+ for ($j = 0; $j < 100; $j++) {
3570
+ $element = $_POST[$key."_element".$id.$j];
3571
+ if (isset($element)) {
3572
+ $start = $j;
3573
+ break;
3574
+ }
3575
+ }
3576
+ if ($start != -1) {
3577
+ for ($j = $start; $j < 100; $j++) {
3578
+ $element = $_POST[$key."_element".$id.$j];
3579
+ if (isset($element)) {
3580
+ $new_value = $new_value.$_POST[$key."_element".$id.$j."_label"].' - '.(($_POST[$key."_element".$id.$j] == '') ? '0'.$form_currency : $_POST[$key."_element".$id.$j]).$form_currency.'<br>';
3581
+ }
3582
+ }
3583
+ }
3584
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3585
+ if (isset($element_quantity_label)) {
3586
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3587
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3588
+ }
3589
+ for ($k = 0; $k < 50; $k++) {
3590
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3591
+ if (isset($temp_val)) {
3592
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3593
+ }
3594
+ }
3595
+ break;
3596
+ }
3597
+ case "type_star_rating": {
3598
+ if (isset($_POST[$key."_star_amount".$id])) {
3599
+ $selected = (isset($_POST[$key."_selected_star_amount".$id]) ? $_POST[$key."_selected_star_amount".$id] : 0);
3600
+ $new_value = $new_value.$selected.'/'.$_POST[$key."_star_amount".$id];
3601
+ }
3602
+ break;
3603
+ }
3604
+ case "type_scale_rating": {
3605
+ if (isset($_POST[$key."_scale_amount".$id])) {
3606
+ $selected = (isset($_POST[$key."_scale_radio".$id]) ? $_POST[$key."_scale_radio".$id] : 0);
3607
+ $new_value=$new_value.$selected.'/'.$_POST[$key."_scale_amount".$id];
3608
+ }
3609
+ break;
3610
+ }
3611
+ case "type_spinner": {
3612
+ if(isset($_POST[$key."_element".$id])) {
3613
+ $new_value = $new_value.$_POST[$key."_element".$id];
3614
+ }
3615
+ break;
3616
+ }
3617
+ case "type_slider": {
3618
+ if (isset($_POST[$key."_slider_value".$id])) {
3619
+ $new_value = $new_value.$_POST[$key."_slider_value".$id];
3620
+ }
3621
+ break;
3622
+ }
3623
+ case "type_range": {
3624
+ if (isset($_POST[$key."_element".$id.'0']) || isset($_POST[$key."_element".$id.'1'])) {
3625
+ $new_value=$new_value.$_POST[$key."_element".$id.'0'].'-'.$_POST[$key."_element".$id.'1'];
3626
+ }
3627
+ break;
3628
+ }
3629
+
3630
+ case "type_grading":
3631
+ {
3632
+ $element=$_POST[$key."_hidden_item".$id];
3633
+ $grading = explode(":",$element);
3634
+ $items_count = sizeof($grading)-1;
3635
+
3636
+ $element = "";
3637
+ $total = "";
3638
+
3639
+ for($k=0;$k<$items_count;$k++) {
3640
+ $element .= $grading[$k].":".$_POST[$key."_element".$id.$k]." ";
3641
+ $total += $_POST[$key."_element".$id.$k];
3642
+ }
3643
+
3644
+ $element .="Total:".$total;
3645
+
3646
+
3647
+ if(isset($element))
3648
+ {
3649
+ $new_value=$new_value.$element;
3650
+ }
3651
+ break;
3652
+ }
3653
+
3654
+ case "type_matrix":
3655
+ {
3656
+
3657
+
3658
+ $input_type=$_POST[$key."_input_type".$id];
3659
+
3660
+ $mat_rows = $_POST[$key."_hidden_row".$id];
3661
+ $mat_rows = explode('***', $mat_rows);
3662
+ $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
3663
+
3664
+ $mat_columns = $_POST[$key."_hidden_column".$id];
3665
+ $mat_columns = explode('***', $mat_columns);
3666
+ $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
3667
+
3668
+ $row_ids=explode(",",substr($_POST[$key."_row_ids".$id], 0, -1));
3669
+ $column_ids=explode(",",substr($_POST[$key."_column_ids".$id], 0, -1));
3670
+ $matrix="<table>";
3671
+
3672
+ $matrix .='<tr><td></td>';
3673
+
3674
+ for( $k=0;$k< count($mat_columns) ;$k++)
3675
+ $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
3676
+ $matrix .='</tr>';
3677
+
3678
+ $aaa=Array();
3679
+ $k=0;
3680
+ foreach( $row_ids as $row_id){
3681
+ $matrix .='<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
3682
+
3683
+ if($input_type=="radio"){
3684
+
3685
+ $mat_radio = (isset($_POST[$key."_input_element".$id.$row_id]) ? $_POST[$key."_input_element".$id.$row_id] : 0);
3686
+ if($mat_radio==0){
3687
+ $checked="";
3688
+ $aaa[1]="";
3689
+ }
3690
+ else{
3691
+ $aaa=explode("_",$mat_radio);
3692
+ }
3693
+
3694
+ foreach( $column_ids as $column_id){
3695
+ if($aaa[1]==$column_id)
3696
+ $checked="checked";
3697
+ else
3698
+ $checked="";
3699
+ $matrix .='<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
3700
+
3701
+ }
3702
+
3703
+ }
3704
+ else{
3705
+ if($input_type=="checkbox")
3706
+ {
3707
+ foreach( $column_ids as $column_id){
3708
+ $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3709
+ if($checked==1)
3710
+ $checked = "checked";
3711
+ else
3712
+ $checked = "";
3713
+
3714
+ $matrix .='<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
3715
+
3716
+ }
3717
+
3718
+ }
3719
+ else
3720
+ {
3721
+ if($input_type=="text")
3722
+ {
3723
+
3724
+ foreach( $column_ids as $column_id){
3725
+ $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
3726
+
3727
+ $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
3728
+
3729
+ }
3730
+
3731
+ }
3732
+ else{
3733
+ foreach( $column_ids as $column_id){
3734
+ $checked = $_POST[$key."_select_yes_no".$id.$row_id.'_'.$column_id];
3735
+ $matrix .='<td style="text-align:center">'.$checked.'</td>';
3736
+
3737
+
3738
+
3739
+ }
3740
+ }
3741
+
3742
+ }
3743
+
3744
+ }
3745
+ $matrix .='</tr>';
3746
+ $k++;
3747
+ }
3748
+ $matrix .='</table>';
3749
+
3750
+
3751
+
3752
+
3753
+
3754
+ if(isset($matrix))
3755
+ {
3756
+ $new_value=$new_value.$matrix;
3757
+ }
3758
+
3759
+ break;
3760
+ }
3761
+ default: break;
3762
+ }
3763
+ $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3764
+ }
3765
+ }
3766
+ }
3767
+ if (strpos($new_script, "%all%") !== FALSE) {
3768
+ $new_script = str_replace("%all%", $list, $new_script);
3769
+ }
3770
+ $body = $new_script;
3771
+ $mode = 1;
3772
+ $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment);
3773
+ $row_mail_one_time = 0;
3774
+ }
3775
+ }
3776
+ }
3777
+ }
3778
+ else {
3779
+ if ($row->mail) {
3780
+ $recipient = $row->mail;
3781
+ $subject = $row->title;
3782
+ $new_script = wpautop($row->script_mail);
3783
+ foreach($label_order_original as $key => $label_each) {
3784
+ if (strpos($row->script_mail, "%" . $label_each . "%") !== FALSE) {
3785
+ $type = $label_type[$key];
3786
+ if ($type != "type_submit_reset" or $type != "type_map" or $type != "type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
3787
+ $new_value = "";
3788
+ switch ($type) {
3789
+ case 'type_text':
3790
+ case 'type_password':
3791
+ case 'type_textarea':
3792
+ case "type_date":
3793
+ case "type_own_select":
3794
+ case "type_country":
3795
+ case "type_number": {
3796
+ $element = $_POST[$key."_element".$id];
3797
+ if (isset($element)) {
3798
+ $new_value = $element;
3799
+ }
3800
+ break;
3801
+ }
3802
+ case "type_hidden": {
3803
+ $element = $_POST[$element_label];
3804
+ if (isset($element)) {
3805
+ $new_value = $element;
3806
+ }
3807
+ break;
3808
+ }
3809
+ case "type_mark_map": {
3810
+ $element = $_POST[$key."_long".$id];
3811
+ if (isset($element)) {
3812
+ $new_value = 'Longitude:'.$_POST[$key."_long".$id].'<br/>Latitude:'.$_POST[$key."_lat".$id];
3813
+ }
3814
+ break;
3815
+ }
3816
+ case "type_submitter_mail": {
3817
+ $element = $_POST[$key."_element".$id];
3818
+ if (isset($element)) {
3819
+ $new_value = $element;
3820
+ }
3821
+ break;
3822
+ }
3823
+ case "type_time": {
3824
+ $hh = $_POST[$key."_hh".$id];
3825
+ if (isset($hh)) {
3826
+ $ss = $_POST[$key."_ss".$id];
3827
+ if (isset($ss)) {
3828
+ $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id].':'.$_POST[$key."_ss".$id];
3829
+ }
3830
+ else {
3831
+ $new_value = $_POST[$key."_hh".$id].':'.$_POST[$key."_mm".$id];
3832
+ }
3833
+ $am_pm = $_POST[$key."_am_pm".$id];
3834
+ if (isset($am_pm)) {
3835
+ $new_value = $new_value.' '.$_POST[$key."_am_pm".$id];
3836
+ }
3837
+ }
3838
+ break;
3839
+ }
3840
+ case "type_phone": {
3841
+ $element_first = $_POST[$key."_element_first".$id];
3842
+ if (isset($element_first)) {
3843
+ $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3844
+ }
3845
+ break;
3846
+ }
3847
+ case "type_name": {
3848
+ $element_first = $_POST[$key."_element_first".$id];
3849
+ if (isset($element_first)) {
3850
+ $element_title = $_POST[$key."_element_title".$id];
3851
+ if (isset($element_title)) {
3852
+ $new_value = $_POST[$key."_element_title".$id].' '.$_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id].' '.$_POST[$key."_element_middle".$id];
3853
+ }
3854
+ else {
3855
+ $new_value = $_POST[$key."_element_first".$id].' '.$_POST[$key."_element_last".$id];
3856
+ }
3857
+ }
3858
+ break;
3859
+ }
3860
+ case "type_address": {
3861
+ if (isset($_POST[$key."_street1".$id])) {
3862
+ $new_value = $new_value.$_POST[$key."_street1".$id];
3863
+ break;
3864
+ }
3865
+ if (isset($_POST[$key."_street2".$id])) {
3866
+ $new_value = $new_value.$_POST[$key."_street2".$id];
3867
+ break;
3868
+ }
3869
+ if (isset($_POST[$key."_city".$id])) {
3870
+ $new_value = $new_value.$_POST[$key."_city".$id];
3871
+ break;
3872
+ }
3873
+ if (isset($_POST[$key."_state".$id])) {
3874
+ $new_value = $new_value.$_POST[$key."_state".$id];
3875
+ break;
3876
+ }
3877
+ if (isset($_POST[$key."_postal".$id])) {
3878
+ $new_value = $new_value.$_POST[$key."_postal".$id];
3879
+ break;
3880
+ }
3881
+ if (isset($_POST[$key."_country".$id])) {
3882
+ $new_value = $new_value.$_POST[$key."_country".$id];
3883
+ break;
3884
+ }
3885
+ }
3886
+ case "type_date_fields": {
3887
+ $day = $_POST[$key."_day".$id];
3888
+ if (isset($day)) {
3889
+ $new_value = $_POST[$key."_day".$id].'-'.$_POST[$key."_month".$id].'-'.$_POST[$key."_year".$id];
3890
+ }
3891
+ break;
3892
+ }
3893
+ case "type_radio": {
3894
+ $element = $_POST[$key."_other_input".$id];
3895
+ if (isset($element)) {
3896
+ $new_value = $_POST[$key."_other_input".$id];
3897
+ break;
3898
+ }
3899
+ $element = $_POST[$key."_element".$id];
3900
+ if (isset($element)) {
3901
+ $new_value = $element;
3902
+ }
3903
+ break;
3904
+ }
3905
+ case "type_checkbox": {
3906
+ $start = -1;
3907
+ for ($j = 0; $j < 100; $j++) {
3908
+ $element = $_POST[$key."_element".$id.$j];
3909
+ if (isset($element)) {
3910
+ $start = $j;
3911
+ break;
3912
+ }
3913
+ }
3914
+ $other_element_id = -1;
3915
+ $is_other = $_POST[$key."_allow_other".$id];
3916
+ if ($is_other == "yes") {
3917
+ $other_element_id = $_POST[$key."_allow_other_num".$id];
3918
+ }
3919
+ if ($start != -1) {
3920
+ for ($j = $start; $j < 100; $j++) {
3921
+ $element = $_POST[$key."_element".$id.$j];
3922
+ if (isset($element)) {
3923
+ if ($j == $other_element_id) {
3924
+ $new_value = $new_value.$_POST[$key."_other_input".$id].'<br>';
3925
+ }
3926
+ else {
3927
+ $new_value = $new_value.$_POST[$key."_element".$id.$j].'<br>';
3928
+ }
3929
+ }
3930
+ }
3931
+ }
3932
+ break;
3933
+ }
3934
+ case "type_paypal_price": {
3935
+ $new_value = 0;
3936
+ if ($_POST[$key."_element_dollars".$id]) {
3937
+ $new_value = $_POST[$key."_element_dollars".$id];
3938
+ }
3939
+ if ($_POST[$key."_element_cents".$id]) {
3940
+ $new_value = $new_value.'.'.$_POST[$key."_element_cents".$id];
3941
+ }
3942
+ $new_value = $new_value.$form_currency;
3943
+ break;
3944
+ }
3945
+ case "type_paypal_select": {
3946
+ $new_value = $_POST[$key."_element_label".$id].':'.$_POST[$key."_element".$id].$form_currency;
3947
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3948
+ if (isset($element_quantity_label)) {
3949
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3950
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3951
+ }
3952
+ for ($k = 0; $k < 50; $k++) {
3953
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3954
+ if (isset($temp_val)) {
3955
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3956
+ }
3957
+ }
3958
+ break;
3959
+ }
3960
+ case "type_paypal_radio": {
3961
+ $new_value = $_POST[$key."_element_label".$id].' - '.$_POST[$key."_element".$id].$form_currency;
3962
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3963
+ if (isset($element_quantity_label)) {
3964
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3965
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
3966
+ }
3967
+ for ($k = 0; $k < 50; $k++) {
3968
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
3969
+ if (isset($temp_val)) {
3970
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
3971
+ }
3972
+ }
3973
+ break;
3974
+ }
3975
+ case "type_paypal_shipping": {
3976
+ $new_value = $_POST[$key."_element_label".$id].' : '.$_POST[$key."_element".$id].$form_currency;
3977
+ break;
3978
+ }
3979
+ case "type_paypal_checkbox": {
3980
+ $start = -1;
3981
+ for ($j = 0; $j < 100; $j++) {
3982
+ $element = $_POST[$key."_element".$id.$j];
3983
+ if (isset($element)) {
3984
+ $start = $j;
3985
+ break;
3986
+ }
3987
+ }
3988
+ if ($start != -1) {
3989
+ for ($j = $start; $j < 100; $j++) {
3990
+ $element = $_POST[$key."_element".$id.$j];
3991
+ if (isset($element)) {
3992
+ $new_value = $new_value.$_POST[$key."_element".$id.$j."_label"].' - '.(($_POST[$key."_element".$id.$j] == '') ? '0'.$form_currency : $_POST[$key."_element".$id.$j]).$form_currency.'<br>';
3993
+ }
3994
+ }
3995
+ }
3996
+ $element_quantity_label = $_POST[$key."_element_quantity_label".$id];
3997
+ if (isset($element_quantity_label)) {
3998
+ $quantity = ((isset($_POST[$key . "_element_quantity" . $id]) && ($_POST[$key . "_element_quantity" . $id] >= 1)) ? $_POST[$key . "_element_quantity" . $id] : 1);
3999
+ $new_value .= '<br/>'.$_POST[$key."_element_quantity_label".$id].': '.$quantity;
4000
+ }
4001
+ for ($k = 0; $k < 50; $k++) {
4002
+ $temp_val = $_POST[$key."_element_property_value".$id.$k];
4003
+ if (isset($temp_val)) {
4004
+ $new_value .= '<br/>'.$_POST[$key."_element_property_label".$id.$k].': '.$_POST[$key."_element_property_value".$id.$k];
4005
+ }
4006
+ }
4007
+ break;
4008
+ }
4009
+ case "type_star_rating":
4010
+ {
4011
+ $element=$_POST[$key."_star_amount".$id];
4012
+ $selected=(isset($_POST[$key."_selected_star_amount".$id]) ? $_POST[$key."_selected_star_amount".$id] : 0);
4013
+ if(isset($element))
4014
+ {
4015
+ $new_value=$new_value.$selected.'/'.$element;
4016
+ }
4017
+ break;
4018
+ }
4019
+
4020
+
4021
+ case "type_scale_rating":
4022
+ {
4023
+ $element=$_POST[$key."_scale_amount".$id];
4024
+ $selected=(isset($_POST[$key."_scale_radio".$id]) ? $_POST[$key."_scale_radio".$id] : 0);
4025
+
4026
+
4027
+ if(isset($element))
4028
+ {
4029
+ $new_value=$new_value.$selected.'/'.$element;
4030
+ }
4031
+ break;
4032
+ }
4033
+
4034
+ case "type_spinner":
4035
+ {
4036
+
4037
+ if(isset($_POST[$key."_element".$id]))
4038
+ {
4039
+ $new_value=$new_value.$_POST[$key."_element".$id];
4040
+ }
4041
+ break;
4042
+ }
4043
+
4044
+ case "type_slider":
4045
+ {
4046
+
4047
+ $element=$_POST[$key."_slider_value".$id];
4048
+ if(isset($element))
4049
+ {
4050
+ $new_value=$new_value.$element;
4051
+ }
4052
+ break;
4053
+ }
4054
+ case "type_range":
4055
+ {
4056
+
4057
+ $element0=$_POST[$key."_element".$id.'0'];
4058
+ $element1=$_POST[$key."_element".$id.'1'];
4059
+ if(isset($element0) || isset($element1))
4060
+ {
4061
+ $new_value=$new_value.$element0.'-'.$element1;
4062
+ }
4063
+ break;
4064
+ }
4065
+
4066
+ case "type_grading":
4067
+ {
4068
+ $element=$_POST[$key."_hidden_item".$id];
4069
+ $grading = explode(":",$element);
4070
+ $items_count = sizeof($grading)-1;
4071
+
4072
+ $element = "";
4073
+ $total = "";
4074
+
4075
+ for($k=0;$k<$items_count;$k++)
4076
+
4077
+ {
4078
+ $element .= $grading[$k].":".$_POST[$key."_element".$id.$k]." ";
4079
+ $total += $_POST[$key."_element".$id.$k];
4080
+ }
4081
+
4082
+ $element .="Total:".$total;
4083
+
4084
+
4085
+ if(isset($element))
4086
+ {
4087
+ $new_value=$new_value.$element;
4088
+ }
4089
+ break;
4090
+ }
4091
+
4092
+ case "type_matrix":
4093
+ {
4094
+
4095
+
4096
+ $input_type=$_POST[$key."_input_type".$id];
4097
+
4098
+ $mat_rows = $_POST[$key."_hidden_row".$id];
4099
+ $mat_rows = explode('***', $mat_rows);
4100
+ $mat_rows = array_slice($mat_rows,0, count($mat_rows)-1);
4101
+
4102
+ $mat_columns = $_POST[$key."_hidden_column".$id];
4103
+ $mat_columns = explode('***', $mat_columns);
4104
+ $mat_columns = array_slice($mat_columns,0, count($mat_columns)-1);
4105
+
4106
+ $row_ids=explode(",",substr($_POST[$key."_row_ids".$id], 0, -1));
4107
+ $column_ids=explode(",",substr($_POST[$key."_column_ids".$id], 0, -1));
4108
+
4109
+
4110
+ $matrix="<table>";
4111
+
4112
+ $matrix .='<tr><td></td>';
4113
+
4114
+ for( $k=0;$k< count($mat_columns) ;$k++)
4115
+ $matrix .='<td style="background-color:#BBBBBB; padding:5px; ">'.$mat_columns[$k].'</td>';
4116
+ $matrix .='</tr>';
4117
+
4118
+ $aaa=Array();
4119
+ $k=0;
4120
+ foreach($row_ids as $row_id)
4121
+ {
4122
+ $matrix .='<tr><td style="background-color:#BBBBBB; padding:5px;">'.$mat_rows[$k].'</td>';
4123
+
4124
+ if($input_type=="radio"){
4125
+
4126
+ $mat_radio = (isset($_POST[$key."_input_element".$id.$row_id]) ? $_POST[$key."_input_element".$id.$row_id] : 0);
4127
+ if($mat_radio==0){
4128
+ $checked="";
4129
+ $aaa[1]="";
4130
+ }
4131
+ else{
4132
+ $aaa=explode("_",$mat_radio);
4133
+ }
4134
+
4135
+ foreach($column_ids as $column_id){
4136
+ if($aaa[1]==$column_id)
4137
+ $checked="checked";
4138
+ else
4139
+ $checked="";
4140
+ $matrix .='<td style="text-align:center"><input type="radio" '.$checked.' disabled /></td>';
4141
+
4142
+ }
4143
+
4144
+ }
4145
+ else{
4146
+ if($input_type=="checkbox")
4147
+ {
4148
+ foreach($column_ids as $column_id){
4149
+ $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
4150
+ if($checked==1)
4151
+ $checked = "checked";
4152
+ else
4153
+ $checked = "";
4154
+
4155
+ $matrix .='<td style="text-align:center"><input type="checkbox" '.$checked.' disabled /></td>';
4156
+
4157
+ }
4158
+
4159
+ }
4160
+ else
4161
+ {
4162
+ if($input_type=="text")
4163
+ {
4164
+
4165
+ foreach($column_ids as $column_id){
4166
+ $checked = $_POST[$key."_input_element".$id.$row_id.'_'.$column_id];
4167
+
4168
+ $matrix .='<td style="text-align:center"><input type="text" value="'.$checked.'" disabled /></td>';
4169
+
4170
+ }
4171
+
4172
+ }
4173
+ else{
4174
+ foreach($column_ids as $column_id){
4175
+ $checked = $_POST[$i."_select_yes_no".$id.$row_id.'_'.$column_id];
4176
+ $matrix .='<td style="text-align:center">'.$checked.'</td>';
4177
+
4178
+
4179
+
4180
+ }
4181
+ }
4182
+
4183
+ }
4184
+
4185
+ }
4186
+ $matrix .='</tr>';
4187
+ $k++;
4188
+ }
4189
+ $matrix .='</table>';
4190
+
4191
+
4192
+
4193
+
4194
+
4195
+ if(isset($matrix))
4196
+ {
4197
+ $new_value=$new_value.$matrix;
4198
+ }
4199
+
4200
+ break;
4201
+ }
4202
+ default: break;
4203
+ }
4204
+ $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
4205
+ }
4206
+ }
4207
+ }
4208
+ if (strpos($new_script, "%all%") !== FALSE) {
4209
+ $new_script = str_replace("%all%", $list, $new_script);
4210
+ }
4211
+ $body = $new_script;
4212
+ $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment);
4213
+ }
4214
+ }
4215
+ if ($row->mail) {
4216
+ if ($send != TRUE) {
4217
+ $_SESSION['error_or_no' . $id] = 1;
4218
+ $msg = addslashes(__('Error, email was not sent.', 'form_maker'));
4219
+ }
4220
+ else {
4221
+ $_SESSION['error_or_no' . $id] = 0;
4222
+ $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
4223
+ }
4224
+ }
4225
+ else {
4226
+ $_SESSION['error_or_no' . $id] = 0;
4227
+ $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
4228
+ }
4229
+ }
4230
+
4231
+ // delete files from uploads (save_upload = 0)
4232
+ if($row->save_uploads == 0){
4233
+ foreach ($all_files as &$all_file) {
4234
+ if (file_exists(ABSPATH.'/'.$all_file['tmp_name'])) {
4235
+ unlink(ABSPATH.'/'.$all_file['tmp_name']);
4236
+ }
4237
+ }
4238
+
4239
+ }
4240
+ $https = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
4241
+ switch ($row->submit_text_type) {
4242
+ case "2":
4243
+ case "5": {
4244
+ if ($row->submit_text_type != 4) {
4245
+ $_SESSION['massage_after_submit' . $id] = $msg;
4246
+ }
4247
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4248
+ if ($row->article_id) {
4249
+ $redirect_url = $row->article_id;
4250
+ }
4251
+ else {
4252
+ $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
4253
+ }
4254
+ break;
4255
+ }
4256
+ case "3": {
4257
+ if ($row->submit_text_type != 4) {
4258
+ $_SESSION['massage_after_submit' . $id] = $msg;
4259
+ }
4260
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4261
+ $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
4262
+ break;
4263
+ }
4264
+ case "4": {
4265
+ if ($row->submit_text_type != 4) {
4266
+ $_SESSION['massage_after_submit' . $id] = $msg;
4267
+ }
4268
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4269
+ $redirect_url = $row->url;
4270
+ break;
4271
+ }
4272
+ default: {
4273
+ if ($row->submit_text_type != 4) {
4274
+ $_SESSION['massage_after_submit' . $id] = $msg;
4275
+ }
4276
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
4277
+ $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
4278
+ break;
4279
+ }
4280
+ }
4281
+ if (!$str) {
4282
+ wp_redirect($redirect_url);
4283
+ exit;
4284
+ }
4285
+ else {
4286
+ $_SESSION['redirect_paypal'.$id] = 1;
4287
+
4288
+ $str .= "&return=" . urlencode($redirect_url);
4289
+ wp_redirect($str);
4290
+ exit;
4291
+ }
4292
+ }
4293
+
4294
+ public static function custom_fields_mail($type, $key, $id, $attachment, $form_currency)
4295
+ {
4296
+ $new_value ="";
4297
+
4298
+ $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
4299
+ $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
4300
+
4301
+ if($type!="type_submit_reset" or $type!="type_map" or $type!="type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
4302
+ switch ($type) {
4303
+ case 'type_text':
4304
+ case 'type_password':
4305
+ case 'type_textarea':
4306
+ case "type_date":
4307
+ case "type_own_select":
4308
+ case "type_country":
4309
+ case "type_number": {
4310
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4311
+ if(isset($element)) {
4312
+ $new_value = $element;
4313
+ }
4314
+ break;
4315
+ }
4316
+ case "type_file_upload": {
4317
+ if($attachment)
4318
+ foreach($attachment as $attachment_temp)
4319
+ {
4320
+ $uploadedFileNameParts = explode('.',$attachment_temp[1]);
4321
+ $uploadedFileExtension = array_pop($uploadedFileNameParts);
4322
+
4323
+ $invalidFileExts = array('gif', 'jpg', 'jpeg', 'png', 'swf', 'psd', 'bmp', 'tiff', 'jpc', 'jp2', 'jpf', 'jb2', 'swc', 'aiff', 'wbmp', 'xbm' );
4324
+ $extOk = false;
4325
+
4326
+ foreach($invalidFileExts as $key => $valuee)
4327
+ {
4328
+ if(is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension) )) )
4329
+ $extOk = true;
4330
+ }
4331
+
4332
+ if ($extOk == true)
4333
+ $new_value .= '<img src="'.site_url().'/'.$attachment_temp.'" alt="'.$attachment_temp[1].'"/>';
4334
+
4335
+ }
4336
+ break;
4337
+ }
4338
+ case "type_hidden": {
4339
+ $element = isset($_POST[$key]) ? $_POST[$key] : NULL;
4340
+ if(isset($element)) {
4341
+ $new_value = $element;
4342
+ }
4343
+ break;
4344
+ }
4345
+ case "type_mark_map": {
4346
+ $element = isset($_POST['wdform_'.$key."_long".$id]) ? $_POST['wdform_'.$key."_long".$id] : NULL;
4347
+ if(isset($element)) {
4348
+ $new_value = 'Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$key."_lat".$id]) ? $_POST['wdform_'.$key."_lat".$id] : "");
4349
+ }
4350
+ break;
4351
+ }
4352
+ case "type_submitter_mail": {
4353
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4354
+ if(isset($element)) {
4355
+ $new_value = $element;
4356
+ }
4357
+ break;
4358
+ }
4359
+ case "type_time": {
4360
+ $hh = isset($_POST['wdform_'.$key."_hh".$id]) ? $_POST['wdform_'.$key."_hh".$id] : NULL;
4361
+ if(isset($hh)) {
4362
+ $ss = isset($_POST['wdform_'.$key."_ss".$id]) ? $_POST['wdform_'.$key."_ss".$id] : NULL;
4363
+ if(isset($ss)) {
4364
+ $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "") . ':' . $ss;
4365
+ }
4366
+ else {
4367
+ $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "");
4368
+ }
4369
+ $am_pm = isset($_POST['wdform_'.$key."_am_pm".$id]) ? $_POST['wdform_'.$key."_am_pm".$id] : NULL;
4370
+ if(isset($am_pm)) {
4371
+ $new_value = $new_value . ' ' . $am_pm;
4372
+ }
4373
+ }
4374
+ break;
4375
+ }
4376
+
4377
+ case "type_phone": {
4378
+ $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
4379
+ if(isset($element_first)) {
4380
+ $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
4381
+ }
4382
+ break;
4383
+ }
4384
+ case "type_name": {
4385
+ $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
4386
+ if(isset($element_first)) {
4387
+ $element_title = isset($_POST['wdform_'.$key."_element_title".$id]) ? $_POST['wdform_'.$key."_element_title".$id] : NULL;
4388
+ if(isset($element_title)) {
4389
+ $new_value = $element_title . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$key."_element_middle".$id]) ? $_POST['wdform_'.$key."_element_middle".$id] : "");
4390
+ }
4391
+ else {
4392
+ $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
4393
+ }
4394
+ }
4395
+ break;
4396
+ }
4397
+ case "type_address": {
4398
+ $street1 = isset($_POST['wdform_'.$key."_street1".$id]) ? $_POST['wdform_'.$key."_street1".$id] : NULL;
4399
+ if(isset($street1)) {
4400
+ $new_value = $street1;
4401
+ break;
4402
+ }
4403
+ $street2 = isset($_POST['wdform_'.$key."_street2".$id]) ? $_POST['wdform_'.$key."_street2".$id] : NULL;
4404
+ if(isset($street2)) {
4405
+ $new_value = $street2;
4406
+ break;
4407
+ }
4408
+ $city = isset($_POST['wdform_'.$key."_city".$id]) ? $_POST['wdform_'.$key."_city".$id] : NULL;
4409
+ if(isset($city)) {
4410
+ $new_value = $city;
4411
+ break;
4412
+ }
4413
+ $state = isset($_POST['wdform_'.$key."_state".$id]) ? $_POST['wdform_'.$key."_state".$id] : NULL;
4414
+ if(isset($state)) {
4415
+ $new_value = $state;
4416
+ break;
4417
+ }
4418
+ $postal = isset($_POST['wdform_'.$key."_postal".$id]) ? $_POST['wdform_'.$key."_postal".$id] : NULL;
4419
+ if(isset($postal)) {
4420
+ $new_value = $postal;
4421
+ break;
4422
+ }
4423
+ $country = isset($_POST['wdform_'.$key."_country".$id]) ? $_POST['wdform_'.$key."_country".$id] : NULL;
4424
+ if(isset($country)) {
4425
+ $new_value = $country;
4426
+ break;
4427
+ }
4428
+ break;
4429
+ }
4430
+ case "type_date_fields": {
4431
+ $day = isset($_POST['wdform_'.$key."_day".$id]) ? $_POST['wdform_'.$key."_day".$id] : NULL;
4432
+ if(isset($day)) {
4433
+ $new_value = $day . '-' . (isset($_POST['wdform_'.$key."_month".$id]) ? $_POST['wdform_'.$key."_month".$id] : "") . '-' . (isset($_POST['wdform_'.$key."_year".$id]) ? $_POST['wdform_'.$key."_year".$id] : "");
4434
+ }
4435
+ break;
4436
+ }
4437
+
4438
+ case "type_radio": {
4439
+ $element = isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : NULL;
4440
+ if(isset($element)) {
4441
+ $new_value = $element;
4442
+ break;
4443
+ }
4444
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4445
+ if(isset($element)) {
4446
+ $new_value = $element;
4447
+ }
4448
+ break;
4449
+ }
4450
+ case "type_checkbox": {
4451
+ $start = -1;
4452
+ for($j = 0; $j < 100; $j++) {
4453
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4454
+ if(isset($element)) {
4455
+ $start = $j;
4456
+ break;
4457
+ }
4458
+ }
4459
+ $other_element_id = -1;
4460
+ $is_other = isset($_POST['wdform_'.$key."_allow_other".$id]) ? $_POST['wdform_'.$key."_allow_other".$id] : "";
4461
+ if($is_other == "yes") {
4462
+ $other_element_id = isset($_POST['wdform_'.$key."_allow_other_num".$id]) ? $_POST['wdform_'.$key."_allow_other_num".$id] : "";
4463
+ }
4464
+ if($start != -1) {
4465
+ for($j = $start; $j < 100; $j++) {
4466
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4467
+ if(isset($element)) {
4468
+ if($j == $other_element_id) {
4469
+ $new_value = $new_value . (isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : "") . '<br>';
4470
+ }
4471
+ else {
4472
+ $new_value = $new_value . $element . '<br>';
4473
+ }
4474
+ }
4475
+ }
4476
+ }
4477
+ break;
4478
+ }
4479
+ case "type_paypal_price": {
4480
+ $new_value = 0;
4481
+ if(isset($_POST['wdform_'.$key."_element_dollars".$id])) {
4482
+ $new_value = $_POST['wdform_'.$key."_element_dollars".$id];
4483
+ }
4484
+ if(isset($_POST['wdform_'.$key."_element_cents".$id])) {
4485
+ $new_value = $new_value . '.' . $_POST['wdform_'.$key."_element_cents".$id];
4486
+ }
4487
+ $new_value = $new_value . $form_currency;
4488
+ break;
4489
+ }
4490
+ case "type_paypal_select": {
4491
+ $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ':' . (isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : "") . $form_currency;
4492
+ $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
4493
+ $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
4494
+ if (isset($element_quantity)) {
4495
+ $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
4496
+ }
4497
+ for($k = 0; $k < 50; $k++) {
4498
+ $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
4499
+ if(isset($temp_val)) {
4500
+ $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
4501
+ }
4502
+ }
4503
+ break;
4504
+ }
4505
+ case "type_paypal_radio": {
4506
+ $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ' - ' . (isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : "") . $form_currency;
4507
+ $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
4508
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
4509
+ if (isset($element_quantity)) {
4510
+ $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
4511
+ }
4512
+ for($k = 0; $k < 50; $k++) {
4513
+ $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
4514
+ if(isset($temp_val)) {
4515
+ $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
4516
+ }
4517
+ }
4518
+ break;
4519
+ }
4520
+ case "type_paypal_shipping": {
4521
+ $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ' : ' . (isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : "") . $form_currency;
4522
+ break;
4523
+ }
4524
+ case "type_paypal_checkbox": {
4525
+ $start = -1;
4526
+ for($j = 0; $j < 100; $j++) {
4527
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4528
+ if(isset($element)) {
4529
+ $start = $j;
4530
+ break;
4531
+ }
4532
+ }
4533
+ if($start != -1) {
4534
+ for($j = $start; $j < 100; $j++) {
4535
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
4536
+ if(isset($element)) {
4537
+ $new_value = $new_value . (isset($_POST['wdform_'.$key."_element".$id.$j."_label"]) ? $_POST['wdform_'.$key."_element".$id.$j."_label"] : "") . ' - ' . ($element == '' ? '0' . $form_currency : $element) . $form_currency . '<br>';
4538
+ }
4539
+ }
4540
+ }
4541
+ $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
4542
+ $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
4543
+ if (isset($element_quantity)) {
4544
+ $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
4545
+ }
4546
+ for($k = 0; $k < 50; $k++) {
4547
+ $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
4548
+ if(isset($temp_val)) {
4549
+ $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
4550
+ }
4551
+ }
4552
+ break;
4553
+ }
4554
+ case "type_paypal_total": {
4555
+ $element = isset($_POST['wdform_'.$key."_paypal_total".$id]) ? $_POST['wdform_'.$key."_paypal_total".$id] : "";
4556
+ $new_value = $new_value . $element;
4557
+ break;
4558
+ }
4559
+ case "type_star_rating": {
4560
+ $element = isset($_POST['wdform_'.$key."_star_amount".$id]) ? $_POST['wdform_'.$key."_star_amount".$id] : NULL;
4561
+ $selected = isset($_POST['wdform_'.$key."_selected_star_amount".$id]) ? $_POST['wdform_'.$key."_selected_star_amount".$id] : 0;
4562
+ if(isset($element)) {
4563
+ $new_value = $new_value . $selected . '/' . $element;
4564
+ }
4565
+ break;
4566
+ }
4567
+ case "type_scale_rating": {
4568
+ $element = isset($_POST['wdform_'.$key."_scale_amount".$id]) ? $_POST['wdform_'.$key."_scale_amount".$id] : NULL;
4569
+ $selected = isset($_POST['wdform_'.$key."_scale_radio".$id]) ? $_POST['wdform_'.$key."_scale_radio".$id] : 0;
4570
+ if(isset($element)) {
4571
+ $new_value = $new_value . $selected . '/' . $element;
4572
+ }
4573
+ break;
4574
+ }
4575
+ case "type_spinner": {
4576
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
4577
+ if(isset($element)) {
4578
+ $new_value = $new_value . $element;
4579
+ }
4580
+ break;
4581
+ }
4582
+ case "type_slider": {
4583
+ $element = isset($_POST['wdform_'.$key."_slider_value".$id]) ? $_POST['wdform_'.$key."_slider_value".$id] : NULL;
4584
+ if(isset($element)) {
4585
+ $new_value = $new_value . $element;
4586
+ }
4587
+ break;
4588
+ }
4589
+ case "type_range": {
4590
+ $element0 = isset($_POST['wdform_'.$key."_element".$id.'0']) ? $_POST['wdform_'.$key."_element".$id.'0'] : NULL;
4591
+ $element1 = isset($_POST['wdform_'.$key."_element".$id.'1']) ? $_POST['wdform_'.$key."_element".$id.'1'] : NULL;
4592
+ if(isset($element0) || isset($element1)) {
4593
+ $new_value = $new_value . $element0 . '-' . $element1;
4594
+ }
4595
+ break;
4596
+ }
4597
+ case "type_grading": {
4598
+ $element = isset($_POST['wdform_'.$key."_hidden_item".$id]) ? $_POST['wdform_'.$key."_hidden_item".$id] : "";
4599
+ $grading = explode(":", $element);
4600
+ $items_count = sizeof($grading) - 1;
4601
+ $element = "";
4602
+ $total = "";
4603
+ for($k = 0;$k < $items_count; $k++) {
4604
+ $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : "") . " ";
4605
+ $total += (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : 0);
4606
+ }
4607
+ $element .="Total:" . $total;
4608
+ if(isset($element)) {
4609
+ $new_value = $new_value . $element;
4610
+ }
4611
+ break;
4612
+ }
4613
+ case "type_matrix": {
4614
+ $input_type = isset($_POST['wdform_'.$key."_input_type".$id]) ? $_POST['wdform_'.$key."_input_type".$id] : "";
4615
+ $mat_rows = explode("***", isset($_POST['wdform_'.$key."_hidden_row".$id]) ? $_POST['wdform_'.$key."_hidden_row".$id] : "");
4616
+ $rows_count = sizeof($mat_rows) - 1;
4617
+ $mat_columns = explode("***", isset($_POST['wdform_'.$key."_hidden_column".$id]) ? $_POST['wdform_'.$key."_hidden_column".$id] : "");
4618
+ $columns_count = sizeof($mat_columns) - 1;
4619
+ $matrix="<table>";
4620
+ $matrix .='<tr><td></td>';
4621
+ for( $k=1;$k< count($mat_columns) ;$k++) {
4622
+ $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
4623
+ }
4624
+ $matrix .= '</tr>';
4625
+ $aaa=Array();
4626
+ for($k=1; $k<=$rows_count; $k++) {
4627
+ $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
4628
+ if($input_type=="radio") {
4629
+ $mat_radio = isset($_POST['wdform_'.$key."_input_element".$id.$k]) ? $_POST['wdform_'.$key."_input_element".$id.$k] : 0;
4630
+ if($mat_radio == 0) {
4631
+ $checked = "";
4632
+ $aaa[1] = "";
4633
+ }
4634
+ else {
4635
+ $aaa = explode("_", $mat_radio);
4636
+ }
4637
+
4638
+ for($j = 1; $j <= $columns_count; $j++) {
4639
+ if($aaa[1]==$j) {
4640
+ $checked="checked";
4641
+ }
4642
+ else {
4643
+ $checked="";
4644
+ }
4645
+ $matrix .= '<td style="text-align:center"><input type="radio" ' . $checked . ' disabled /></td>';
4646
+ }
4647
+ }
4648
+ else {
4649
+ if($input_type == "checkbox") {
4650
+ for($j = 1; $j <= $columns_count; $j++) {
4651
+ $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j] : 0;
4652
+ if($checked==1) {
4653
+ $checked = "checked";
4654
+ }
4655
+ else {
4656
+ $checked = "";
4657
+ }
4658
+ $matrix .= '<td style="text-align:center"><input type="checkbox" ' . $checked . ' disabled /></td>';
4659
+ }
4660
+ }
4661
+ else {
4662
+ if($input_type == "text") {
4663
+ for($j = 1; $j <= $columns_count; $j++) {
4664
+ $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j] : "";
4665
+ $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
4666
+ }
4667
+ }
4668
+ else {
4669
+ for($j = 1; $j <= $columns_count; $j++) {
4670
+ $checked = isset($_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j] : "";
4671
+ $matrix .= '<td style="text-align:center">' . $checked . '</td>';
4672
+ }
4673
+ }
4674
+ }
4675
+ }
4676
+ $matrix .= '</tr>';
4677
+ }
4678
+ $matrix .= '</table>';
4679
+ if(isset($matrix)) {
4680
+ $new_value = $new_value . $matrix;
4681
+ }
4682
+ break;
4683
+ }
4684
+ default: break;
4685
+ }
4686
+ // $new_script = str_replace("%" . $label_each . "%", $new_value, $new_script);
4687
+ }
4688
+
4689
+ return $new_value;
4690
+ }
4691
+
4692
+ public function empty_field($element, $mail_emptyfields) {
4693
+ if(!$mail_emptyfields)
4694
+ if(empty($element))
4695
+ return 0;
4696
+
4697
+ return 1;
4698
+ }
4699
+ ////////////////////////////////////////////////////////////////////////////////////////
4700
+ // Getters & Setters //
4701
+ ////////////////////////////////////////////////////////////////////////////////////////
4702
+ ////////////////////////////////////////////////////////////////////////////////////////
4703
+ // Private Methods //
4704
+ ////////////////////////////////////////////////////////////////////////////////////////
4705
+ ////////////////////////////////////////////////////////////////////////////////////////
4706
+ // Listeners //
4707
+ ////////////////////////////////////////////////////////////////////////////////////////
4708
  }
readme.txt CHANGED
@@ -1,420 +1,425 @@
1
- === Contact Form ===
2
- Contributors: webdorado
3
- Donate link: http://web-dorado.com/products/wordpress-contact-form-maker-plugin.html
4
- Tags: captcha, contact, contact form, contact forms, custom form, email, feedback, form, form builder, form manager, forms, survey
5
- Requires at least: 3.4
6
- Tested up to: 4.7
7
- Stable tag: 1.8.38
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Form plugin is a simple contact form builder tool, which allows the user to create and edit different type of contact forms.
12
-
13
- == Description ==
14
- Create simple contact forms or complex applications forms with this FREE and intuitive WordPress plugin. No coding knowledge is required.
15
-
16
- [WordPress Contact Form Maker](http://web-dorado.com/products/wordpress-contact-form-maker-plugin.html)
17
-
18
- WordPress Contact Form Maker is a simple contact form builder, which allows the user with almost no knowledge of programming to create and edit different type of contact forms. The product is similar to the WordPress Form Maker using most of its functionality, whereas there are also some differences. If want to build complicated contact forms with various field types like Date, Time, Single choice, Multiple choice, etc., than you can use [WordPress Form Builder](http://wordpress.org/extend/plugins/form-maker).
19
-
20
- The number of fields for the Contact Form Maker is unlimited and having large amount of fields will not cause any malfunctioning of the contact form. You can add different types of contact form fields, including inputs (e.g. e-mail, password, textarea, text input and etc.), Captcha (as well as possibility of adding Google standard ReCaptcha), custom and standard buttons, as well as Map field.
21
-
22
- WordPress Contact Form Maker uses simple and easy to manage backend interface, thus the users which are not able to make code-level changes, will be able to make customization and changes using parameters.
23
-
24
- This contact form builder will be equally fit the needs of the novice and experienced developers and designers.
25
-
26
- The product has cross-browser compatibility, which allows using the Contact form for with any browser.
27
- ###IMPORTANT: If you think you found a bug in the Contact Form Maker or have any problem or question concerning Contact Form Maker, do not hesitate to contact us at [info@web-dorado.com](mailto:info@web-dorado.com).
28
-
29
-
30
- ###Features of the Contact Form Maker
31
-
32
- * WordPress 3.0+
33
- * 7 field types of the Contact Form Maker.
34
- * Custom HTML
35
- * Text Input (10 sub-types)
36
- * Captcha
37
- * Page break
38
- * Section break
39
- * Map
40
- * Button
41
- * Possibility to add Custom HTML between the fields .
42
- * Pagination.
43
- * Support for section break.
44
- * Possibility of add custom CSS and Javascript.
45
- * Additional attributes for each field to add certain properties using Java Script.
46
- * Submissions are send to the provided admin address(es) and submitter (optional).
47
- * Custom text for admin and users
48
- * Shortcode for easier input of the created contact form into Pages/Posts.
49
- * Chance to add custom HTML.
50
- * Detailed parameters for each field type.
51
- * Data validation before the submission of the contact form.
52
- * Detailed Submissions field including the submissions of all contact forms.
53
- * 10 built-in templates.
54
- * Required and hidden fields for advanced contact forms.
55
- * Conditional fields
56
-
57
-
58
- ### Supported languages Of the Contact Form Maker
59
-
60
- *If you need language of the Contact Form Maker which is not included in this list, please contact us and we will do the translation of Contact Form Maker within 3 days. If you find any mistakes in the translation of the Contact Form Maker, please contact us and we will make relevant corrections within 3 days.*
61
-
62
- Afrikaans (af)
63
- Albanian (sq)
64
- Arabic (ar)
65
- Armenian (hy_AM)
66
- Belarusian (be_BY)
67
- Bulgarian (bg_BG)
68
- Catalan (ca)
69
- Chinese, Simplified (zh_CN)
70
- Croatian (hr)
71
- Czech (cs_CZ)
72
- Danish (da_DK)
73
- Dutch (nl_NL)
74
- Esperanto (eo_EO)
75
- Estonian (et)
76
- Finnish (fi)
77
- French (fr_FR)
78
- Galician (gl_ES)
79
- Georgian (ka_GE)
80
- German (de_DE)
81
- Greek (el)
82
- Hebrew (he_IL)
83
- Hindi (hi_IN)
84
- Hungarian (hu_HU)
85
- Indonesian (id_ID)
86
- Italian (it_IT)
87
- Japanese (ja)
88
- Korean (ko_KR)
89
- Latvian (lv)
90
- Lithuanian (lt_LT)
91
- Macedonian (mk_MK)
92
- Malay (ms_MY)
93
- Maltese (mt_MT)
94
- Norwegian (nb_NO)
95
- Persian (fa_IR)
96
- Polish (pl_PL)
97
- Portuguese (pt_PT)
98
- Russian (ru_RU)
99
- Romanian (ro_RO)
100
- Serbian (sr_RS)
101
- Slovak (sk_SK)
102
- Spanish (es_ES)
103
- Swedish (sv_SE)
104
- Tamil (ta)
105
- Thai (th)
106
- Turkish (tr_TR)
107
- Ukrainian (uk_UA)
108
- Vietnamese (vi)
109
-
110
- == Installation ==
111
-
112
- ####Thank you for your interest in [WordPress Contact Form](http://wordpress.org/plugins/contact-form-maker/).
113
-
114
- ### Minimum requirements.
115
- * Wordpress 3.0+
116
- * PHP 5.x
117
- * MySQL 5.x
118
-
119
- ### Perform a new installation
120
-
121
- After downloading the ZIP file,
122
-
123
- 1. Log in to the administrator panel.
124
- 2. Go to Plugins Add > New > Upload.
125
- 3. Click “Choose file” (“Browse”) and select the downloaded zip file.
126
- *For Mac Users*
127
- *Go to your Downloads folder and locate the folder with the plugin. Right-click on the folder and select Compress. Now you have a newly created .zip file which can be installed as described here.*
128
- 4. Click “Install Now” button.
129
- 5. Click “Activate Plugin” button for activating the plugin.
130
- 6.If the installation does not succeed, please contact us at info@web-dorado.com.
131
-
132
- ### Updating the contact form.
133
-
134
- If you want to update the plugin while preserving your existing contact forms, you need to deactivate and delete the Contact Form Maker from the list of installed plugins (Do not uninstall it using the Uninstall Contact Form Maker option of the plugin) and install the new plugin. Afterwards, go to Contact Form Maker>Manager and on the upper hand of the screen click on the “Update Contact Forms” button. If the update is successful, you will see a notification message saying, “All Contact forms are updated!”.
135
-
136
-
137
- == Screenshots ==
138
- 1. [WordPress Contact Form](http://wordpress.org/plugins/contact-form-maker/) - Sample RSVP
139
- 2. Contact Form Maker - Sample contact form
140
- 3. Contact Form Maker - Manage contact forms
141
- 4. Contact Form Maker - Creating a new conact contact form
142
- 5. Contact Form Maker - Text input field type
143
- 6. Contact Form Maker - Captcha field type
144
- 7. Contact Form Maker - Manage submissions
145
- 8. Contact Form Maker - Select Columns
146
-
147
- == Changelog ==
148
-
149
- = 1.8.38 =
150
- * Bug On Search by ID in Submissions
151
- * Added: Mailchimp in featured plugins
152
-
153
- = 1.8.37 =
154
- * Fixed: Bug on edit_old() function for old forms.
155
-
156
- = 1.8.36 =
157
- * Changed: Featured Themes page
158
-
159
- = 1.8.35 =
160
- * Fixed: Update from very old version
161
-
162
- = 1.8.34 =
163
- * Changed: Featured plugins page
164
-
165
- = 1.8.33 =
166
- * Fixed: Unexpected behaviour on pressing "Enter" key on back end
167
-
168
- = 1.8.32 =
169
- * Fixed: JS error on incorrect Google Maps API key
170
- * Added: Alert about incorrect Google Maps API key
171
-
172
- = 1.8.31 =
173
- * Added: Global option for Google Maps API key
174
- * Fixed: Google Maps API key warning in browser
175
-
176
- = 1.8.30 =
177
- * Fixed: bug in new form
178
-
179
- = 1.8.29 =
180
- * Fixed: bug in widget
181
-
182
- = 1.8.28 =
183
- * minor bug fixed
184
-
185
- = 1.8.27 =
186
- * Major update
187
-
188
- = 1.7.33 =
189
- * Changed: Compability with WordPress 4.3
190
-
191
- = 1.7.32 =
192
- * Minor bug fixed
193
-
194
- = 1.7.31 =
195
- * Security issue fixed
196
-
197
- = 1.7.29 =
198
- * Cache issue fixed
199
-
200
- = 1.7.28 =
201
- * Bug fixed: Empty email "From name"
202
-
203
- = 1.7.27 =
204
- * bug fixed in csv\xml export
205
-
206
- = 1.7.26 =
207
- * bug fixed in email content
208
-
209
- = 1.7.25 =
210
- * remove fancybox
211
-
212
- = 1.7.24 =
213
- * display php function to publish form
214
-
215
- = 1.7.20 =
216
- * 4.0.1 shortcode issue fixed
217
-
218
- = 1.6.1 =
219
- * Added featured plugins
220
-
221
- = 1.6.0 =
222
- * From Name, From Email in Contact Form options
223
-
224
- = 1.5.0 =
225
- * Survey Tools (Star Rating, Scale Rating, Spinner, Slider, Range, Grading, Matrix)
226
-
227
- = 1.4.0 =
228
- * Customizable Email message for Administrator and Users
229
-
230
- = 1.3.0 =
231
- * Actions after [WordPress Contact Form](http://wordpress.org/plugins/contact-form-maker/) Submission:
232
- - Stay on contact form:
233
- - To go to Post,Page after the contact form submission:
234
- - Custom text after the contact form submission:
235
- - URL: The user is redirected to the provided URL after the contact form submission.
236
- * Edit javascript of the contact form:
237
- * Save as the copy of the contact form:
238
- * Themes: There are 43 standard themes included in Contact Form Maker
239
- * New contact form fields:
240
- - Address field
241
- - Address mark on map contact form field
242
- - Number contact form field
243
- - Phone contact form field
244
- - Date 3 different contact form field
245
- - Time contact form field
246
- - Country list contact form field
247
- - Recapthca contact form field
248
- * Pagebreak of the Contact Form Maker: This can be used to break the contact form into distinct pages.
249
- * Section Break of the Contact Form Maker: This option allows adding a section break to the contact form page.
250
- * For each contact form certain types of statistical data are available in the Contact Form Maker:
251
- * Entries of a contact form: The number of submitted contact forms in the Contact Form Maker.
252
- * Views of a contact form: The number of times the contact form has been viewed.
253
- * Conversion Rate of a contact form: The percentage of submitted contact forms to the overall number of views.
254
-
255
-
256
- ==Contact Form Maker Step by step guide==
257
- ### Step 1: Installing the [wordpress contact form](http://wordpress.org/plugins/contact-form-maker/)
258
-
259
- 1.1 Minimum requirements.
260
- Wordpress 3.0+
261
- PHP 5.x
262
- MySQL 5.x
263
-
264
- 1.2 Perform a new installation.
265
- Log in to the administrator panel.
266
- Go to Plugins Add > New > Upload.
267
- Click “Choose file” (“Browse”) and select the Contact Form Maker zip file.
268
- *For Mac Users*
269
- *Go to your Downloads folder and locate the folder with the plugin. Right-click on the folder and select Compress. Now you have a newly created .zip file which can be installed as described here.*
270
- Click “Install Now” button.
271
- If the installation succeeded you will see the message in the picture. Click “Activate Plugin” button for activating the plugin.
272
- If any problem occurs, please contact us at info@web-dorado.com.
273
-
274
- 1.3 Updating the contact form.
275
-
276
- If you want to update the plugin while preserving your existing contact forms, you need to deactivate and delete the Contact Form Maker from the list of installed plugins (Do not uninstall it using the Uninstall Contact Form Maker option of the plugin) and install the new plugin. Afterwards, go to Contact Form Maker>Manager and on the upper hand of the screen click on the Update Contact Forms” button. If the update is successful, you will see a notification message saying, “All Contact forms are updated!”.
277
-
278
-
279
- = Step 2: Creating a new contact form =
280
-
281
- 2.1 On the left menu select Contact Form Maker > Manager
282
- 2.2 In the upper left corner click on the “Add a form” button.
283
- 2.3 Contact Form Title. Specify a title for the contact form.
284
-
285
-
286
- = Step 3: Configuring Contact Form Options =
287
-
288
- 3.1 General Options
289
- 3.1.1 Email to send submissions to. Here you provide e-mails to which submitted contact form information is sent. If you need more than one e-mail address, you must separate them by commas. This field is not required. In any case, the submitted information is stored in “Submissions” part, where it can be easily managed.
290
- 3.1.2 Email From. Here you define the email address from which the users receive the submission email (sender’s email).
291
- 3.1.3 From Name. Here you define the sender’s name which is shown in submission email.
292
- 3.1.4 Theme. A distinct theme can be applied to each new contact form. The themes can be accessed by selecting Contact Form Maker > Themes on the top menu. 41 themes are available for selection. There is an option for creating new themes, which you can access by clicking “New” on the upper right corner of the section.
293
-
294
- 3.2 Actions after Submission
295
- Here you can select the action that takes place after contact form submission. Following options are available:
296
- - Stay on contact form: The user stays on the contact form page.
297
- - Article: The user is redirected to the selected article.
298
- - Custom text: Custom text is displayed on the screen.
299
- - URL: The user is redirected to the provided URL.
300
- 3.3 Payment Options
301
- 3.3.1 Turn on PayPal. Allows making PayPal paymentsusing Contact Form Maker.
302
- 3.3.2 Checkout Mode. Choose the checkout mode:
303
- Production (https://developer.paypal.com/webapps/developer/docs/classic/lifecycle/goingLive/)
304
- Test Mode (https://developer.paypal.com/webapps/developer/docs/integration/direct/test-the-api/)
305
- 3.3.3 PayPal Email. Enter your PayPal email.
306
- 3.3.4 PayPal Currency. Choose your PayPal currency.
307
- 3.3.5 Tax. Add the tax amount if any.
308
- 3.4 JavaScript
309
- Here you can define new JavaScript functions, which can be applied to the contact form. Three empty event functions are included:
310
- - before_load(): before the contact form is loaded
311
- - before_submit(): before the contact form is submitted
312
- - before_reset(): before the contact form is reset
313
- 3.5 Custom Text in Email
314
- For Administrator. Here you can add custom texts, images, and custom HTML to the e-mail message that is sent to the administrator, as well as choose which fields of the submitted contact form are included in the e-mail (set to ‘all’ by default).
315
- For User. Here you can add custom texts, images, and custom HTML to the e-mail message that is sent to the users, as well as choose which fields of the submitted contact form are included in the e-mail (set to ‘all’ by default).
316
-
317
- = Step 4: Description of the contact form fields =
318
-
319
- 4.1 Custom HTML:An HTML editor. You can insert your own HTML content to your WordPress contact form.
320
-
321
- 4.2 Text Input: At first choose the Field Type according to your preference. There are several options:
322
- Simple Text: This can be used for typing some text. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Required, Allow only unique values, Additional Attributes
323
-
324
- Password: This field can be used for adding a password field to your contact form. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Allow only unique values, Additional Attributes
325
- Text Area: This field can be used for typing some text. The difference between Text Area and Simple Text is that Simple Text has only one row while Text Area can have several rows. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Required, Allow only unique values, Additional Attributes
326
- Name: This can be used for typing a name. Default field labels can be edited clicking on the field label and typing in a custom label. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Value If Empty, Field Size, Name Format, Class Name, Required, Allow only unique values, Additional Attributes
327
- Address: This field can be used for adding an address. Default field labels can be edited clicking on the label and typing in a custom label. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Overall Size, Class Name, Disable Fields, Required, Additional Attributes
328
- Address (Mark on Map):This filed can be used for adding an address by directly marking it on the map. It has several attributes: Field Label, Field Label Position, Default Location, Map Size, Marker Info, Class Name, Additional Attributes
329
- E-mail:This field can be used for typing the submitter’s e-mail. The submitted e-mail validation is checked. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Send mail to submitter, Required, Allow only unique values, Additional Attributes.
330
- Number: This field can be used to provide numbers for different purposes (e.g. serial number). It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Required, Allow only unique values, Additional Attributes
331
- Phone: This field can be used to provide a phone number. Default field labels can be edited clicking on the label and typing in a custom label. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Value If Empty, Field Size, Class Name, Required, Allow only unique values, Additional Attributes
332
- Hidden Field: This field can be used to store additional information that does not need to be displayed. It has several attributes : Field ld, Field Name, Field Value, Additional Attributes.
333
- 4.3 Time and Date: Choose the Field Type according to your preference. There are several options:
334
- Date (single field with a picker): This field can be used for typing a date or choosing by the picker. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Date format, Date Picker Label, Class Name, Required, Additional Attributes.
335
- Date (3 separate fields): This field can be used for typing a date in 3 field format(day, month, year). Default field labels can be edited clicking on the field label and typing in a custom label. Each of the 3 fields can be set as text input or select list. Each of the 3 fields has the attributes Field Size and Field Label. For year field the select list interval can be defined. These 3 fields can be separated in the format set by the fields separator attribute. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Required, Additional Attributes.
336
- Time: This field can be used for typing a time. Default field labels can be edited clicking on the field label and typing in a custom label. Time can be shown in 24 hour or 12 hour formats by setting the time format attribute. The seconds preview can be enabled/disabled by setting the Display Seconds attribute. The field has several standard attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Required, Additional Attributes.
337
- 4.4 Select: Choose the Field Type according to your preference. There are several options:
338
- Custom select: This field can be used for selecting the values from a list. The list can be defined by Options attribute. You can easily add and remove list items. The checked items are considered as empty values. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Additional Attributes.
339
- Country list: This field can be used for selecting a country from a list. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Additional Attributes.
340
- 4.5 Checkbox: This field can be used for selecting the values from a list of checkboxes. The list can be defined by Options attribute. You can easily add and remove list items. The list can be displayed in horizontal/vertical positions by setting the Relative Position attribute. You can use Rows/Columns field if you want the options to be displayed in a row/column (depending on the positioning choice). The number of rows/columns should be specified. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Randomize in frontend, Allow other, Additional Attributes.
341
-
342
- 4.6Radio:This field can be used for selecting the values from a list of radio buttons. The list can be defined by Options attribute. You can use Rows/Columns field if you want the options to be displayed in a row/column (depending on the positioning choice). The number of rows/columns should be specified. You can easily add and remove list items. The list can be displayed in horizontal/vertical positions by setting the Relative Position attribute.The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Randomize in frontend, Allow other, Additional Attributes.
343
-
344
- 4.7 File Upload: This field can be used for uploading a file. The size of the uploaded file can be limited by setting the value of Maximum Size attribute in KB. The upload folder can be mentioned by setting the Destination attribute. Only files with extensions listed in Allowed file extensions attribute can be uploaded. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Required, Additional Attributes.
345
-
346
- 4.8 Captcha:This field can be used for the ensuring that the submission is generated by a person. Choose the Field Type according to your preference. There are several options:
347
- Simple Captcha This is a easy to configure Simple Captcha. The number of randomly generated symbols can be set by the value of Captcha size attribute. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Additional Attributes.
348
- Recaptcha This is an alternative option for Captcha that uses Public and Private Keys. You will need to create reCaptcha keys with the help of a dedicated tool.The tool can be found on https://www.google.com/recaptcha/admin/create.
349
-
350
- 4.9 Page Break: This can be used to break the contact form into distinct pages. Use Page Title to provide a title for the given page. Furthermore, the following parameters of the “Next” and “Previous” navigation buttons can be customized:
351
- Type, Name, Class Name, Check the required fields , Additional Attributes.
352
-
353
- 4.10 Section Break: This option allows adding a section break to the contact form page.
354
-
355
- 4.11 Map: This field can be used for pointing out some position on the map. The position of the marker is fixed at the front end. Multiple locations can be selected by clicking the + button. The field has several attributes:
356
- Location, Map Size, Marker Info, Class Name, Additional Attributes.
357
-
358
- 4.12 PayPal: Choose the Field Type. The following options are available:
359
- Amount (Price) This field is for indicating the amount of payment. Default field labels can be edited clicking on the field label and typing in a custom label. You can configure the following attributes: Field Label, Field Label Position, Range, Value If Empty, Field Size, Class Name, Required, Hide Cents, and Additional Attributes.
360
- Select This field can be used for selecting a product/service for which the payment is being made. The list (each item consists of “Product name” and its “Price”)can be specified by the Options attribute. You can easily add and remove list items. There is also a Product Properties parameter, where you can add different properties (e.g. size) by specifying the type, the name, and adding options for selection. The checked items are considered as empty values. You can configure the following attributes: Field Label, Field Label Position, Field Size, Class Name, Required, and Additional Attributes.
361
- Checkbox This field can be used for selecting multiple products/services for which the payment is being made. The options (each item consists of “Product name” and its “Price”) can be specified by the Options attribute. You can easily add and remove list items. There is also a quantity property parameter where the quantity of products/services can be specified. Moreover, there is a Product Properties parameter, where you can add different properties (e.g. size) by specifying the type, the name, and adding options for selection. You can configure the following attributes: Field Label, Field Label Position, Relative Position, Class Name, Required, and Additional Attributes.
362
- Radio This field can be used for selecting the product/service for which the payment is being made. The options (each item consists of “Product name” and its “Price”) can be specified by the Options attribute. You can easily add and remove list items. There is also a quantity property parameter where the quantity of products/services can be specified. Moreover, there is a Product Properties parameter, where you can add different properties (e.g. size) by specifying the type, the name, and adding options for selection. You can configure the following attributes: Field Label, Field Label Position, Relative Position, Class Name, Required, and Additional Attributes.
363
- Shipping This field can be used for selecting the shipping option for the selected product. The options (each item consists of a “Type” and “Price” parameters) can be specified by the Options attribute. You can easily add and remove list items. You can configure the following attributes: Field Label, Field Label Position, Relative Position, Class Name, Required, and Additional Attributes.
364
- Total This field calculates the total sum to be paid via PayPal, including the payments for the shipping and taxes (if applicable).
365
-
366
- 4.13 Survey Tools: Choose the Field Type according to your preferences. There are several options:
367
- Star Rating: This field can be used for inserting star rating field in the contact form. Type the name of the field to be displayed with the rating system. The field has several attributes: Field Label Position, Star Amount, Star Color, Class Name, Required, and Additional Attributes.
368
- Scale Rating: This field can be used for inserting scale rating in the contact form. Type the name of the field to be displayed with the rating system.Default field labels for lowest/highest satisfaction/grading can be edited clicking on the field label and typing in a custom label. The field has several attributes: Field Label Position, Scale Amount, Class Name, Required, and Additional Attributes.
369
- Spinner: This field can be used for inserting spinner as a rating system in the contact form. Type the name of the field to be displayed with the rating system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Width, Min Value, Max Value, Step, Class Name, Required, and Additional Attributes.
370
- Slider: This field can be used for inserting slider as a rating system in the contact form. Type the name of the field to be displayed with the rating system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Width, Min Value, Max Value, Class Name, Required, and Additional Attributes.
371
- Range: This field can be used for inserting range system in the contact form. Type the name of the field to be displayed with the range system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Width, Step, Class Name, Required, and Additional Attributes.
372
- Grading: This field can be used for inserting grading system in the contact form. Type the name of the field to be displayed with the grading system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Total, Items, Class Name, Required, and Additional Attributes.
373
- Matrix: This field can be used for inserting a matrix in the contact form. Type the name of the field to be displayed with the matrix. The field has several attributes: Field Label, Field Label Position, Input Type, Rows, Columns, Class Name, Required, and Additional Attributes.
374
- 4.14 Submit Button: Choose the Field Type according to your preference. There are several options:
375
- Submit and Reset: This field can be used for inserting a submit/reset button into the contact form. You can display reset button by checking the box called Display reset button. Type the name of the submit and reset buttons in Submit button label and Reset button label. The field also has several attributes: Class Name and Additional Attributes.
376
- Custom: This field can be used for inserting custom buttons into the contact form. Type the name of each button in button name field. You can define click functions for each button. The field also has several attributes: Class Name and Additional Attributes.
377
-
378
- = Step 5: Publishing the created contact form. =
379
-
380
- To insert a contact form into a Page or a Post.
381
-
382
-
383
-
384
- 5.1. Press the button named Insert Contact Form Maker in a post or a page you want to show the contact form.
385
-
386
- 5.2. Select a contact form from the list.
387
-
388
-
389
-
390
- 5.3. Save the page or the post.
391
-
392
- Alternatively, you can use Contact Form Maker without the button on the toolbar: Add the shortcode [wd_contact_form id="N"] (where N is the id of the contact form, for the contact form with id=2, the shortcode must be [wd_contact_form id="2"]) to the pages and posts, where you want the contact form to appear.
393
-
394
-
395
- = Step 6: Managing submissions of the contact form. =
396
-
397
- 6.1 On the left menu select Contact Form Maker > Submissions
398
-
399
- 6.2 In order to manage a contact form's submissions, select the contact form from the list.
400
-
401
- 6.3 For each contact form certain types of statistical data are available:
402
- - Entries: The number of submitted contact forms.
403
- - Views: The number of times the contact form has been viewed.
404
- - Conversion Rate: The percentage of submitted contact forms to the overall number of views.
405
-
406
- 6.4 For the contact forms that contain checkboxes or radio buttons a separate statistics is available. It shows how many times a particular checkbox/radio button has been checked, and what is the ratio of that number to the overall number of checks.
407
-
408
- 6.5 There is a possibility to search the submissions database by all the relevant fields of the given contact form. Submissions can be sorted by any of the fields of the contact form by clicking the labels.
409
-
410
-
411
- 6.6 You can delete any of submissions by selecting them and pressing the “Delete” button on the top of the page.
412
-
413
- 6.7 It is also possible to edit the submissions by clicking on the “Edit” icon on the upper right corner of the “Submissions” section.
414
-
415
-
416
- 6.8 You can add/remove any column of the submissions by “Add/Remove Columns” button.
417
-
418
-
419
-
 
 
 
 
 
420
  6.9 The submissions can be exported to the CSV and XML formats.
1
+ === Contact Form ===
2
+ Contributors: webdorado
3
+ Donate link: http://web-dorado.com/products/wordpress-contact-form-maker-plugin.html
4
+ Tags: captcha, contact, contact form, contact forms, custom form, email, feedback, form, form builder, form manager, forms, survey
5
+ Requires at least: 3.4
6
+ Tested up to: 4.7
7
+ Stable tag: 1.8.39
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Form plugin is a simple contact form builder tool, which allows the user to create and edit different type of contact forms.
12
+
13
+ == Description ==
14
+ Create simple contact forms or complex applications forms with this FREE and intuitive WordPress plugin. No coding knowledge is required.
15
+
16
+ [WordPress Contact Form Maker](http://web-dorado.com/products/wordpress-contact-form-maker-plugin.html)
17
+
18
+ WordPress Contact Form Maker is a simple contact form builder, which allows the user with almost no knowledge of programming to create and edit different type of contact forms. The product is similar to the WordPress Form Maker using most of its functionality, whereas there are also some differences. If want to build complicated contact forms with various field types like Date, Time, Single choice, Multiple choice, etc., than you can use [WordPress Form Builder](http://wordpress.org/extend/plugins/form-maker).
19
+
20
+ The number of fields for the Contact Form Maker is unlimited and having large amount of fields will not cause any malfunctioning of the contact form. You can add different types of contact form fields, including inputs (e.g. e-mail, password, textarea, text input and etc.), Captcha (as well as possibility of adding Google standard ReCaptcha), custom and standard buttons, as well as Map field.
21
+
22
+ WordPress Contact Form Maker uses simple and easy to manage backend interface, thus the users which are not able to make code-level changes, will be able to make customization and changes using parameters.
23
+
24
+ This contact form builder will be equally fit the needs of the novice and experienced developers and designers.
25
+
26
+ The product has cross-browser compatibility, which allows using the Contact form for with any browser.
27
+ ###IMPORTANT: If you think you found a bug in the Contact Form Maker or have any problem or question concerning Contact Form Maker, do not hesitate to contact us at [info@web-dorado.com](mailto:info@web-dorado.com).
28
+
29
+
30
+ ###Features of the Contact Form Maker
31
+
32
+ * WordPress 3.0+
33
+ * 7 field types of the Contact Form Maker.
34
+ * Custom HTML
35
+ * Text Input (10 sub-types)
36
+ * Captcha
37
+ * Page break
38
+ * Section break
39
+ * Map
40
+ * Button
41
+ * Possibility to add Custom HTML between the fields .
42
+ * Pagination.
43
+ * Support for section break.
44
+ * Possibility of add custom CSS and Javascript.
45
+ * Additional attributes for each field to add certain properties using Java Script.
46
+ * Submissions are send to the provided admin address(es) and submitter (optional).
47
+ * Custom text for admin and users
48
+ * Shortcode for easier input of the created contact form into Pages/Posts.
49
+ * Chance to add custom HTML.
50
+ * Detailed parameters for each field type.
51
+ * Data validation before the submission of the contact form.
52
+ * Detailed Submissions field including the submissions of all contact forms.
53
+ * 10 built-in templates.
54
+ * Required and hidden fields for advanced contact forms.
55
+ * Conditional fields
56
+
57
+
58
+ ### Supported languages Of the Contact Form Maker
59
+
60
+ *If you need language of the Contact Form Maker which is not included in this list, please contact us and we will do the translation of Contact Form Maker within 3 days. If you find any mistakes in the translation of the Contact Form Maker, please contact us and we will make relevant corrections within 3 days.*
61
+
62
+ Afrikaans (af)
63
+ Albanian (sq)
64
+ Arabic (ar)
65
+ Armenian (hy_AM)
66
+ Belarusian (be_BY)
67
+ Bulgarian (bg_BG)
68
+ Catalan (ca)
69
+ Chinese, Simplified (zh_CN)
70
+ Croatian (hr)
71
+ Czech (cs_CZ)
72
+ Danish (da_DK)
73
+ Dutch (nl_NL)
74
+ Esperanto (eo_EO)
75
+ Estonian (et)
76
+ Finnish (fi)
77
+ French (fr_FR)
78
+ Galician (gl_ES)
79
+ Georgian (ka_GE)
80
+ German (de_DE)
81
+ Greek (el)
82
+ Hebrew (he_IL)
83
+ Hindi (hi_IN)
84
+ Hungarian (hu_HU)
85
+ Indonesian (id_ID)
86
+ Italian (it_IT)
87
+ Japanese (ja)
88
+ Korean (ko_KR)
89
+ Latvian (lv)
90
+ Lithuanian (lt_LT)
91
+ Macedonian (mk_MK)
92
+ Malay (ms_MY)
93
+ Maltese (mt_MT)
94
+ Norwegian (nb_NO)
95
+ Persian (fa_IR)
96
+ Polish (pl_PL)
97
+ Portuguese (pt_PT)
98
+ Russian (ru_RU)
99
+ Romanian (ro_RO)
100
+ Serbian (sr_RS)
101
+ Slovak (sk_SK)
102
+ Spanish (es_ES)
103
+ Swedish (sv_SE)
104
+ Tamil (ta)
105
+ Thai (th)
106
+ Turkish (tr_TR)
107
+ Ukrainian (uk_UA)
108
+ Vietnamese (vi)
109
+
110
+ == Installation ==
111
+
112
+ ####Thank you for your interest in [WordPress Contact Form](http://wordpress.org/plugins/contact-form-maker/).
113
+
114
+ ### Minimum requirements.
115
+ * Wordpress 3.0+
116
+ * PHP 5.x
117
+ * MySQL 5.x
118
+
119
+ ### Perform a new installation
120
+
121
+ After downloading the ZIP file,
122
+
123
+ 1. Log in to the administrator panel.
124
+ 2. Go to Plugins Add > New > Upload.
125
+ 3. Click “Choose file” (“Browse”) and select the downloaded zip file.
126
+ *For Mac Users*
127
+ *Go to your Downloads folder and locate the folder with the plugin. Right-click on the folder and select Compress. Now you have a newly created .zip file which can be installed as described here.*
128
+ 4. Click “Install Now” button.
129
+ 5. Click “Activate Plugin” button for activating the plugin.
130
+ 6.If the installation does not succeed, please contact us at info@web-dorado.com.
131
+
132
+ ### Updating the contact form.
133
+
134
+ If you want to update the plugin while preserving your existing contact forms, you need to deactivate and delete the Contact Form Maker from the list of installed plugins (Do not uninstall it using the Uninstall Contact Form Maker option of the plugin) and install the new plugin. Afterwards, go to Contact Form Maker>Manager and on the upper hand of the screen click on the “Update Contact Forms” button. If the update is successful, you will see a notification message saying, “All Contact forms are updated!”.
135
+
136
+
137
+ == Screenshots ==
138
+ 1. [WordPress Contact Form](http://wordpress.org/plugins/contact-form-maker/) - Sample RSVP
139
+ 2. Contact Form Maker - Sample contact form
140
+ 3. Contact Form Maker - Manage contact forms
141
+ 4. Contact Form Maker - Creating a new conact contact form
142
+ 5. Contact Form Maker - Text input field type
143
+ 6. Contact Form Maker - Captcha field type
144
+ 7. Contact Form Maker - Manage submissions
145
+ 8. Contact Form Maker - Select Columns
146
+
147
+ == Changelog ==
148
+
149
+ = 1.8.39 =
150
+ * Fixed: Bug with Hidden field in custom text in Email
151
+ * Fixed: Bug on email verification custom post
152
+ * Changed: Filters now apply to CSV and XML export
153
+
154
+ = 1.8.38 =
155
+ * Bug On Search by ID in Submissions
156
+ * Added: Mailchimp in featured plugins
157
+
158
+ = 1.8.37 =
159
+ * Fixed: Bug on edit_old() function for old forms.
160
+
161
+ = 1.8.36 =
162
+ * Changed: Featured Themes page
163
+
164
+ = 1.8.35 =
165
+ * Fixed: Update from very old version
166
+
167
+ = 1.8.34 =
168
+ * Changed: Featured plugins page
169
+
170
+ = 1.8.33 =
171
+ * Fixed: Unexpected behaviour on pressing "Enter" key on back end
172
+
173
+ = 1.8.32 =
174
+ * Fixed: JS error on incorrect Google Maps API key
175
+ * Added: Alert about incorrect Google Maps API key
176
+
177
+ = 1.8.31 =
178
+ * Added: Global option for Google Maps API key
179
+ * Fixed: Google Maps API key warning in browser
180
+
181
+ = 1.8.30 =
182
+ * Fixed: bug in new form
183
+
184
+ = 1.8.29 =
185
+ * Fixed: bug in widget
186
+
187
+ = 1.8.28 =
188
+ * minor bug fixed
189
+
190
+ = 1.8.27 =
191
+ * Major update
192
+
193
+ = 1.7.33 =
194
+ * Changed: Compability with WordPress 4.3
195
+
196
+ = 1.7.32 =
197
+ * Minor bug fixed
198
+
199
+ = 1.7.31 =
200
+ * Security issue fixed
201
+
202
+ = 1.7.29 =
203
+ * Cache issue fixed
204
+
205
+ = 1.7.28 =
206
+ * Bug fixed: Empty email "From name"
207
+
208
+ = 1.7.27 =
209
+ * bug fixed in csv\xml export
210
+
211
+ = 1.7.26 =
212
+ * bug fixed in email content
213
+
214
+ = 1.7.25 =
215
+ * remove fancybox
216
+
217
+ = 1.7.24 =
218
+ * display php function to publish form
219
+
220
+ = 1.7.20 =
221
+ * 4.0.1 shortcode issue fixed
222
+
223
+ = 1.6.1 =
224
+ * Added featured plugins
225
+
226
+ = 1.6.0 =
227
+ * From Name, From Email in Contact Form options
228
+
229
+ = 1.5.0 =
230
+ * Survey Tools (Star Rating, Scale Rating, Spinner, Slider, Range, Grading, Matrix)
231
+
232
+ = 1.4.0 =
233
+ * Customizable Email message for Administrator and Users
234
+
235
+ = 1.3.0 =
236
+ * Actions after [WordPress Contact Form](http://wordpress.org/plugins/contact-form-maker/) Submission:
237
+ - Stay on contact form:
238
+ - To go to Post,Page after the contact form submission:
239
+ - Custom text after the contact form submission:
240
+ - URL: The user is redirected to the provided URL after the contact form submission.
241
+ * Edit javascript of the contact form:
242
+ * Save as the copy of the contact form:
243
+ * Themes: There are 43 standard themes included in Contact Form Maker
244
+ * New contact form fields:
245
+ - Address field
246
+ - Address mark on map contact form field
247
+ - Number contact form field
248
+ - Phone contact form field
249
+ - Date 3 different contact form field
250
+ - Time contact form field
251
+ - Country list contact form field
252
+ - Recapthca contact form field
253
+ * Pagebreak of the Contact Form Maker: This can be used to break the contact form into distinct pages.
254
+ * Section Break of the Contact Form Maker: This option allows adding a section break to the contact form page.
255
+ * For each contact form certain types of statistical data are available in the Contact Form Maker:
256
+ * Entries of a contact form: The number of submitted contact forms in the Contact Form Maker.
257
+ * Views of a contact form: The number of times the contact form has been viewed.
258
+ * Conversion Rate of a contact form: The percentage of submitted contact forms to the overall number of views.
259
+
260
+
261
+ ==Contact Form Maker Step by step guide==
262
+ ### Step 1: Installing the [wordpress contact form](http://wordpress.org/plugins/contact-form-maker/)
263
+
264
+ 1.1 Minimum requirements.
265
+ Wordpress 3.0+
266
+ PHP 5.x
267
+ MySQL 5.x
268
+
269
+ 1.2 Perform a new installation.
270
+ Log in to the administrator panel.
271
+ Go to Plugins Add > New > Upload.
272
+ Click “Choose file” (“Browse”) and select the Contact Form Maker zip file.
273
+ *For Mac Users*
274
+ *Go to your Downloads folder and locate the folder with the plugin. Right-click on the folder and select Compress. Now you have a newly created .zip file which can be installed as described here.*
275
+ Click “Install Now” button.
276
+ If the installation succeeded you will see the message in the picture. ClickActivate Plugin” button for activating the plugin.
277
+ If any problem occurs, please contact us at info@web-dorado.com.
278
+
279
+ 1.3 Updating the contact form.
280
+
281
+ If you want to update the plugin while preserving your existing contact forms, you need to deactivate and delete the Contact Form Maker from the list of installed plugins (Do not uninstall it using the Uninstall Contact Form Maker option of the plugin) and install the new plugin. Afterwards, go to Contact Form Maker>Manager and on the upper hand of the screen click on the “Update Contact Forms” button. If the update is successful, you will see a notification message saying, “All Contact forms are updated!”.
282
+
283
+
284
+ = Step 2: Creating a new contact form =
285
+
286
+ 2.1 On the left menu select Contact Form Maker > Manager
287
+ 2.2 In the upper left corner click on the “Add a form” button.
288
+ 2.3 Contact Form Title. Specify a title for the contact form.
289
+
290
+
291
+ = Step 3: Configuring Contact Form Options =
292
+
293
+ 3.1 General Options
294
+ 3.1.1 Email to send submissions to. Here you provide e-mails to which submitted contact form information is sent. If you need more than one e-mail address, you must separate them by commas. This field is not required. In any case, the submitted information is stored in “Submissions” part, where it can be easily managed.
295
+ 3.1.2 Email From. Here you define the email address from which the users receive the submission email (sender’s email).
296
+ 3.1.3 From Name. Here you define the sender’s name which is shown in submission email.
297
+ 3.1.4 Theme. A distinct theme can be applied to each new contact form. The themes can be accessed by selecting Contact Form Maker > Themes on the top menu. 41 themes are available for selection. There is an option for creating new themes, which you can access by clicking “New” on the upper right corner of the section.
298
+
299
+ 3.2 Actions after Submission
300
+ Here you can select the action that takes place after contact form submission. Following options are available:
301
+ - Stay on contact form: The user stays on the contact form page.
302
+ - Article: The user is redirected to the selected article.
303
+ - Custom text: Custom text is displayed on the screen.
304
+ - URL: The user is redirected to the provided URL.
305
+ 3.3 Payment Options
306
+ 3.3.1 Turn on PayPal. Allows making PayPal paymentsusing Contact Form Maker.
307
+ 3.3.2 Checkout Mode. Choose the checkout mode:
308
+ Production (https://developer.paypal.com/webapps/developer/docs/classic/lifecycle/goingLive/)
309
+ Test Mode (https://developer.paypal.com/webapps/developer/docs/integration/direct/test-the-api/)
310
+ 3.3.3 PayPal Email. Enter your PayPal email.
311
+ 3.3.4 PayPal Currency. Choose your PayPal currency.
312
+ 3.3.5 Tax. Add the tax amount if any.
313
+ 3.4 JavaScript
314
+ Here you can define new JavaScript functions, which can be applied to the contact form. Three empty event functions are included:
315
+ - before_load(): before the contact form is loaded
316
+ - before_submit(): before the contact form is submitted
317
+ - before_reset(): before the contact form is reset
318
+ 3.5 Custom Text in Email
319
+ For Administrator. Here you can add custom texts, images, and custom HTML to the e-mail message that is sent to the administrator, as well as choose which fields of the submitted contact form are included in the e-mail (set to ‘all’ by default).
320
+ For User. Here you can add custom texts, images, and custom HTML to the e-mail message that is sent to the users, as well as choose which fields of the submitted contact form are included in the e-mail (set to ‘all’ by default).
321
+
322
+ = Step 4: Description of the contact form fields =
323
+
324
+ 4.1 Custom HTML:An HTML editor. You can insert your own HTML content to your WordPress contact form.
325
+
326
+ 4.2 Text Input: At first choose the Field Type according to your preference. There are several options:
327
+ Simple Text: This can be used for typing some text. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Required, Allow only unique values, Additional Attributes
328
+
329
+ Password: This field can be used for adding a password field to your contact form. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Allow only unique values, Additional Attributes
330
+ Text Area: This field can be used for typing some text. The difference between Text Area and Simple Text is that Simple Text has only one row while Text Area can have several rows. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Required, Allow only unique values, Additional Attributes
331
+ Name: This can be used for typing a name. Default field labels can be edited clicking on the field label and typing in a custom label. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Value If Empty, Field Size, Name Format, Class Name, Required, Allow only unique values, Additional Attributes
332
+ Address: This field can be used for adding an address. Default field labels can be edited clicking on the label and typing in a custom label. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Overall Size, Class Name, Disable Fields, Required, Additional Attributes
333
+ Address (Mark on Map):This filed can be used for adding an address by directly marking it on the map. It has several attributes: Field Label, Field Label Position, Default Location, Map Size, Marker Info, Class Name, Additional Attributes
334
+ E-mail:This field can be used for typing the submitter’s e-mail. The submitted e-mail validation is checked. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Send mail to submitter, Required, Allow only unique values, Additional Attributes.
335
+ Number: This field can be used to provide numbers for different purposes (e.g. serial number). It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Value If Empty, Class Name, Required, Allow only unique values, Additional Attributes
336
+ Phone: This field can be used to provide a phone number. Default field labels can be edited clicking on the label and typing in a custom label. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Value If Empty, Field Size, Class Name, Required, Allow only unique values, Additional Attributes
337
+ Hidden Field: This field can be used to store additional information that does not need to be displayed. It has several attributes : Field ld, Field Name, Field Value, Additional Attributes.
338
+ 4.3 Time and Date: Choose the Field Type according to your preference. There are several options:
339
+ Date (single field with a picker): This field can be used for typing a date or choosing by the picker. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Date format, Date Picker Label, Class Name, Required, Additional Attributes.
340
+ Date (3 separate fields): This field can be used for typing a date in 3 field format(day, month, year). Default field labels can be edited clicking on the field label and typing in a custom label. Each of the 3 fields can be set as text input or select list. Each of the 3 fields has the attributes Field Size and Field Label. For year field the select list interval can be defined. These 3 fields can be separated in the format set by the fields separator attribute. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Required, Additional Attributes.
341
+ Time: This field can be used for typing a time. Default field labels can be edited clicking on the field label and typing in a custom label. Time can be shown in 24 hour or 12 hour formats by setting the time format attribute. The seconds preview can be enabled/disabled by setting the Display Seconds attribute. The field has several standard attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Required, Additional Attributes.
342
+ 4.4 Select: Choose the Field Type according to your preference. There are several options:
343
+ Custom select: This field can be used for selecting the values from a list. The list can be defined by Options attribute. You can easily add and remove list items. The checked items are considered as empty values. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Additional Attributes.
344
+ Country list: This field can be used for selecting a country from a list. It has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Additional Attributes.
345
+ 4.5 Checkbox: This field can be used for selecting the values from a list of checkboxes. The list can be defined by Options attribute. You can easily add and remove list items. The list can be displayed in horizontal/vertical positions by setting the Relative Position attribute. You can use Rows/Columns field if you want the options to be displayed in a row/column (depending on the positioning choice). The number of rows/columns should be specified. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Randomize in frontend, Allow other, Additional Attributes.
346
+
347
+ 4.6Radio:This field can be used for selecting the values from a list of radio buttons. The list can be defined by Options attribute. You can use Rows/Columns field if you want the options to be displayed in a row/column (depending on the positioning choice). The number of rows/columns should be specified. You can easily add and remove list items. The list can be displayed in horizontal/vertical positions by setting the Relative Position attribute.The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Field Size, Class Name, Required, Randomize in frontend, Allow other, Additional Attributes.
348
+
349
+ 4.7 File Upload: This field can be used for uploading a file. The size of the uploaded file can be limited by setting the value of Maximum Size attribute in KB. The upload folder can be mentioned by setting the Destination attribute. Only files with extensions listed in Allowed file extensions attribute can be uploaded. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Required, Additional Attributes.
350
+
351
+ 4.8 Captcha:This field can be used for the ensuring that the submission is generated by a person. Choose the Field Type according to your preference. There are several options:
352
+ Simple Captcha This is a easy to configure Simple Captcha. The number of randomly generated symbols can be set by the value of Captcha size attribute. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Class Name, Additional Attributes.
353
+ Recaptcha This is an alternative option for Captcha that uses Public and Private Keys. You will need to create reCaptcha keys with the help of a dedicated tool.The tool can be found on https://www.google.com/recaptcha/admin/create.
354
+
355
+ 4.9 Page Break: This can be used to break the contact form into distinct pages. Use Page Title to provide a title for the given page. Furthermore, the following parameters of the “Next” and “Previous” navigation buttons can be customized:
356
+ Type, Name, Class Name, Check the required fields , Additional Attributes.
357
+
358
+ 4.10 Section Break: This option allows adding a section break to the contact form page.
359
+
360
+ 4.11 Map: This field can be used for pointing out some position on the map. The position of the marker is fixed at the front end. Multiple locations can be selected by clicking the + button. The field has several attributes:
361
+ Location, Map Size, Marker Info, Class Name, Additional Attributes.
362
+
363
+ 4.12 PayPal: Choose the Field Type. The following options are available:
364
+ Amount (Price) This field is for indicating the amount of payment. Default field labels can be edited clicking on the field label and typing in a custom label. You can configure the following attributes: Field Label, Field Label Position, Range, Value If Empty, Field Size, Class Name, Required, Hide Cents, and Additional Attributes.
365
+ Select This field can be used for selecting a product/service for which the payment is being made. The list (each item consists of “Product name” and its “Price”)can be specified by the Options attribute. You can easily add and remove list items. There is also a Product Properties parameter, where you can add different properties (e.g. size) by specifying the type, the name, and adding options for selection. The checked items are considered as empty values. You can configure the following attributes: Field Label, Field Label Position, Field Size, Class Name, Required, and Additional Attributes.
366
+ Checkbox This field can be used for selecting multiple products/services for which the payment is being made. The options (each item consists of “Product name” and its “Price”) can be specified by the Options attribute. You can easily add and remove list items. There is also a quantity property parameter where the quantity of products/services can be specified. Moreover, there is a Product Properties parameter, where you can add different properties (e.g. size) by specifying the type, the name, and adding options for selection. You can configure the following attributes: Field Label, Field Label Position, Relative Position, Class Name, Required, and Additional Attributes.
367
+ Radio This field can be used for selecting the product/service for which the payment is being made. The options (each item consists of “Product name” and its “Price”) can be specified by the Options attribute. You can easily add and remove list items. There is also a quantity property parameter where the quantity of products/services can be specified. Moreover, there is a Product Properties parameter, where you can add different properties (e.g. size) by specifying the type, the name, and adding options for selection. You can configure the following attributes: Field Label, Field Label Position, Relative Position, Class Name, Required, and Additional Attributes.
368
+ Shipping This field can be used for selecting the shipping option for the selected product. The options (each item consists of a “Type” and “Price” parameters) can be specified by the Options attribute. You can easily add and remove list items. You can configure the following attributes: Field Label, Field Label Position, Relative Position, Class Name, Required, and Additional Attributes.
369
+ Total This field calculates the total sum to be paid via PayPal, including the payments for the shipping and taxes (if applicable).
370
+
371
+ 4.13 Survey Tools: Choose the Field Type according to your preferences. There are several options:
372
+ Star Rating: This field can be used for inserting star rating field in the contact form. Type the name of the field to be displayed with the rating system. The field has several attributes: Field Label Position, Star Amount, Star Color, Class Name, Required, and Additional Attributes.
373
+ Scale Rating: This field can be used for inserting scale rating in the contact form. Type the name of the field to be displayed with the rating system.Default field labels for lowest/highest satisfaction/grading can be edited clicking on the field label and typing in a custom label. The field has several attributes: Field Label Position, Scale Amount, Class Name, Required, and Additional Attributes.
374
+ Spinner: This field can be used for inserting spinner as a rating system in the contact form. Type the name of the field to be displayed with the rating system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Width, Min Value, Max Value, Step, Class Name, Required, and Additional Attributes.
375
+ Slider: This field can be used for inserting slider as a rating system in the contact form. Type the name of the field to be displayed with the rating system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Width, Min Value, Max Value, Class Name, Required, and Additional Attributes.
376
+ Range: This field can be used for inserting range system in the contact form. Type the name of the field to be displayed with the range system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Width, Step, Class Name, Required, and Additional Attributes.
377
+ Grading: This field can be used for inserting grading system in the contact form. Type the name of the field to be displayed with the grading system. The field has several attributes: Field Id, Field Name, Field Label, Field Label Position, Total, Items, Class Name, Required, and Additional Attributes.
378
+ Matrix: This field can be used for inserting a matrix in the contact form. Type the name of the field to be displayed with the matrix. The field has several attributes: Field Label, Field Label Position, Input Type, Rows, Columns, Class Name, Required, and Additional Attributes.
379
+ 4.14 Submit Button: Choose the Field Type according to your preference. There are several options:
380
+ Submit and Reset: This field can be used for inserting a submit/reset button into the contact form. You can display reset button by checking the box called Display reset button. Type the name of the submit and reset buttons in Submit button label and Reset button label. The field also has several attributes: Class Name and Additional Attributes.
381
+ Custom: This field can be used for inserting custom buttons into the contact form. Type the name of each button in button name field. You can define click functions for each button. The field also has several attributes: Class Name and Additional Attributes.
382
+
383
+ = Step 5: Publishing the created contact form. =
384
+
385
+ To insert a contact form into a Page or a Post.
386
+
387
+
388
+
389
+ 5.1. Press the button named Insert Contact Form Maker in a post or a page you want to show the contact form.
390
+
391
+ 5.2. Select a contact form from the list.
392
+
393
+
394
+
395
+ 5.3. Save the page or the post.
396
+
397
+ Alternatively, you can use Contact Form Maker without the button on the toolbar: Add the shortcode [wd_contact_form id="N"] (where N is the id of the contact form, for the contact form with id=2, the shortcode must be [wd_contact_form id="2"]) to the pages and posts, where you want the contact form to appear.
398
+
399
+
400
+ = Step 6: Managing submissions of the contact form. =
401
+
402
+ 6.1 On the left menu select Contact Form Maker > Submissions
403
+
404
+ 6.2 In order to manage a contact form's submissions, select the contact form from the list.
405
+
406
+ 6.3 For each contact form certain types of statistical data are available:
407
+ - Entries: The number of submitted contact forms.
408
+ - Views: The number of times the contact form has been viewed.
409
+ - Conversion Rate: The percentage of submitted contact forms to the overall number of views.
410
+
411
+ 6.4 For the contact forms that contain checkboxes or radio buttons a separate statistics is available. It shows how many times a particular checkbox/radio button has been checked, and what is the ratio of that number to the overall number of checks.
412
+
413
+ 6.5 There is a possibility to search the submissions database by all the relevant fields of the given contact form. Submissions can be sorted by any of the fields of the contact form by clicking the labels.
414
+
415
+
416
+ 6.6 You can delete any of submissions by selecting them and pressing the Delete” button on the top of the page.
417
+
418
+ 6.7 It is also possible to edit the submissions by clicking on the “Edit” icon on the upper right corner of the “Submissions” section.
419
+
420
+
421
+ 6.8 You can add/remove any column of the submissions by “Add/Remove Columns” button.
422
+
423
+
424
+
425
  6.9 The submissions can be exported to the CSV and XML formats.