Contact Form by Supsystic - Version 1.7.14

Version Description

/ 26.03.2021 = * Add support WP 5.7 * Add fix for OVH gateway

Download this release

Release Info

Developer supsystic.com
Plugin Icon 128x128 Contact Form by Supsystic
Version 1.7.14
Comparing to
See all releases

Code changes from version 1.7.13 to 1.7.14

cfs.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Contact Form by Supsystic
4
  * Description: Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
5
- * Version: 1.7.13
6
  * Author: supsystic.com
7
  * Author URI: https://supsystic.com
8
  * Text Domain: contact-form-by-supsystic
2
  /**
3
  * Plugin Name: Contact Form by Supsystic
4
  * Description: Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
5
+ * Version: 1.7.14
6
  * Author: supsystic.com
7
  * Author URI: https://supsystic.com
8
  * Text Domain: contact-form-by-supsystic
classes/fileuploader.php DELETED
@@ -1,147 +0,0 @@
1
- <?php
2
- class fileuploaderCfs {
3
- private $_error = '';
4
- private $_dest = '';
5
- private $_file = '';
6
- /**
7
- * Result filename, if empty - it will be randon generated string
8
- */
9
- private $_destFilename = '';
10
- /**
11
- * Return last error
12
- * @return string error message
13
- */
14
- public function getError() {
15
- return $this->_error;
16
- }
17
- /**
18
- * Validate before upload
19
- * @param string $inputname name of the input HTML document (key in $_FILES array)
20
- * @param string $destSubDir destination for uploaded file, for wp this should be directory in wp-content/uploads/ dir
21
- * @param string $destFilename name of a file that be uploaded
22
- */
23
- public function validate($inputname, $destSubDir, $destFilename = '') {
24
- if (is_array($inputname) && !empty($inputname['name'])) {
25
- $inputname['name'] = sanitize_file_name($inputname['name']);
26
- } else {
27
- return false;
28
- }
29
- $file = $inputname;
30
- $res = false;
31
- if(!empty($file['error'])) {
32
- switch($file['error']) {
33
- case '1':
34
- $this->_error = __('The uploaded file exceeds the upload_max_filesize directive in php.ini', CFS_LANG_CODE);
35
- break;
36
- case '2':
37
- $this->_error = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', CFS_LANG_CODE);
38
- break;
39
- case '3':
40
- $this->_error = __('The uploaded file was only partially uploaded', CFS_LANG_CODE);
41
- break;
42
- case '4':
43
- $this->_error = __('No file was uploaded.', CFS_LANG_CODE);
44
- break;
45
- case '6':
46
- $this->_error = __('Missing a temporary folder', CFS_LANG_CODE);
47
- break;
48
- case '7':
49
- $this->_error = __('Failed to write file to disk', CFS_LANG_CODE);
50
- break;
51
- case '8':
52
- $this->_error = __('File upload stopped by extension', CFS_LANG_CODE);
53
- break;
54
- case '999':
55
- default:
56
- $this->_error = __('No error code avaiable', CFS_LANG_CODE);
57
- }
58
- } elseif(empty($file['tmp_name']) || $file['tmp_name'] == 'none') {
59
- $this->_error = __('No file was uploaded..', CFS_LANG_CODE);
60
- } else {
61
- $res = true;
62
- }
63
- if($res) {
64
- //$this->_fileSize = $file['size'];
65
- $this->_dest = $destSubDir;
66
- $this->_file = $file;
67
- $this->_destFilename = $destFilename;
68
- }
69
- return $res;
70
- }
71
- /**
72
- * Upload valid file
73
- */
74
- public function upload($d = array()) {
75
- $d['ignore_db_insert'] = isset($d['ignore_db_insert']) ? $d['ignore_db_insert'] : false;
76
- $res = false;
77
- add_filter('upload_dir', array($this,'changeUploadDir'));
78
- add_filter('wp_handle_upload_prefilter', array($this,'changeFileName'));
79
- // File name will be changed during upload process - we will bring it back after upload
80
- $fileName = $this->_file['name'];
81
- $upload = wp_handle_upload($this->_file, array('test_form' => FALSE));
82
- $this->_file['name'] = $fileName;
83
- if (!empty($upload['type'])) {
84
- if(!isset($d['ignore_db_insert']) || !$d['ignore_db_insert']) {
85
- $saveData = array(
86
- 'fid' => (isset($d['fid']) ? $d['fid'] : 0),
87
- 'field_name' => (isset($d['field_name']) ? $d['field_name'] : ''),
88
- 'name' => $this->_file['name'],
89
- 'dest_name' => $this->_destFilename,
90
- 'path' => str_replace(DS, '\\'. DS, $this->_dest),
91
- 'mime_type' => $upload['type'],
92
- 'size' => $this->_file['size'],
93
- 'hash' => md5(mt_rand(1, 9999999)),
94
- );
95
- $this->_file['id'] = frameCfs::_()->getTable('files')->insert($saveData);
96
- $this->_file['hash'] = $saveData['hash'];
97
- $this->_file['field_name'] = $saveData['field_name'];
98
- $this->_file['url'] = $upload['url'];
99
- }
100
- $res = true;
101
- } elseif($upload['error']) {
102
- $this->_error = $upload['error'];
103
- }
104
- remove_filter('upload_dir', array($this,'changeUploadDir'));
105
- remove_filter('wp_handle_upload_prefilter', array($this,'changeFileName'));
106
- return $res;
107
- }
108
- public function getFileInfo() {
109
- return $this->_file;
110
- }
111
- public function changeUploadDir($uploads) {
112
- $uploads['subdir'] = $this->_dest;
113
- if(empty($uploads['subdir'])) {
114
- $uploads['path'] = $uploads['basedir'];
115
- $uploads['url'] = $uploads['baseurl'];
116
- } else {
117
- $uploads['path'] = $uploads['basedir'] . DS. $uploads['subdir'];
118
- $uploads['url'] = $uploads['baseurl'] . '/'.$uploads['subdir'];
119
- }
120
- return $uploads;
121
- }
122
- public function changeFileName($file) {
123
- $ext = pathinfo($file['name'], PATHINFO_EXTENSION);
124
- if(empty($this->_destFilename)) {
125
- $this->_destFilename = $this->createFileName();
126
- }
127
- $this->_destFilename .= '.'. $ext;
128
- $file['name'] = $this->_destFilename;
129
- return $file;
130
- }
131
- private function createFileName() {
132
- return utilsCfs::getRandStr(). '-'. utilsCfs::getRandStr(). '-'. utilsCfs::getRandStr(). '-'. utilsCfs::getRandStr();
133
- }
134
- /**
135
- * Delete uploaded file
136
- * @param int|array $id ID of file in files table, or file row data from files table
137
- */
138
- public function delete($id) {
139
- $file = is_array($id) ? $id : frameCfs::_()->getTable('files')->get('*', array('id' => $id), '', 'row');
140
- if($file) {
141
- frameCfs::_()->getTable('files')->delete($file['id']);
142
- $uploadsDir = wp_upload_dir( null, false );
143
- @unlink( $uploadsDir['basedir']. (empty($file['path']) ? '' : DS. $file['path']). DS. $file['dest_name'] );
144
- }
145
- return false;
146
- }
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/frame.php CHANGED
@@ -420,6 +420,7 @@ class frameCfs {
420
  $vars = array_merge($vars, $this->_scriptsVars[$s['handle']]);
421
  if($vars) {
422
  foreach($vars as $k => $v) {
 
423
  wp_localize_script($s['handle'], $k, $v);
424
  }
425
  }
@@ -430,6 +431,7 @@ class frameCfs {
430
  }
431
  public function addJSVar($script, $name, $val) {
432
  if($this->_scriptsInitialized) {
 
433
  wp_localize_script($script, $name, $val);
434
  } else {
435
  $this->_scriptsVars[$script][$name] = $val;
420
  $vars = array_merge($vars, $this->_scriptsVars[$s['handle']]);
421
  if($vars) {
422
  foreach($vars as $k => $v) {
423
+ $v = is_array($v) ? $v : array($v);
424
  wp_localize_script($s['handle'], $k, $v);
425
  }
426
  }
431
  }
432
  public function addJSVar($script, $name, $val) {
433
  if($this->_scriptsInitialized) {
434
+ $val = is_array($val) ? $val : array($val);
435
  wp_localize_script($script, $name, $val);
436
  } else {
437
  $this->_scriptsVars[$script][$name] = $val;
config.php CHANGED
@@ -49,7 +49,7 @@
49
  define('CFS_EOL', "\n");
50
 
51
  define('CFS_PLUGIN_INSTALLED', true);
52
- define('CFS_VERSION', '1.7.13');
53
  define('CFS_USER', 'user');
54
 
55
  define('CFS_CLASS_PREFIX', 'cfsc');
49
  define('CFS_EOL', "\n");
50
 
51
  define('CFS_PLUGIN_INSTALLED', true);
52
+ define('CFS_VERSION', '1.7.14');
53
  define('CFS_USER', 'user');
54
 
55
  define('CFS_CLASS_PREFIX', 'cfsc');
modules/forms/models/contacts.php CHANGED
@@ -19,7 +19,6 @@ class contactsModelCfs extends modelCfs {
19
  $res = $this->_afterGetFromTbl($row);
20
  }
21
  }
22
- //supLogParam($res);
23
  return $res;
24
  }
25
  public function supGetByFormId($id, $customTable = '') {
@@ -27,7 +26,6 @@ class contactsModelCfs extends modelCfs {
27
  $res = $wpdb->get_results(
28
  $wpdb->prepare("SELECT * FROM {$wpdb->prefix}cfs_contacts WHERE form_id = %s", $id), ARRAY_A
29
  );
30
- //supLogParam($res);
31
  return $res;
32
  }
33
  public function getSimpleList($where = array(), $params = array()) {
19
  $res = $this->_afterGetFromTbl($row);
20
  }
21
  }
 
22
  return $res;
23
  }
24
  public function supGetByFormId($id, $customTable = '') {
26
  $res = $wpdb->get_results(
27
  $wpdb->prepare("SELECT * FROM {$wpdb->prefix}cfs_contacts WHERE form_id = %s", $id), ARRAY_A
28
  );
 
29
  return $res;
30
  }
31
  public function getSimpleList($where = array(), $params = array()) {
modules/forms/models/forms.php CHANGED
@@ -23,7 +23,6 @@ class formsModelCfs extends modelCfs {
23
  $res = $this->_afterGetFromTbl($row);
24
  }
25
  }
26
- //supLogParam($res);
27
  return $res;
28
  }
