Version Description
- Fixed: Bug on exporting submissions.
Download this release
Release Info
Developer | 10web |
Plugin | Form Maker by WD – user-friendly drag & drop Form Builder plugin |
Version | 1.13.43 |
Comparing to | |
See all releases |
Code changes from version 1.13.42 to 1.13.43
- admin/controllers/Generete_csv.php +79 -78
- form-maker.php +3 -3
- framework/WDW_FM_Library.php +188 -188
- js/form_maker_admin.js +1 -0
- readme.txt +4 -1
admin/controllers/Generete_csv.php
CHANGED
@@ -31,89 +31,90 @@ class FMControllerGenerete_csv extends FMAdminController {
|
|
31 |
$limitstart = WDW_FM_Library(self::PLUGIN)->get( 'limitstart', 0, 'intval' );
|
32 |
$send_header = WDW_FM_Library(self::PLUGIN)->get( 'send_header', 0, 'intval' );
|
33 |
$params = WDW_FM_Library(self::PLUGIN)->get_submissions_to_export();
|
|
|
|
|
|
|
34 |
if ( !empty($params) ) {
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
}
|
102 |
-
fclose($output);
|
103 |
-
if ( $send_header == 1 ) {
|
104 |
-
$txtfile = fopen($tempfile, "r");
|
105 |
-
$txtfilecontent = fread($txtfile, filesize($tempfile));
|
106 |
-
fclose($txtfile);
|
107 |
-
$filename = $title . "_" . date('Ymd') . ".csv";
|
108 |
-
header('Content-Encoding: UTF-8');
|
109 |
-
header('content-type: application/csv; charset=UTF-8');
|
110 |
-
header("Content-Disposition: attachment; filename=\"$filename\"");
|
111 |
-
// Set UTF-8 BOM
|
112 |
-
echo "\xEF\xBB\xBF";
|
113 |
-
echo $txtfilecontent;
|
114 |
-
unlink($tempfile);
|
115 |
-
}
|
116 |
-
}
|
117 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
}
|
31 |
$limitstart = WDW_FM_Library(self::PLUGIN)->get( 'limitstart', 0, 'intval' );
|
32 |
$send_header = WDW_FM_Library(self::PLUGIN)->get( 'send_header', 0, 'intval' );
|
33 |
$params = WDW_FM_Library(self::PLUGIN)->get_submissions_to_export();
|
34 |
+
$upload_dir = wp_upload_dir();
|
35 |
+
$file_path = $upload_dir['basedir'] . '/form-maker';
|
36 |
+
$tempfile = $file_path . '/export' . $form_id . '.txt';
|
37 |
if ( !empty($params) ) {
|
38 |
+
$data = $params[0];
|
39 |
+
$title = $params[1];
|
40 |
+
if ( !empty( $data ) ) {
|
41 |
+
$labels_parameters = WDW_FM_Library(self::PLUGIN)->get_labels_parameters( $form_id );
|
42 |
|
43 |
+
$sorted_label_names_original = $labels_parameters[4];
|
44 |
+
$sorted_label_names_original = array_merge(array(
|
45 |
+
'ID',
|
46 |
+
"Submit date",
|
47 |
+
"Submitter's IP",
|
48 |
+
"Submitter's Username",
|
49 |
+
"Submitter's Email Address",
|
50 |
+
), $sorted_label_names_original);
|
51 |
|
52 |
+
if (($key = array_search('stripe', $sorted_label_names_original)) !== false) {
|
53 |
+
unset($sorted_label_names_original[$key]);
|
54 |
+
}
|
55 |
|
56 |
+
$sorted_label_names = array();
|
57 |
+
function unique_label($sorted_label_names, $label) {
|
58 |
+
if ( in_array($label, $sorted_label_names) ) {
|
59 |
+
return unique_label($sorted_label_names, $label . '(1)');
|
60 |
+
}
|
61 |
+
else {
|
62 |
+
return $label;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
foreach ( $sorted_label_names_original as $key => $label ) {
|
66 |
+
$sorted_label_names[] = unique_label($sorted_label_names, $label);
|
67 |
+
}
|
68 |
|
69 |
+
foreach ( $data as $key => $row ) {
|
70 |
+
$sorted_data = array();
|
71 |
+
foreach ( $sorted_label_names as $label ) {
|
72 |
+
if ( !array_key_exists($label, $row) ) {
|
73 |
+
$sorted_data[$label] = '';
|
74 |
+
}
|
75 |
+
else {
|
76 |
+
$sorted_data[$label] = $row[$label];
|
77 |
+
}
|
78 |
+
}
|
79 |
+
$data[$key] = $sorted_data;
|
80 |
+
}
|
81 |
+
if ( !is_dir($file_path) ) {
|
82 |
+
mkdir($file_path, 0777);
|
83 |
+
}
|
84 |
+
if ( $limitstart == 0 && file_exists($tempfile) ) {
|
85 |
+
unlink($tempfile);
|
86 |
+
}
|
87 |
+
$output = fopen($tempfile, "a");
|
88 |
+
if ( $limitstart == 0 ) {
|
89 |
+
foreach ($sorted_label_names_original as $i => $rec) {
|
90 |
+
$sorted_label_names_original[$i] = ltrim($rec, '=+-@');
|
91 |
+
}
|
92 |
+
fputcsv($output, $sorted_label_names_original, $csv_delimiter);
|
93 |
+
}
|
94 |
+
foreach ( $data as $index => $record ) {
|
95 |
+
foreach ( $record as $i => $rec ) {
|
96 |
+
$record[$i] = ltrim($rec, '=+-@');
|
97 |
+
}
|
98 |
+
if ( !empty($index) ) {
|
99 |
+
fputcsv($output, $record, $csv_delimiter);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
fclose($output);
|
103 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
+
|
106 |
+
if ( $send_header == 1 ) {
|
107 |
+
$txtfile = fopen($tempfile, "r");
|
108 |
+
$txtfilecontent = fread($txtfile, filesize($tempfile));
|
109 |
+
fclose($txtfile);
|
110 |
+
$filename = $title . "_" . date('Ymd') . ".csv";
|
111 |
+
header('Content-Encoding: UTF-8');
|
112 |
+
header('content-type: application/csv; charset=UTF-8');
|
113 |
+
header("Content-Disposition: attachment; filename=\"$filename\"");
|
114 |
+
// Set UTF-8 BOM
|
115 |
+
echo "\xEF\xBB\xBF";
|
116 |
+
echo $txtfilecontent;
|
117 |
+
unlink($tempfile);
|
118 |
+
}
|
119 |
}
|
120 |
}
|
form-maker.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Form Maker
|
4 |
* Plugin URI: https://10web.io/plugins/wordpress-form-maker/?utm_source=form_maker&utm_medium=free_plugin
|
5 |
* Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
|
6 |
-
* Version: 1.13.
|
7 |
* Author: 10Web Form Builder Team
|
8 |
* Author URI: https://10web.io/plugins/?utm_source=form_maker&utm_medium=free_plugin
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -98,8 +98,8 @@ final class WDFM {
|
|
98 |
$this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
|
99 |
$this->front_urls = $this->get_front_urls();
|
100 |
$this->main_file = plugin_basename(__FILE__);
|
101 |
-
$this->plugin_version = '1.13.
|
102 |
-
$this->db_version = '2.13.
|
103 |
$this->menu_postfix = ($this->is_free == 2 ? '_fmc' : '_fm');
|
104 |
$this->plugin_postfix = ($this->is_free == 2 ? '_fmc' : '');
|
105 |
$this->menu_slug = 'manage' . $this->menu_postfix;
|
3 |
* Plugin Name: Form Maker
|
4 |
* Plugin URI: https://10web.io/plugins/wordpress-form-maker/?utm_source=form_maker&utm_medium=free_plugin
|
5 |
* Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
|
6 |
+
* Version: 1.13.43
|
7 |
* Author: 10Web Form Builder Team
|
8 |
* Author URI: https://10web.io/plugins/?utm_source=form_maker&utm_medium=free_plugin
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
98 |
$this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
|
99 |
$this->front_urls = $this->get_front_urls();
|
100 |
$this->main_file = plugin_basename(__FILE__);
|
101 |
+
$this->plugin_version = '1.13.43';
|
102 |
+
$this->db_version = '2.13.43';
|
103 |
$this->menu_postfix = ($this->is_free == 2 ? '_fmc' : '_fm');
|
104 |
$this->plugin_postfix = ($this->is_free == 2 ? '_fmc' : '');
|
105 |
$this->menu_slug = 'manage' . $this->menu_postfix;
|
framework/WDW_FM_Library.php
CHANGED
@@ -4250,32 +4250,32 @@ class WDW_FM_Library {
|
|
4250 |
* @return array
|
4251 |
*/
|
4252 |
public static function get_submissions_to_export() {
|
4253 |
-
|
4254 |
-
|
4255 |
-
|
4256 |
-
|
4257 |
-
|
4258 |
-
|
4259 |
-
|
4260 |
-
|
4261 |
|
4262 |
-
|
4263 |
|
4264 |
-
|
4265 |
-
|
4266 |
-
|
4267 |
-
|
4268 |
-
|
4269 |
-
|
4270 |
-
|
4271 |
-
|
4272 |
-
|
4273 |
-
|
4274 |
-
|
4275 |
-
|
4276 |
-
|
4277 |
-
|
4278 |
-
|
4279 |
$query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id);
|
4280 |
$labels = $wpdb->get_col($query);
|
4281 |
$query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
|
@@ -4316,196 +4316,196 @@ class WDW_FM_Library {
|
|
4316 |
$m = count($sorted_labels);
|
4317 |
$wpdb->query("SET SESSION group_concat_max_len = 1000000");
|
4318 |
$rows = array();
|
4319 |
-
if ( !empty($groupids) ) {
|
4320 |
-
$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(" . implode(',', $groupids) . ") GROUP BY `group_id` ORDER BY `date` ASC", $form_id);
|
4321 |
-
$rows = $wpdb->get_results($query, OBJECT_K);
|
4322 |
-
}
|
4323 |
$data = array();
|
4324 |
-
|
4325 |
-
|
4326 |
-
$
|
4327 |
-
$
|
4328 |
-
|
4329 |
-
|
4330 |
-
$
|
4331 |
-
|
4332 |
-
|
4333 |
-
|
4334 |
-
|
4335 |
-
|
4336 |
-
|
4337 |
-
|
4338 |
-
|
4339 |
-
|
4340 |
-
|
4341 |
-
|
4342 |
-
|
4343 |
-
|
4344 |
-
|
4345 |
-
|
4346 |
-
|
4347 |
-
|
4348 |
-
|
4349 |
-
|
4350 |
-
|
4351 |
-
|
4352 |
-
$
|
4353 |
-
|
4354 |
-
|
4355 |
-
|
|
|
|
|
|
|
|
|
4356 |
}
|
|
|
4357 |
}
|
4358 |
-
|
4359 |
-
|
4360 |
-
|
4361 |
-
|
4362 |
-
|
4363 |
-
$element_value
|
4364 |
-
|
4365 |
-
|
4366 |
-
|
|
|
|
|
|
|
|
|
|
|
4367 |
}
|
4368 |
-
|
4369 |
-
$data_temp[stripslashes($label_titles[$h])] =
|
4370 |
}
|
4371 |
-
|
4372 |
-
$
|
|
|
|
|
4373 |
}
|
4374 |
-
|
4375 |
-
|
4376 |
-
$data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
|
4377 |
-
}
|
4378 |
-
elseif ( strpos($element_value, "***star_rating***") ) {
|
4379 |
-
$element = str_replace("***star_rating***", '', $element_value);
|
4380 |
-
$element = explode("***", $element);
|
4381 |
-
$data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
|
4382 |
-
}
|
4383 |
-
elseif ( strpos($element_value, "@@@") !== FALSE ) {
|
4384 |
-
$data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
|
4385 |
-
}
|
4386 |
-
elseif ( strpos($element_value, "***grading***") ) {
|
4387 |
-
$element = str_replace("***grading***", '', $element_value);
|
4388 |
-
$grading = explode(":", $element);
|
4389 |
-
$items_count = sizeof($grading) - 1;
|
4390 |
-
$items = "";
|
4391 |
-
$total = "";
|
4392 |
-
for ( $k = 0; $k < $items_count / 2; $k++ ) {
|
4393 |
-
$items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
|
4394 |
-
$total += $grading[$k];
|
4395 |
}
|
4396 |
-
|
4397 |
-
|
4398 |
-
|
4399 |
-
|
4400 |
-
|
4401 |
-
|
4402 |
-
|
4403 |
-
|
4404 |
-
|
4405 |
-
$matrix = "";
|
4406 |
-
$aaa = array();
|
4407 |
-
$var_checkbox = 1;
|
4408 |
-
$selected_value = "";
|
4409 |
-
$selected_value_yes = "";
|
4410 |
-
$selected_value_no = "";
|
4411 |
-
for ( $k = 1; $k <= $mat_rows; $k++ ) {
|
4412 |
-
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "radio" ) {
|
4413 |
-
if ( $matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0 ) {
|
4414 |
-
$checked = "0";
|
4415 |
-
$aaa[1] = "";
|
4416 |
-
}
|
4417 |
-
else {
|
4418 |
-
$aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
|
4419 |
-
}
|
4420 |
-
for ( $l = 1; $l <= $mat_columns; $l++ ) {
|
4421 |
-
$checked = $aaa[1] == $l ? '1' : '0';
|
4422 |
-
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $checked . "; ";
|
4423 |
-
}
|
4424 |
}
|
4425 |
-
|
4426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4427 |
for ( $l = 1; $l <= $mat_columns; $l++ ) {
|
4428 |
-
$checked = $
|
4429 |
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $checked . "; ";
|
4430 |
-
$var_checkbox++;
|
4431 |
}
|
4432 |
}
|
4433 |
else {
|
4434 |
-
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "
|
4435 |
for ( $l = 1; $l <= $mat_columns; $l++ ) {
|
4436 |
-
$
|
4437 |
-
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $
|
4438 |
$var_checkbox++;
|
4439 |
}
|
4440 |
}
|
4441 |
else {
|
4442 |
-
|
4443 |
-
$
|
4444 |
-
|
4445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4446 |
}
|
4447 |
}
|
4448 |
}
|
4449 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
4450 |
}
|
4451 |
-
$data_temp[stripslashes($label_titles[$h])] = $matrix;
|
4452 |
}
|
4453 |
else {
|
4454 |
-
$
|
4455 |
-
$val = stripslashes(str_replace(''', "'", $val));
|
4456 |
-
$data_temp[stripslashes($label_titles[$h])] = $val;
|
4457 |
-
}
|
4458 |
-
}
|
4459 |
-
else {
|
4460 |
-
$data_temp[stripslashes($label_titles[$h])] = '';
|
4461 |
-
}
|
4462 |
-
if ( isset($verified_emails[$sorted_labels_id[$h]]) && $sorted_types[$h] == "type_submitter_mail" ) {
|
4463 |
-
if ( $data_temp[stripslashes($label_titles[$h])] == '' ) {
|
4464 |
-
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = '';
|
4465 |
}
|
4466 |
-
|
4467 |
-
if (
|
4468 |
-
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = '
|
4469 |
}
|
4470 |
else {
|
4471 |
-
$
|
|
|
|
|
|
|
|
|
|
|
4472 |
}
|
4473 |
}
|
4474 |
}
|
4475 |
-
|
4476 |
-
|
4477 |
-
|
4478 |
-
|
4479 |
-
|
4480 |
-
|
4481 |
-
|
4482 |
-
|
4483 |
-
|
4484 |
-
|
4485 |
-
|
4486 |
-
|
4487 |
-
|
4488 |
-
|
4489 |
-
|
4490 |
-
|
4491 |
-
|
4492 |
-
|
4493 |
-
|
4494 |
-
|
4495 |
-
|
4496 |
-
|
4497 |
-
|
4498 |
-
|
4499 |
-
|
4500 |
}
|
4501 |
}
|
|
|
4502 |
}
|
4503 |
-
$data[$i] = $data_temp;
|
4504 |
}
|
4505 |
}
|
4506 |
-
|
4507 |
-
|
4508 |
-
|
4509 |
|
4510 |
return $params;
|
4511 |
}
|
@@ -5149,7 +5149,7 @@ class WDW_FM_Library {
|
|
5149 |
for ( $i = 0; $i < 9; $i++ ) {
|
5150 |
array_pop($labels_parameters);
|
5151 |
}
|
5152 |
-
$query =
|
5153 |
$results = $wpdb->get_results($query);
|
5154 |
for ( $i = 0; $i < count($results); $i++ ) {
|
5155 |
array_push($labels, $results[$i]->element_label);
|
@@ -5220,45 +5220,45 @@ class WDW_FM_Library {
|
|
5220 |
}
|
5221 |
switch ( count($join_query) ) {
|
5222 |
case 0:
|
5223 |
-
$join =
|
5224 |
break;
|
5225 |
case 1:
|
5226 |
if ( $join_query[0] == 'sort' ) {
|
5227 |
-
$join = $wpdb->prepare('SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' .
|
5228 |
$join_count = $wpdb->prepare('SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . '%d' . '" AND element_label="' . '%s' . '" ', $form_id, $join_where[0]['label']);
|
5229 |
$orderby = $wpdb->prepare(' ORDER BY `element_value` ' . '%s', $asc_or_desc);
|
5230 |
}
|
5231 |
else {
|
5232 |
if ( isset($join_where[0]['search']) ) {
|
5233 |
-
$join = $wpdb->prepare('SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . '%s' . '" AND (element_value LIKE "%%' . '%s' . '%%" OR element_value LIKE "%%' . '%s' . '%%") AND ' .
|
5234 |
}
|
5235 |
else {
|
5236 |
-
$join =
|
5237 |
}
|
5238 |
}
|
5239 |
break;
|
5240 |
default:
|
5241 |
if ( !empty($join_verified) ) {
|
5242 |
if ( isset($join_where[0]['search']) ) {
|
5243 |
-
$join = $wpdb->prepare('SELECT t.group_id from (SELECT t1.group_id from (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE (element_label="' . '%s' . '" AND (element_value LIKE "%%' . '%s' . '%%" OR element_value LIKE "%%' .'%s' . '%%")) AND ' .
|
5244 |
}
|
5245 |
else {
|
5246 |
-
$join =
|
5247 |
}
|
5248 |
}
|
5249 |
else {
|
5250 |
-
$join = $wpdb->prepare('SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' .
|
5251 |
}
|
5252 |
for ( $key = 1; $key < count($join_query); $key++ ) {
|
5253 |
if ( $join_query[$key] == 'sort' ) {
|
5254 |
if ( isset($join_where[$key]) ) {
|
5255 |
-
$join .= $wpdb->prepare('LEFT JOIN (SELECT group_id as group_id' . '%s' . ', element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' .
|
5256 |
$orderby = $wpdb->prepare(' ORDER BY t' . '%s' . '.`element_value` ' . '%s' . '', $key, $asc_or_desc);
|
5257 |
}
|
5258 |
}
|
5259 |
else {
|
5260 |
if ( isset($join_where[$key]) ) {
|
5261 |
-
$join .= $wpdb->prepare('INNER JOIN (SELECT group_id as group_id' . '%s' . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' .
|
5262 |
}
|
5263 |
}
|
5264 |
}
|
4250 |
* @return array
|
4251 |
*/
|
4252 |
public static function get_submissions_to_export() {
|
4253 |
+
global $wpdb;
|
4254 |
+
$params = array();
|
4255 |
+
$form_id = self::get( 'form_id', 0, 'intval' );
|
4256 |
+
$limitstart = self::get( 'limitstart', 0, 'intval' );
|
4257 |
+
$page_num = self::get( 'page_num', 0, 'intval' );
|
4258 |
+
$search_labels = self::get( 'search_labels' );
|
4259 |
+
$gr_ids = self::get('groupids');
|
4260 |
+
$groupids = !empty($gr_ids) ? explode(',', $gr_ids) : array(); //TODO??//
|
4261 |
|
4262 |
+
$verified_emails = isset($_REQUEST['verified_emails']) ? self::sanitize_array(json_decode(stripslashes($_REQUEST['verified_emails']), TRUE)) : array();
|
4263 |
|
4264 |
+
$paypal_info_fields = array(
|
4265 |
+
'currency' => 'Currency',
|
4266 |
+
'ord_last_modified' => 'Last modified',
|
4267 |
+
'status' => 'Status',
|
4268 |
+
'full_name' => 'Full Name',
|
4269 |
+
'fax' => 'Fax',
|
4270 |
+
'mobile_phone' => 'Mobile phone',
|
4271 |
+
'email' => 'Email',
|
4272 |
+
'phone' => 'Phone',
|
4273 |
+
'address' => 'Address',
|
4274 |
+
'paypal_info' => 'Paypal info',
|
4275 |
+
'ipn' => 'IPN',
|
4276 |
+
'tax' => 'Tax',
|
4277 |
+
'shipping' => 'Shipping'
|
4278 |
+
);
|
4279 |
$query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id);
|
4280 |
$labels = $wpdb->get_col($query);
|
4281 |
$query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
|
4316 |
$m = count($sorted_labels);
|
4317 |
$wpdb->query("SET SESSION group_concat_max_len = 1000000");
|
4318 |
$rows = array();
|
|
|
|
|
|
|
|
|
4319 |
$data = array();
|
4320 |
+
$is_paypal_info = FALSE;
|
4321 |
+
if ( !empty($groupids) ) {
|
4322 |
+
$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(" . implode(',', $groupids) . ") GROUP BY `group_id` ORDER BY `date` ASC", $form_id);
|
4323 |
+
$rows = $wpdb->get_results($query, OBJECT_K);
|
4324 |
+
for ( $www = 0; $www < count($groupids); $www++ ) {
|
4325 |
+
$i = $groupids[$www];
|
4326 |
+
$field_key = array_search($i, $label_id);
|
4327 |
+
if ( $label_type[$field_key] != 'type_arithmetic_captcha'
|
4328 |
+
&& $label_type[$field_key] != 'type_stripe' ) {
|
4329 |
+
$data_temp = array();
|
4330 |
+
$tt = $rows[$i];
|
4331 |
+
$date = get_date_from_gmt( $tt->date );
|
4332 |
+
$ip = $tt->ip;
|
4333 |
+
$user_id = get_userdata($tt->user_id_wd);
|
4334 |
+
$username = $user_id ? $user_id->display_name : "";
|
4335 |
+
$useremail = $user_id ? $user_id->user_email : "";
|
4336 |
+
$data_temp['ID'] = $i;
|
4337 |
+
$data_temp['Submit date'] = $date;
|
4338 |
+
$data_temp['Submitter\'s IP'] = $ip;
|
4339 |
+
$data_temp['Submitter\'s Username'] = $username;
|
4340 |
+
$data_temp['Submitter\'s Email Address'] = $useremail;
|
4341 |
+
$element_labels = explode(',', $tt->element_label);
|
4342 |
+
$element_values = explode('*:*el_value*:*', $tt->element_value);
|
4343 |
+
for ( $h = 0; $h < $m; $h++ ) {
|
4344 |
+
if ( isset($data_temp[$label_titles[$h]]) ) {
|
4345 |
+
$label_titles[$h] .= '(1)';
|
4346 |
+
}
|
4347 |
+
if ( in_array($sorted_labels_id[$h], $element_labels) ) {
|
4348 |
+
$element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
|
4349 |
+
if ( strpos($element_value, "*@@url@@*") ) {
|
4350 |
+
$file_names = '';
|
4351 |
+
$new_files = explode("*@@url@@*", $element_value);
|
4352 |
+
foreach ( $new_files as $new_file ) {
|
4353 |
+
if ( $new_file ) {
|
4354 |
+
$file_names .= $new_file . ", ";
|
4355 |
+
}
|
4356 |
}
|
4357 |
+
$data_temp[stripslashes($label_titles[$h])] = $file_names;
|
4358 |
}
|
4359 |
+
elseif ( strpos($element_value, "***br***") ) {
|
4360 |
+
$element_value = str_replace("***br***", ', ', $element_value);
|
4361 |
+
if ( strpos($element_value, "***quantity***") ) {
|
4362 |
+
$element_value = str_replace("***quantity***", '', $element_value);
|
4363 |
+
}
|
4364 |
+
if ( strpos($element_value, "***property***") ) {
|
4365 |
+
$element_value = str_replace("***property***", '', $element_value);
|
4366 |
+
}
|
4367 |
+
if ( substr($element_value, -2) == ', ' ) {
|
4368 |
+
$data_temp[stripslashes($label_titles[$h])] = substr($element_value, 0, -2);
|
4369 |
+
}
|
4370 |
+
else {
|
4371 |
+
$data_temp[stripslashes($label_titles[$h])] = $element_value;
|
4372 |
+
}
|
4373 |
}
|
4374 |
+
elseif ( strpos($element_value, "***map***") ) {
|
4375 |
+
$data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
|
4376 |
}
|
4377 |
+
elseif ( strpos($element_value, "***star_rating***") ) {
|
4378 |
+
$element = str_replace("***star_rating***", '', $element_value);
|
4379 |
+
$element = explode("***", $element);
|
4380 |
+
$data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
|
4381 |
}
|
4382 |
+
elseif ( strpos($element_value, "@@@") !== FALSE ) {
|
4383 |
+
$data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4384 |
}
|
4385 |
+
elseif ( strpos($element_value, "***grading***") ) {
|
4386 |
+
$element = str_replace("***grading***", '', $element_value);
|
4387 |
+
$grading = explode(":", $element);
|
4388 |
+
$items_count = sizeof($grading) - 1;
|
4389 |
+
$items = "";
|
4390 |
+
$total = "";
|
4391 |
+
for ( $k = 0; $k < $items_count / 2; $k++ ) {
|
4392 |
+
$items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
|
4393 |
+
$total += $grading[$k];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4394 |
}
|
4395 |
+
$items .= "Total: " . $total;
|
4396 |
+
$data_temp[stripslashes($label_titles[$h])] = $items;
|
4397 |
+
}
|
4398 |
+
elseif ( strpos($element_value, "***matrix***") ) {
|
4399 |
+
$element = str_replace("***matrix***", '', $element_value);
|
4400 |
+
$matrix_value = explode('***', $element);
|
4401 |
+
$matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
|
4402 |
+
$mat_rows = $matrix_value[0];
|
4403 |
+
$mat_columns = $matrix_value[$mat_rows + 1];
|
4404 |
+
$matrix = "";
|
4405 |
+
$aaa = array();
|
4406 |
+
$var_checkbox = 1;
|
4407 |
+
$selected_value = "";
|
4408 |
+
$selected_value_yes = "";
|
4409 |
+
$selected_value_no = "";
|
4410 |
+
for ( $k = 1; $k <= $mat_rows; $k++ ) {
|
4411 |
+
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "radio" ) {
|
4412 |
+
if ( $matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0 ) {
|
4413 |
+
$checked = "0";
|
4414 |
+
$aaa[1] = "";
|
4415 |
+
}
|
4416 |
+
else {
|
4417 |
+
$aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
|
4418 |
+
}
|
4419 |
for ( $l = 1; $l <= $mat_columns; $l++ ) {
|
4420 |
+
$checked = $aaa[1] == $l ? '1' : '0';
|
4421 |
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $checked . "; ";
|
|
|
4422 |
}
|
4423 |
}
|
4424 |
else {
|
4425 |
+
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "checkbox" ) {
|
4426 |
for ( $l = 1; $l <= $mat_columns; $l++ ) {
|
4427 |
+
$checked = $matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
|
4428 |
+
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $checked . "; ";
|
4429 |
$var_checkbox++;
|
4430 |
}
|
4431 |
}
|
4432 |
else {
|
4433 |
+
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "text" ) {
|
4434 |
+
for ( $l = 1; $l <= $mat_columns; $l++ ) {
|
4435 |
+
$text_value = $matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox];
|
4436 |
+
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $text_value . "; ";
|
4437 |
+
$var_checkbox++;
|
4438 |
+
}
|
4439 |
+
}
|
4440 |
+
else {
|
4441 |
+
for ( $l = 1; $l <= $mat_columns; $l++ ) {
|
4442 |
+
$selected_text = $matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox];
|
4443 |
+
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $selected_text . "; ";
|
4444 |
+
$var_checkbox++;
|
4445 |
+
}
|
4446 |
}
|
4447 |
}
|
4448 |
}
|
4449 |
}
|
4450 |
+
$data_temp[stripslashes($label_titles[$h])] = $matrix;
|
4451 |
+
}
|
4452 |
+
else {
|
4453 |
+
$val = strip_tags(htmlspecialchars_decode($element_value));
|
4454 |
+
$val = stripslashes(str_replace(''', "'", $val));
|
4455 |
+
$data_temp[stripslashes($label_titles[$h])] = $val;
|
4456 |
}
|
|
|
4457 |
}
|
4458 |
else {
|
4459 |
+
$data_temp[stripslashes($label_titles[$h])] = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4460 |
}
|
4461 |
+
if ( isset($verified_emails[$sorted_labels_id[$h]]) && $sorted_types[$h] == "type_submitter_mail" ) {
|
4462 |
+
if ( $data_temp[stripslashes($label_titles[$h])] == '' ) {
|
4463 |
+
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = '';
|
4464 |
}
|
4465 |
else {
|
4466 |
+
if ( in_array($i, $verified_emails[$sorted_labels_id[$h]]) ) {
|
4467 |
+
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = 'yes';
|
4468 |
+
}
|
4469 |
+
else {
|
4470 |
+
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = 'no';
|
4471 |
+
}
|
4472 |
}
|
4473 |
}
|
4474 |
}
|
4475 |
+
$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'));
|
4476 |
+
$total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'total'));
|
4477 |
+
$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'));
|
4478 |
+
if ( $item_total ) {
|
4479 |
+
$data_temp['Item Total'] = $item_total;
|
4480 |
+
}
|
4481 |
+
if ( $total ) {
|
4482 |
+
$data_temp['Total'] = $total;
|
4483 |
+
}
|
4484 |
+
if ( $payment_status ) {
|
4485 |
+
$data_temp['Payment Status'] = $payment_status;
|
4486 |
+
}
|
4487 |
+
$query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id=%d", $i);
|
4488 |
+
$paypal_info = $wpdb->get_results($query);
|
4489 |
+
if ( $paypal_info ) {
|
4490 |
+
$is_paypal_info = TRUE;
|
4491 |
+
}
|
4492 |
+
if ( $is_paypal_info ) {
|
4493 |
+
foreach ( $paypal_info_fields as $key => $paypal_info_field ) {
|
4494 |
+
if ( $paypal_info ) {
|
4495 |
+
$data_temp['PAYPAL_' . $paypal_info_field ] = $paypal_info[0]->$key;
|
4496 |
+
}
|
4497 |
+
else {
|
4498 |
+
$data_temp['PAYPAL_' . $paypal_info_field ] = '';
|
4499 |
+
}
|
4500 |
}
|
4501 |
}
|
4502 |
+
$data[$i] = $data_temp;
|
4503 |
}
|
|
|
4504 |
}
|
4505 |
}
|
4506 |
+
array_push($params, $data);
|
4507 |
+
array_push($params, $title);
|
4508 |
+
array_push($params, $is_paypal_info);
|
4509 |
|
4510 |
return $params;
|
4511 |
}
|
5149 |
for ( $i = 0; $i < 9; $i++ ) {
|
5150 |
array_pop($labels_parameters);
|
5151 |
}
|
5152 |
+
$query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where;
|
5153 |
$results = $wpdb->get_results($query);
|
5154 |
for ( $i = 0; $i < count($results); $i++ ) {
|
5155 |
array_push($labels, $results[$i]->element_label);
|
5220 |
}
|
5221 |
switch ( count($join_query) ) {
|
5222 |
case 0:
|
5223 |
+
$join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where;
|
5224 |
break;
|
5225 |
case 1:
|
5226 |
if ( $join_query[0] == 'sort' ) {
|
5227 |
+
$join = $wpdb->prepare('SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . '%s' . '" ', $join_where[0]['label']);
|
5228 |
$join_count = $wpdb->prepare('SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . '%d' . '" AND element_label="' . '%s' . '" ', $form_id, $join_where[0]['label']);
|
5229 |
$orderby = $wpdb->prepare(' ORDER BY `element_value` ' . '%s', $asc_or_desc);
|
5230 |
}
|
5231 |
else {
|
5232 |
if ( isset($join_where[0]['search']) ) {
|
5233 |
+
$join = $wpdb->prepare('SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . '%s' . '" AND (element_value LIKE "%%' . '%s' . '%%" OR element_value LIKE "%%' . '%s' . '%%") AND ' . $where, $join_where[0]['label'], $join_where[0]['search'], str_replace(' ', '@@@', $join_where[0]['search']));
|
5234 |
}
|
5235 |
else {
|
5236 |
+
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where;
|
5237 |
}
|
5238 |
}
|
5239 |
break;
|
5240 |
default:
|
5241 |
if ( !empty($join_verified) ) {
|
5242 |
if ( isset($join_where[0]['search']) ) {
|
5243 |
+
$join = $wpdb->prepare('SELECT t.group_id from (SELECT t1.group_id from (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE (element_label="' . '%s' . '" AND (element_value LIKE "%%' . '%s' . '%%" OR element_value LIKE "%%' .'%s' . '%%")) AND ' . $where . ' ) as t1 JOIN (SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where . ') as t2 ON t1.group_id = t2.group_id) as t ',$join_where[0]['label'], $join_where[0]['search'], str_replace(' ', '@@@', $join_where[0]['search']));
|
5244 |
}
|
5245 |
else {
|
5246 |
+
$join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where . ') as t ';
|
5247 |
}
|
5248 |
}
|
5249 |
else {
|
5250 |
+
$join = $wpdb->prepare('SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . '%s' . '" AND (element_value LIKE "%%' . '%s' . '%%" OR element_value LIKE "%%' . '%s' . '%%" )) as t ', $join_where[0]['label'], $join_where[0]['search'], str_replace(' ', '@@@', $join_where[0]['search']));
|
5251 |
}
|
5252 |
for ( $key = 1; $key < count($join_query); $key++ ) {
|
5253 |
if ( $join_query[$key] == 'sort' ) {
|
5254 |
if ( isset($join_where[$key]) ) {
|
5255 |
+
$join .= $wpdb->prepare('LEFT JOIN (SELECT group_id as group_id' . '%s' . ', element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . '%s' . '") as t' . '%s' . ' ON t' . '%s' . '.group_id' . '%s' . '=t.group_id ', $key, $join_where[$key]['label'], $key, $key, $key);
|
5256 |
$orderby = $wpdb->prepare(' ORDER BY t' . '%s' . '.`element_value` ' . '%s' . '', $key, $asc_or_desc);
|
5257 |
}
|
5258 |
}
|
5259 |
else {
|
5260 |
if ( isset($join_where[$key]) ) {
|
5261 |
+
$join .= $wpdb->prepare('INNER JOIN (SELECT group_id as group_id' . '%s' . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . '%s' . '" AND (element_value LIKE "%%' . $join_where[$key]['search'] . '%%" OR element_value LIKE "%%' . '%s' . '%%")) as t' . '%s' . ' ON t' . '%s' . '.group_id' . '%s' . '=t.group_id ', $key, $join_where[$key]['label'], str_replace(' ', '@@@', $join_where[$key]['search']), $key, $key, $key);
|
5262 |
}
|
5263 |
}
|
5264 |
}
|
js/form_maker_admin.js
CHANGED
@@ -4,6 +4,7 @@ jQuery( function () {
|
|
4 |
jQuery(document).on('fm_tab_loaded, fm_tab_email_loaded', function () {
|
5 |
fm_admin_ready();
|
6 |
});
|
|
|
7 |
jQuery(window).on('load', function () {
|
8 |
jQuery('#fm_loading').hide();
|
9 |
jQuery('#fm_admin_container').show();
|
4 |
jQuery(document).on('fm_tab_loaded, fm_tab_email_loaded', function () {
|
5 |
fm_admin_ready();
|
6 |
});
|
7 |
+
|
8 |
jQuery(window).on('load', function () {
|
9 |
jQuery('#fm_loading').hide();
|
10 |
jQuery('#fm_admin_container').show();
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: webdorado,10web,wdsupport,formmakersupport
|
|
3 |
Tags: form, forms, form builder, contact form, feedback, custom form, contact, web contact form, captcha, email, form manager, survey
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.5
|
6 |
-
Stable tag: 1.13.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -562,6 +562,9 @@ Where **{{field_id}}** is the ID of the field you wish to prefill. Also, **{{par
|
|
562 |
|
563 |
== Changelog ==
|
564 |
|
|
|
|
|
|
|
565 |
= 1.13.42 =
|
566 |
* Fixed: Conflicts with WP5.5.
|
567 |
|
3 |
Tags: form, forms, form builder, contact form, feedback, custom form, contact, web contact form, captcha, email, form manager, survey
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.5
|
6 |
+
Stable tag: 1.13.43
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
562 |
|
563 |
== Changelog ==
|
564 |
|
565 |
+
= 1.13.43 =
|
566 |
+
* Fixed: Bug on exporting submissions.
|
567 |
+
|
568 |
= 1.13.42 =
|
569 |
* Fixed: Conflicts with WP5.5.
|
570 |
|