29
  public function contact( $d ) {
23
  $res = $this->_afterGetFromTbl($row);
24
  }
25
  }
 
26
  return $res;
27
  }
28
  public function contact( $d ) {
modules/forms/views/forms.php CHANGED
@@ -323,7 +323,6 @@ class formsViewCfs extends viewCfs {
323
  foreach($form['params']['fields'] as &$field) {
324
  $fieldVal = (isset($_GET[$field['name']]) ? sanitize_text_field($_GET[$field['name']]) : false);
325
  $fieldValue = isset($_GET['cfs_'.$field['name']]) ? sanitize_text_field($_GET['cfs_'.$field['name']]) : $fieldVal;
326
- error_log($fieldValue);
327
  if(isset($field['value']) && isset($field['name']) && $fieldValue !== false) {
328
  $field['value'] = $fieldValue;
329
  }
323
  foreach($form['params']['fields'] as &$field) {
324
  $fieldVal = (isset($_GET[$field['name']]) ? sanitize_text_field($_GET[$field['name']]) : false);
325
  $fieldValue = isset($_GET['cfs_'.$field['name']]) ? sanitize_text_field($_GET['cfs_'.$field['name']]) : $fieldVal;
 
326
  if(isset($field['value']) && isset($field['name']) && $fieldValue !== false) {
327
  $field['value'] = $fieldValue;
328
  }
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Contact Form by Supsystic ===
2
  Contributors: supsystic.com
3
  Tags: contact, contact form, contact form builder, contact form maker, contact form manager, contact form plugin, contact forms, custom form, feedback form, form, forms, forms creator
4
- Tested up to: 5.6
5
- Stable tag: 1.7.13
6
 
7
  Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
8
 
@@ -202,6 +202,11 @@ Using Contact Form plugin on your WordPress site, you start a really responsive
202
 
203
  Contact Form admin interface
204
  == Changelog ==
 
 
 
 
 
205
  = 1.7.13 / 01.03.2021 =
206
  * Fixes for Show all tables
207
  * Fixes to AB Testing
1
  === Contact Form by Supsystic ===
2
  Contributors: supsystic.com
3
  Tags: contact, contact form, contact form builder, contact form maker, contact form manager, contact form plugin, contact forms, custom form, feedback form, form, forms, forms creator
4
+ Tested up to: 5.7
5
+ Stable tag: 1.7.14
6
 
7
  Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
8
 
202
 
203
  Contact Form admin interface
204
  == Changelog ==
205
+
206
+ = 1.7.14 / 26.03.2021 =
207
+ * Add support WP 5.7
208
+ * Add fix for OVH gateway
209
+
210
  = 1.7.13 / 01.03.2021 =
211
  * Fixes for Show all tables
212
  * Fixes to AB Testing