Advanced Contact form 7 DB - Version 1.7.1

Version Description

  • Minor tweaks in the plugin related to the edit data
Download this release

Release Info

Developer vsourz1td
Plugin Icon 128x128 Advanced Contact form 7 DB
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7.0 to 1.7.1

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vsourz1td
3
  Tags: contact form 7 db, advanced cf7 db, contact form 7 database, contact form db, contact form 7, save form data, save contact form, save cf7, database, cf7db, save-contact-form, Save-Forms-Data, import-cf7, export-contact-data, view-cf7-entry
4
  Requires at least: 4.0
5
  Tested up to: 5.2.2
6
- Stable tag: 1.7.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -175,6 +175,9 @@ return $contact_form_ids;
175
 
176
  == Changelog ==
177
 
 
 
 
178
  = 1.7.0 =
179
  * We have upgraded with Security patch.
180
  * Changes related to the premium plugin **User Access Manager** for the edit case to be handled.
3
  Tags: contact form 7 db, advanced cf7 db, contact form 7 database, contact form db, contact form 7, save form data, save contact form, save cf7, database, cf7db, save-contact-form, Save-Forms-Data, import-cf7, export-contact-data, view-cf7-entry
4
  Requires at least: 4.0
5
  Tested up to: 5.2.2
6
+ Stable tag: 1.7.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
175
 
176
  == Changelog ==
177
 
178
+ = 1.7.1 =
179
+ * Minor tweaks in the plugin related to the edit data
180
+
181
  = 1.7.0 =
182
  * We have upgraded with Security patch.
183
  * Changes related to the premium plugin **User Access Manager** for the edit case to be handled.
admin/class-advanced-cf7-db-admin.php CHANGED
@@ -103,7 +103,10 @@ class Advanced_Cf7_Db_Admin {
103
 
104
  }
105
 
106
- ////////////// to add admin screens for Contact form Db and Import CSV
 
 
 
107
  function vsz_cf7_plugin_menu(){
108
  ///// Menu pages for contact form DB
109
 
@@ -159,44 +162,62 @@ class Advanced_Cf7_Db_Admin {
159
  add_submenu_page( 'contact-form-listing', __('Add-ons', 'advanced-cf7-db'), __('Add-ons', ' advanced-cf7-db'), $cap, 'extentions',array($this,'vsz_extension') );
160
  }
161
 
162
- // Callback function for listing screen
 
 
 
 
 
163
  function vsz_contact_form_callback(){
164
- //Check current user permission
165
 
166
- /* if (!current_user_can('manage_options')) {
167
- wp_die( __('You do not have sufficient permissions to access this page.') );
168
- } */
169
  wp_enqueue_style('vsz-cf7-db-admin-css');
170
- //Define all entry related design in this file
171
  require_once plugin_dir_path( __FILE__ ) . 'partials/contact_form_listing.php';
 
172
  }
173
 
174
- // Callback function for Import CSV screen
 
 
 
 
 
175
  function vsz_shortcode(){
176
- //Define import CSV screen design in this file
177
  require_once plugin_dir_path( __FILE__ ) . 'partials/developer_support.php';
 
178
  }
179
 
180
- // Callback function for Import CSV screen
 
 
 
 
181
  function vsz_extension(){
182
- //Define import CSV screen design in this file
183
  require_once plugin_dir_path( __FILE__ ) . 'partials/add-ons.php';
 
184
  }
185
 
186
- // Callback function for Import CSV screen
 
 
187
  function vsz_import_cf7_csv(){
188
- //Check current user permission
189
- /* if (!current_user_can('manage_options')) {
190
- wp_die( __('You do not have sufficient permissions to access this page.') );
191
- } */
192
- //Define import CSV screen design in this file
193
  require_once plugin_dir_path( __FILE__ ) . 'partials/import_cf7_csv.php';
194
  }
195
 
196
- //Get form related all fields information here
 
 
 
197
  function vsz_cf7_admin_fields_callback($fields, $fid){
198
  $return = array();
 
199
  $fid = (int)$fid;
 
 
 
 
200
  //Get current form related field setting value from option table
201
  $field_settings = get_option('vsz_cf7_settings_field_' . $fid, array());
202
  //Check field settings value empty or not
@@ -217,8 +238,10 @@ class Advanced_Cf7_Db_Admin {
217
  $arr_form_tag = array();
218
  }
219
 
220
- /**** This functionality Added because when field settings not define then
221
- Fields display as per form design format*/
 
 
222
 
223
  //Check field exist with form or not
224
  if(!empty($arr_form_tag)){
@@ -269,13 +292,21 @@ class Advanced_Cf7_Db_Admin {
269
  }
270
  }
271
  }//Close else
 
272
  //return all existing fields information in array format here
273
  return $return;
274
- }//Close function for fields related information
275
 
276
- //Define Export option box on form listing screen
 
 
 
 
277
  function vsz_cf7_after_bulkaction_btn_callback($fid){
278
  $fid = (int)$fid;
 
 
 
279
  ?><!-- Display Export functionality button here-->
280
  <select id="vsz-cf7-export" name="vsz-cf7-export" data-fid="<?php echo $fid; ?>">
281
  <option value="-1"><?php _e('Export to...'); ?></option>
@@ -284,15 +315,17 @@ class Advanced_Cf7_Db_Admin {
284
  <option value="pdf"><?php _e('PDF'); ?></option>
285
  </select>
286
  <button class="button action" title="<?php _e('Export'); ?>" type="submit" name="btn_export"><?php _e('Export'); ?></button><?php
287
- }//Close export option function
288
 
289
- //Display Search text box design structure here
 
 
290
  function vsz_cf7_after_datesection_btn_callback($fid){
291
  //Get menu page URL
292
  $url = menu_page_url('contact-form-listing',false);
293
  //Check form id is define in current page or not if defirn then current form ID add with existing URL
294
  if(isset($_REQUEST['cf7_id']) && !empty($_REQUEST['cf7_id'])){
295
- $fid = intval($_REQUEST['cf7_id']);
296
  $url .= '&cf7_id='.$fid;
297
  }
298
  ?><input value="<?php echo ((isset($_POST['search_cf7_value'])) && !empty($_POST['search_cf7_value']) ? htmlspecialchars(stripslashes(sanitize_text_field($_POST['search_cf7_value']))) : ''); ?>" type="text" class="" id="cf7d-search-q" name="search_cf7_value" placeholder="<?php echo _e('Type something...'); ?>" id="" />
@@ -300,12 +333,16 @@ class Advanced_Cf7_Db_Admin {
300
  <?php
301
  }//Close search box design function
302
 
303
- //Display table header in edit column here
 
 
304
  function vsz_cf7_admin_after_heading_field_callback(){
305
  ?><th style="width: 32px;" class="manage-column"><?php _e(''); ?></th><?php
306
  }
307
 
308
- //Display Settings popup here
 
 
309
  function vsz_cf7_display_settings_btn_callback(){
310
 
311
  //Define thickbox popup function
@@ -318,7 +355,9 @@ class Advanced_Cf7_Db_Admin {
318
  </div><?php
319
  }
320
 
321
- //Display edit link with each entry in table
 
 
322
  function vsz_cf7_admin_after_body_edit_field_func($form_id, $row_id){
323
  //Define thickbox popup function
324
  add_thickbox();
@@ -330,7 +369,9 @@ class Advanced_Cf7_Db_Admin {
330
  </td><?php
331
  }
332
 
333
- //Define Display Setting Popup functionality here
 
 
334
  function vsz_cf7_after_admin_setting_form_callback($fid){
335
 
336
  $fid = intval($fid);
@@ -447,7 +488,9 @@ class Advanced_Cf7_Db_Admin {
447
  </div><?php
448
  }//Close setting POPUP function here
449
 
450
- //Display edit popup related content for this function
 
 
451
  function vsz_cf7_after_admin_edit_values_form_callback($form_id){
452
 
453
  $form_id = intval($form_id);
@@ -599,7 +642,9 @@ class Advanced_Cf7_Db_Admin {
599
  }//Close Edit POPUP function here
600
 
601
 
602
- //Save all custom define settings fields value here
 
 
603
  public function vsz_cf7_save_setting_callback(){
604
  global $wpdb;
605
 
@@ -614,7 +659,7 @@ class Advanced_Cf7_Db_Admin {
614
  return;
615
  }
616
  //get form Id
617
- $fid = intval($_POST['fid']);
618
  //Get nonce value
619
  $nonce = sanitize_text_field($_POST['vsz_cf7_setting_nonce']);
620
  //Verify nonce value
@@ -660,8 +705,8 @@ class Advanced_Cf7_Db_Admin {
660
  }
661
 
662
  //Get form and entry id
663
- $fid = intval($_POST['fid']);
664
- $rid = intval($_POST['rid']);
665
  //Verify nonce value
666
  $nonce = sanitize_text_field($_POST['vsz_cf7_edit_nonce']);
667
  if(!wp_verify_nonce( $nonce, 'vsz-cf7-edit-nonce-'.$fid)){
@@ -748,9 +793,9 @@ class Advanced_Cf7_Db_Admin {
748
  die('Security check');
749
  }
750
  //Get Delete row ID information
751
- $del_id = implode(',', array_map('intval',$_POST['del_id']));
752
  //Get Form ID
753
- $fid = intval($_POST['fid']);
754
 
755
  // Checking for file type
756
  $arr_field_type_info = vsz_field_type_info($fid);
@@ -798,7 +843,7 @@ class Advanced_Cf7_Db_Admin {
798
  //Setup export functionality here
799
  if(isset($_POST['btn_export'])){
800
  //Get form ID
801
- $fid = (int)$_POST['fid'];
802
 
803
  //Get export id related information
804
  $ids_export = ((isset($_POST['del_id']) && !empty($_POST['del_id'])) ? implode(',', array_map('intval',$_POST['del_id'])) : '');
@@ -825,54 +870,32 @@ class Advanced_Cf7_Db_Admin {
825
  }//Close if for export
826
  }//Close admin_init hook function
827
 
828
- //Edit form AJAX call hadle By this function
829
  /**
830
- * Change log : 18-07-2019
831
- * Taken by : @Jaydeep
832
- * Summary : Added user access checks for the edit case to be handled.
 
833
  */
834
  public function vsz_cf7_edit_form_ajax(){
835
- //global $cap;
836
- //if(!current_user_can( $cap )) return;
837
-
838
- $cap = 'no_access';
839
- // Check if user have access than display
840
-
841
- $user_id = get_current_user_id();
842
- $subject = new WP_User($user_id);
843
- $allcaps= $subject->allcaps;
844
- $caps = $subject->caps;
845
 
846
- $caps = array_merge(wp_get_current_user()->caps, $caps);
847
- $allcaps = array_merge(wp_get_current_user()->allcaps, $allcaps);
848
- if (wp_get_current_user()->ID == $subject->ID) {
849
- wp_get_current_user()->allcaps = $allcaps;
850
- wp_get_current_user()->caps = $caps;
851
- }
852
- $user = wp_get_current_user();
853
-
854
- //$role = get_role('subscriber');
855
- //var_dump($user);exit;
856
- if(isset($user) && !empty($user)){
857
- foreach($user->allcaps as $key=>$capability){
858
- if($capability == true){
859
- if(strpos($key, 'cf7_db_form_edit_') !== false){
860
- $cap = 'exist';
861
 
862
- break;
863
- }
864
- }
865
- }
866
  }
867
 
868
- if($cap == 'no_access' ){
869
- echo json_encode('@@You do not have access to edit the data.');
 
 
870
  exit;
871
  }
872
 
873
- global $wpdb;
874
- //Check entry id set or not in current request
875
- $rid = ((isset($_POST['rid']) && !empty($_POST['rid'])) ? intval($_POST['rid']) : '');
876
  //If entry not empty
877
  if(!empty($rid)){
878
  //Get entry related all fields information
@@ -886,9 +909,13 @@ class Advanced_Cf7_Db_Admin {
886
  //All fields encode in JSON format and return in AJAX request
887
  exit(json_encode($return));
888
  }
 
889
  }//Close Edit Ajax request function
890
 
891
- ////Define not editable fields name here
 
 
 
892
  public function vsz_cf7_not_editable_fields_callback(){
893
  $cf7_not_editable_fields = array('submit_time','submit_ip','submit_user_id');
894
 
@@ -901,7 +928,9 @@ class Advanced_Cf7_Db_Admin {
901
  return $cf7_not_editable_fields;
902
  }
903
 
904
- // Create table when new site added
 
 
905
  public function vsz_cf7_add_new_table_for_sites($blog_id){
906
 
907
  global $wpdb;
@@ -914,7 +943,9 @@ class Advanced_Cf7_Db_Admin {
914
  }
915
  }
916
 
917
- // create table when plugin update
 
 
918
  public function vsz_cf7_create_new_table_for_sites(){
919
 
920
  global $vsz_cf7db_current_version;
@@ -992,7 +1023,9 @@ class Advanced_Cf7_Db_Admin {
992
  add_shortcode( 'cf7-db-display-ip',array($this,'cf7_db_vsz_cf7_display_ip'));
993
  }
994
 
995
- // Short code execution related to hide the submit ip
 
 
996
  function cf7_db_vsz_cf7_display_ip($atts, $content, $name){
997
  if(is_multisite()){
998
  $arrInfo = shortcode_atts( array( 'site_id' => ''),$atts );
@@ -1015,8 +1048,6 @@ class Advanced_Cf7_Db_Admin {
1015
  // define('vsz_cf7_display_ip',true);
1016
  }
1017
 
1018
-
1019
-
1020
  // Create role and assign capability for user
1021
  public function vsz_cf7_create_role_for_contact_form($post_id){
1022
  $post_type = get_post_type($post_id);
@@ -1032,11 +1063,11 @@ class Advanced_Cf7_Db_Admin {
1032
  function vsz_acf7_db_edit_scr_file_upload(){
1033
 
1034
  // Verify the current user can upload files
1035
- if (!current_user_can('upload_files')){
1036
  print 'Not_accessed_to_upload_file';
1037
  wp_die(__('You do not have permission to upload files.'));
1038
  }
1039
- if(isset($_FILES) && is_array($_FILES) && !empty($_FILES)){
1040
  print 'Not_accessed_to_upload_file';
1041
  exit;
1042
  }
@@ -1059,9 +1090,9 @@ class Advanced_Cf7_Db_Admin {
1059
  }
1060
 
1061
  global $wpdb;
1062
- $fid = $_POST["fid"];
1063
- $rid = $_POST["rid"];
1064
- $field = $_POST["field"];
1065
 
1066
  $upload_dir = wp_upload_dir();
1067
  $acf7db_upload_folder = VSZ_CF7_UPLOAD_FOLDER;
@@ -1105,7 +1136,10 @@ class Advanced_Cf7_Db_Admin {
1105
  wp_die();
1106
  }
1107
 
1108
- // Function to delete file from edit file popup
 
 
 
1109
  function vsz_acf7_db_edit_scr_file_delete(){
1110
 
1111
  if(!isset($_POST["fid"]) || empty($_POST["fid"])){
@@ -1125,10 +1159,10 @@ class Advanced_Cf7_Db_Admin {
1125
  exit;
1126
  }
1127
 
1128
- $fid = $_POST["fid"];
1129
- $rid = $_POST["rid"];
1130
- $field = $_POST["field"];
1131
- $val = $_POST["val"];
1132
  global $wpdb;
1133
 
1134
  $res = $wpdb->update(VSZ_CF7_DATA_ENTRY_TABLE_NAME, array("value" => ""), array("data_id" => $rid, "cf7_id" => $fid, "name" => $field));
@@ -1148,11 +1182,16 @@ class Advanced_Cf7_Db_Admin {
1148
 
1149
  }//close class
1150
 
1151
- //Generate CSV file here
 
 
1152
  function vsz_cf7_export_to_csv($fid, $ids_export = ''){
1153
  global $wpdb;
1154
 
1155
  $fid = intval($fid);
 
 
 
1156
  $fields = vsz_cf7_get_db_fields($fid);
1157
 
1158
  //Get form id related contact form object
@@ -1184,12 +1223,17 @@ function vsz_cf7_export_to_csv($fid, $ids_export = ''){
1184
  exit();
1185
  }
1186
  }
1187
- //Generate excel file here
 
 
1188
  function vsz_cf7_export_to_excel($fid, $ids_export){
1189
 
1190
  global $wpdb;
1191
 
1192
  $fid = intval($fid);
 
 
 
1193
  $fields = vsz_cf7_get_db_fields($fid);
1194
  $fields1 = vsz_field_type_info($fid);
1195
 
@@ -1254,6 +1298,9 @@ function vsz_cf7_export_to_excel($fid, $ids_export){
1254
  function vsz_cf7_export_to_pdf($fid, $ids_export){
1255
  global $wpdb;
1256
  $fid = intval($fid);
 
 
 
1257
  $fields = vsz_cf7_get_db_fields($fid);
1258
 
1259
  //Get form id related contact form object
@@ -1272,12 +1319,8 @@ function vsz_cf7_export_to_pdf($fid, $ids_export){
1272
  //Check that the class exists before trying to use it
1273
  if(!class_exists('MYPDF')){
1274
  //Include pdf class file
1275
- // require_once(dirname(__FILE__).'/pdfgenerate/mypdf.class.php');
1276
 
1277
  require_once(dirname(__FILE__).'/pdfgenerate/dompdf/autoload.inc.php');
1278
- //require_once(dirname(__FILE__).'/pdfgenerate/dompdf/load_font.php');
1279
-
1280
- // $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'UTF-8', false);
1281
 
1282
  $pdf = new Dompdf\Dompdf();
1283
  $pdf->set_option('defaultFont', 'helvetica');
@@ -1540,7 +1583,6 @@ function cf7_check_capability($user_capability){
1540
  wp_get_current_user()->caps = $caps;
1541
  }
1542
  $user = wp_get_current_user();
1543
-
1544
  foreach($user->allcaps as $key=>$capability){
1545
  if($capability == true){
1546
  if($key == $user_capability){
103
 
104
  }
105
 
106
+ /**
107
+ * Defining the extra menus to be added
108
+ * admin screens for Contact form Db and Import CSV
109
+ */
110
  function vsz_cf7_plugin_menu(){
111
  ///// Menu pages for contact form DB
112
 
162
  add_submenu_page( 'contact-form-listing', __('Add-ons', 'advanced-cf7-db'), __('Add-ons', ' advanced-cf7-db'), $cap, 'extentions',array($this,'vsz_extension') );
163
  }
164
 
165
+ /**
166
+ * Callback function for listing screen
167
+ * Define all entry related design in this file
168
+ * Kept the current screen permission in the this file to view and edit the data
169
+ */
170
+
171
  function vsz_contact_form_callback(){
 
172
 
 
 
 
173
  wp_enqueue_style('vsz-cf7-db-admin-css');
174
+
175
  require_once plugin_dir_path( __FILE__ ) . 'partials/contact_form_listing.php';
176
+
177
  }
178
 
179
+ /**
180
+ * Developer support page
181
+ * All the filters/actions/shortcodes used in the plugins are mentioned for the developers to
182
+ * expand the plugin functionality
183
+ */
184
+
185
  function vsz_shortcode(){
186
+
187
  require_once plugin_dir_path( __FILE__ ) . 'partials/developer_support.php';
188
+
189
  }
190
 
191
+ /**
192
+ * Addon's page
193
+ * All the plugin related Addon's are been defined in this screen for the users to get more
194
+ * help from the plugin.
195
+ */
196
  function vsz_extension(){
197
+
198
  require_once plugin_dir_path( __FILE__ ) . 'partials/add-ons.php';
199
+
200
  }
201
 
202
+ /**
203
+ * Callback function for Import CSV screen
204
+ */
205
  function vsz_import_cf7_csv(){
 
 
 
 
 
206
  require_once plugin_dir_path( __FILE__ ) . 'partials/import_cf7_csv.php';
207
  }
208
 
209
+ /**
210
+ * Get form related all fields information here
211
+ * @param $fields, $fid
212
+ */
213
  function vsz_cf7_admin_fields_callback($fields, $fid){
214
  $return = array();
215
+
216
  $fid = (int)$fid;
217
+ //Return null if the $fid is empty
218
+ if( empty( $fid ) ){
219
+ return $return;
220
+ }
221
  //Get current form related field setting value from option table
222
  $field_settings = get_option('vsz_cf7_settings_field_' . $fid, array());
223
  //Check field settings value empty or not
238
  $arr_form_tag = array();
239
  }
240
 
241
+ /**
242
+ * This functionality Added because when field settings not define then
243
+ * fields display as per form design format
244
+ */
245
 
246
  //Check field exist with form or not
247
  if(!empty($arr_form_tag)){
292
  }
293
  }
294
  }//Close else
295
+
296
  //return all existing fields information in array format here
297
  return $return;
298
+ }
299
 
300
+ /**
301
+ * Action callback function of 'vsz_cf7_after_bulkaction_btn'
302
+ * Populate Export option box on form listing screen
303
+ * @param $fid
304
+ */
305
  function vsz_cf7_after_bulkaction_btn_callback($fid){
306
  $fid = (int)$fid;
307
+ if( empty( $fid ) ){
308
+ return 'Select at least one form';
309
+ }
310
  ?><!-- Display Export functionality button here-->
311
  <select id="vsz-cf7-export" name="vsz-cf7-export" data-fid="<?php echo $fid; ?>">
312
  <option value="-1"><?php _e('Export to...'); ?></option>
315
  <option value="pdf"><?php _e('PDF'); ?></option>
316
  </select>
317
  <button class="button action" title="<?php _e('Export'); ?>" type="submit" name="btn_export"><?php _e('Export'); ?></button><?php
318
+ }
319
 
320
+ /**
321
+ * Display Search text box design structure here
322
+ */
323
  function vsz_cf7_after_datesection_btn_callback($fid){
324
  //Get menu page URL
325
  $url = menu_page_url('contact-form-listing',false);
326
  //Check form id is define in current page or not if defirn then current form ID add with existing URL
327
  if(isset($_REQUEST['cf7_id']) && !empty($_REQUEST['cf7_id'])){
328
+ $fid = (int)sanitize_text_field($_REQUEST['cf7_id']);
329
  $url .= '&cf7_id='.$fid;
330
  }
331
  ?><input value="<?php echo ((isset($_POST['search_cf7_value'])) && !empty($_POST['search_cf7_value']) ? htmlspecialchars(stripslashes(sanitize_text_field($_POST['search_cf7_value']))) : ''); ?>" type="text" class="" id="cf7d-search-q" name="search_cf7_value" placeholder="<?php echo _e('Type something...'); ?>" id="" />
333
  <?php
334
  }//Close search box design function
335
 
336
+ /**
337
+ * Display table header in edit column here
338
+ */
339
  function vsz_cf7_admin_after_heading_field_callback(){
340
  ?><th style="width: 32px;" class="manage-column"><?php _e(''); ?></th><?php
341
  }
342
 
343
+ /**
344
+ * Display Settings popup here
345
+ */
346
  function vsz_cf7_display_settings_btn_callback(){
347
 
348
  //Define thickbox popup function
355
  </div><?php
356
  }
357
 
358
+ /**
359
+ * Display edit link with each entry in table
360
+ */
361
  function vsz_cf7_admin_after_body_edit_field_func($form_id, $row_id){
362
  //Define thickbox popup function
363
  add_thickbox();
369
  </td><?php
370
  }
371
 
372
+ /**
373
+ * Define Display Setting Popup functionality here
374
+ */
375
  function vsz_cf7_after_admin_setting_form_callback($fid){
376
 
377
  $fid = intval($fid);
488
  </div><?php
489
  }//Close setting POPUP function here
490
 
491
+ /**
492
+ * Display edit popup related content for this function
493
+ */
494
  function vsz_cf7_after_admin_edit_values_form_callback($form_id){
495
 
496
  $form_id = intval($form_id);
642
  }//Close Edit POPUP function here
643
 
644
 
645
+ /**
646
+ * Save all custom define settings fields value here
647
+ */
648
  public function vsz_cf7_save_setting_callback(){
649
  global $wpdb;
650
 
659
  return;
660
  }
661
  //get form Id
662
+ $fid = (int)sanitize_text_field($_POST['fid']);
663
  //Get nonce value
664
  $nonce = sanitize_text_field($_POST['vsz_cf7_setting_nonce']);
665
  //Verify nonce value
705
  }
706
 
707
  //Get form and entry id
708
+ $fid = intval(sanitize_text_field($_POST['fid']));
709
+ $rid = intval(sanitize_text_field($_POST['rid']));
710
  //Verify nonce value
711
  $nonce = sanitize_text_field($_POST['vsz_cf7_edit_nonce']);
712
  if(!wp_verify_nonce( $nonce, 'vsz-cf7-edit-nonce-'.$fid)){
793
  die('Security check');
794
  }
795
  //Get Delete row ID information
796
+ $del_id = implode(',', array_map('intval',sanitize_text_field($_POST['del_id'])));
797
  //Get Form ID
798
+ $fid = intval(sanitize_text_field($_POST['fid']));
799
 
800
  // Checking for file type
801
  $arr_field_type_info = vsz_field_type_info($fid);
843
  //Setup export functionality here
844
  if(isset($_POST['btn_export'])){
845
  //Get form ID
846
+ $fid = (int)sanitize_text_field($_POST['fid']);
847
 
848
  //Get export id related information
849
  $ids_export = ((isset($_POST['del_id']) && !empty($_POST['del_id'])) ? implode(',', array_map('intval',$_POST['del_id'])) : '');
870
  }//Close if for export
871
  }//Close admin_init hook function
872
 
873
+ //
874
  /**
875
+ * Edit form AJAX callback function for the data to be viewed in the form
876
+ * @param $_POST
877
+ * rid = recordid
878
+ * fid = CF7 formid
879
  */
880
  public function vsz_cf7_edit_form_ajax(){
 
 
 
 
 
 
 
 
 
 
881
 
882
+ global $wpdb;
883
+ //Check entry id set or not in current request
884
+ $rid = ((isset($_POST['rid']) && !empty($_POST['rid'])) ? intval(sanitize_text_field($_POST['rid'])) : '');
885
+ $fid = ((isset($_POST['fid']) && !empty($_POST['fid'])) ? intval(sanitize_text_field($_POST['fid'])) : '');
 
 
 
 
 
 
 
 
 
 
 
886
 
887
+ if( empty( $rid ) || empty( $fid ) ){
888
+ echo json_encode('@@You do not have access to edit the data.');
889
+ exit;
 
890
  }
891
 
892
+ // Checking for the capability
893
+ $edit_cap = 'cf7_db_form_edit_'.$fid;
894
+ if( !cf7_check_capability( $edit_cap ) ){
895
+ echo json_encode('@@You do not have access to edit the data for this form.');
896
  exit;
897
  }
898
 
 
 
 
899
  //If entry not empty
900
  if(!empty($rid)){
901
  //Get entry related all fields information
909
  //All fields encode in JSON format and return in AJAX request
910
  exit(json_encode($return));
911
  }
912
+
913
  }//Close Edit Ajax request function
914
 
915
+ /**
916
+ * Filter 'vsz_cf7_not_editable_fields'
917
+ * Define not editable fields name here
918
+ */
919
  public function vsz_cf7_not_editable_fields_callback(){
920
  $cf7_not_editable_fields = array('submit_time','submit_ip','submit_user_id');
921
 
928
  return $cf7_not_editable_fields;
929
  }
930
 
931
+ /**
932
+ * Create table when new site added if the install is multisite
933
+ */
934
  public function vsz_cf7_add_new_table_for_sites($blog_id){
935
 
936
  global $wpdb;
943
  }
944
  }
945
 
946
+ /**
947
+ * Callback function to handle the table creation when plugin updates provided
948
+ */
949
  public function vsz_cf7_create_new_table_for_sites(){
950
 
951
  global $vsz_cf7db_current_version;
1023
  add_shortcode( 'cf7-db-display-ip',array($this,'cf7_db_vsz_cf7_display_ip'));
1024
  }
1025
 
1026
+ /**
1027
+ * Short code execution related to hide the submit ip
1028
+ */
1029
  function cf7_db_vsz_cf7_display_ip($atts, $content, $name){
1030
  if(is_multisite()){
1031
  $arrInfo = shortcode_atts( array( 'site_id' => ''),$atts );
1048
  // define('vsz_cf7_display_ip',true);
1049
  }
1050
 
 
 
1051
  // Create role and assign capability for user
1052
  public function vsz_cf7_create_role_for_contact_form($post_id){
1053
  $post_type = get_post_type($post_id);
1063
  function vsz_acf7_db_edit_scr_file_upload(){
1064
 
1065
  // Verify the current user can upload files
1066
+ if ( !current_user_can('upload_files') ){
1067
  print 'Not_accessed_to_upload_file';
1068
  wp_die(__('You do not have permission to upload files.'));
1069
  }
1070
+ if(isset($_FILES) && is_array($_FILES) && empty($_FILES)){
1071
  print 'Not_accessed_to_upload_file';
1072
  exit;
1073
  }
1090
  }
1091
 
1092
  global $wpdb;
1093
+ $fid = (int)sanitize_text_field($_POST["fid"]);
1094
+ $rid = (int)sanitize_text_field($_POST["rid"]);
1095
+ $field = sanitize_text_field($_POST["field"]);
1096
 
1097
  $upload_dir = wp_upload_dir();
1098
  $acf7db_upload_folder = VSZ_CF7_UPLOAD_FOLDER;
1136
  wp_die();
1137
  }
1138
 
1139
+ /**
1140
+ * Callback function to delet the uploaded images in CF7DB
1141
+ * Function to delete file from edit file popup
1142
+ */
1143
  function vsz_acf7_db_edit_scr_file_delete(){
1144
 
1145
  if(!isset($_POST["fid"]) || empty($_POST["fid"])){
1159
  exit;
1160
  }
1161
 
1162
+ $fid = (int)sanitize_text_field($_POST["fid"]);
1163
+ $rid = (int)sanitize_text_field($_POST["rid"]);
1164
+ $field = sanitize_text_field($_POST["field"]);
1165
+ $val = sanitize_text_field($_POST["val"]);
1166
  global $wpdb;
1167
 
1168
  $res = $wpdb->update(VSZ_CF7_DATA_ENTRY_TABLE_NAME, array("value" => ""), array("data_id" => $rid, "cf7_id" => $fid, "name" => $field));
1182
 
1183
  }//close class
1184
 
1185
+ /**
1186
+ * Generate CSV file here
1187
+ */
1188
  function vsz_cf7_export_to_csv($fid, $ids_export = ''){
1189
  global $wpdb;
1190
 
1191
  $fid = intval($fid);
1192
+ if( empty( $fid ) ){
1193
+ return 'You do not have the permission to export the data';
1194
+ }
1195
  $fields = vsz_cf7_get_db_fields($fid);
1196
 
1197
  //Get form id related contact form object
1223
  exit();
1224
  }
1225
  }
1226
+ /**
1227
+ * Generate excel file here
1228
+ */
1229
  function vsz_cf7_export_to_excel($fid, $ids_export){
1230
 
1231
  global $wpdb;
1232
 
1233
  $fid = intval($fid);
1234
+ if( empty( $fid ) ){
1235
+ return 'You do not have the permission to export the data';
1236
+ }
1237
  $fields = vsz_cf7_get_db_fields($fid);
1238
  $fields1 = vsz_field_type_info($fid);
1239
 
1298
  function vsz_cf7_export_to_pdf($fid, $ids_export){
1299
  global $wpdb;
1300
  $fid = intval($fid);
1301
+ if( empty( $fid ) ){
1302
+ return 'You do not have the permission to export the data';
1303
+ }
1304
  $fields = vsz_cf7_get_db_fields($fid);
1305
 
1306
  //Get form id related contact form object
1319
  //Check that the class exists before trying to use it
1320
  if(!class_exists('MYPDF')){
1321
  //Include pdf class file
 
1322
 
1323
  require_once(dirname(__FILE__).'/pdfgenerate/dompdf/autoload.inc.php');
 
 
 
1324
 
1325
  $pdf = new Dompdf\Dompdf();
1326
  $pdf->set_option('defaultFont', 'helvetica');
1583
  wp_get_current_user()->caps = $caps;
1584
  }
1585
  $user = wp_get_current_user();
 
1586
  foreach($user->allcaps as $key=>$capability){
1587
  if($capability == true){
1588
  if($key == $user_capability){
admin/js/advanced-cf7-db-admin.js CHANGED
@@ -177,6 +177,7 @@ jQuery(document).ready(function($) {
177
 
178
  document.getElementById('overlayLoader').style.display = "block";
179
  var rid = parseInt(jQuery(this).data('rid'));
 
180
 
181
  var arr_field_type = jQuery.parseJSON(jQuery('form#cf7d-modal-form-edit-value input[name="arr_field_type"]').val());
182
  var arr_option = ['radio','checkbox','select'];
@@ -215,12 +216,15 @@ jQuery(document).ready(function($) {
215
  jQuery.ajax({
216
  url: ajaxurl + '?action=vsz_cf7_edit_form_value',
217
  type: 'POST',
218
- data: {'rid': rid},
 
 
 
219
  })
220
  .done(function(data) {
221
  //Decode json data here
222
  var json = jQuery.parseJSON(data);
223
- if(json.indexOf('@@') != -1){
224
  alert('You do not have the access to edit the data.');
225
  document.getElementById('overlayLoader').style.display = "none";
226
  self.parent.tb_remove();
177
 
178
  document.getElementById('overlayLoader').style.display = "block";
179
  var rid = parseInt(jQuery(this).data('rid'));
180
+ var fid = parseInt(jQuery('#cf7_id').val());
181
 
182
  var arr_field_type = jQuery.parseJSON(jQuery('form#cf7d-modal-form-edit-value input[name="arr_field_type"]').val());
183
  var arr_option = ['radio','checkbox','select'];
216
  jQuery.ajax({
217
  url: ajaxurl + '?action=vsz_cf7_edit_form_value',
218
  type: 'POST',
219
+ data: {
220
+ 'rid': rid,
221
+ 'fid': fid
222
+ },
223
  })
224
  .done(function(data) {
225
  //Decode json data here
226
  var json = jQuery.parseJSON(data);
227
+ if(json.indexOf != undefined && json.indexOf('@@') != -1){
228
  alert('You do not have the access to edit the data.');
229
  document.getElementById('overlayLoader').style.display = "none";
230
  self.parent.tb_remove();
admin/partials/add-ons.php CHANGED
@@ -4,8 +4,8 @@
4
  width: 48.2%;
5
  }
6
  .grid4 .col:nth-of-type(4n+1), .grid3 .col:nth-of-type(2n+1), .grid2 .col:nth-of-type(2n+1) {
7
- margin-left: 0;
8
- clear: left;
9
  position:relative;
10
  }
11
  img {
@@ -45,7 +45,7 @@ img {
45
  padding-bottom: 20px;
46
  text-align: center !important;
47
  font-weight: normal;
48
-
49
  }
50
  .buybtn{
51
  display: inline-block;
@@ -84,12 +84,12 @@ img {
84
  <div class="wrap about-wrap cf7db-about-wrapp">
85
  <h3>You may be interested in our popular Add-ons of Advanced CF7 DB</h3>
86
  Make your site <i><b> do more </b></i> today.
87
-
88
  <div class="cf7db-extension-wrapper grid3">
89
  <article class="col">
90
  <div class="cf7db-extension-item">
91
  <div class="cf7db-extension-item-img">
92
- <a href="https://codecanyon.net/item/schedule-report-for-advanced-cf7-db/21560647" target="_blank"><img src="https://s3.envato.com/files/242784582/590x300.jpg"></a>
93
  </div>
94
  <div class="cf7db-extension-item-desc">
95
  <p class="cf7db-extension-item-heading">Schedule Report For Advanced CF7 DB </p>
@@ -115,7 +115,7 @@ img {
115
  <article class="col">
116
  <div class="cf7db-extension-item">
117
  <div class="cf7db-extension-item-img">
118
- <a href="https://codecanyon.net/item/advanced-cf7-db-gdpr-compliant/22386060" target="_blank"><img src="https://s3.envato.com/files/251742361/590x300.jpg"></a>
119
  </div>
120
  <div class="cf7db-extension-item-desc">
121
  <p class="cf7db-extension-item-heading">Advanced CF7 DB - GDPR compliant</p>
@@ -136,11 +136,11 @@ img {
136
  <a href="https://codecanyon.net/item/advanced-cf7-db-gdpr-compliant/22386060" class="buybtn" target="_blank"><span class="buybtn-text">Get Now</span></a>
137
  </div>
138
  </div>
139
- </article>
140
  <article class="col">
141
  <div class="cf7db-extension-item">
142
  <div class="cf7db-extension-item-img">
143
- <a href="https://codecanyon.net/item/advanced-cf7-db-user-access-manager/22058788" target="_blank"><img src="https://s3.envato.com/files/248160195/590x300.jpg"></a>
144
  </div>
145
  <div class="cf7db-extension-item-desc">
146
  <p class="cf7db-extension-item-heading"> Advanced CF7 DB - User Access Manager </p>
@@ -152,17 +152,17 @@ img {
152
  <li> Provide access of contact form 7 DB to View & Update data to individual users OR based on user Role.</li>
153
  <li>Provide access of Single/Multiple forms to single user.</li>
154
  </ul>
155
- </div>
156
  </div>
157
  <div class="cf7db-extension-buy-now">
158
  <a href="https://codecanyon.net/item/advanced-cf7-db-user-access-manager/22058788" class="buybtn" target="_blank"><span class="buybtn-text">Get Now</span></a>
159
  </div>
160
  </div>
161
- </article>
162
  <article class="col">
163
  <div class="cf7db-extension-item">
164
  <div class="cf7db-extension-item-img">
165
- <a href="https://codecanyon.net/item/advanced-cf7-db-reply-back/22478892" target="_blank"><img src="https://s3.envato.com/files/252741698/590x300.jpg"></a>
166
  </div>
167
  <div class="cf7db-extension-item-desc">
168
  <p class="cf7db-extension-item-heading"> Advanced CF7 DB - Reply Back </p>
@@ -175,15 +175,15 @@ img {
175
  <li>Compatible with every versions of Advanced CF7 DB.</li>
176
  <li>Easy to install and use.</li>
177
  </ul>
178
- </div>
179
  </div>
180
  <div class="cf7db-extension-buy-now">
181
  <a href="https://codecanyon.net/item/advanced-cf7-db-reply-back/22478892" class="buybtn" target="_blank"><span class="buybtn-text">Get Now</span></a>
182
  </div>
183
  </div>
184
  </article>
185
-
186
-
187
  <table style="width: 100%;"></table>
188
  </div>
189
  </div>
@@ -227,22 +227,22 @@ jQuery(container).each(function() {
227
  ;( function( $, window, document, undefined )
228
  {
229
  'use strict';
230
-
231
  var $list = $( '.grid3' ),
232
  $items = $list.find( '.col .cf7db-extension-item-desc'),
233
  setHeights = function()
234
  {
235
  // DATE Height
236
  $items.css( 'height', 'auto' );
237
-
238
  var perRow = Math.floor( $list.width() / $items.width() );
239
  if( perRow == null || perRow < 2 ) return true;
240
-
241
  for( var i = 0, j = $items.length; i < j; i += perRow )
242
  {
243
  var maxHeight = 0,
244
  $row = $items.slice( i, i + perRow );
245
-
246
  $row.each( function()
247
  {
248
  var itemHeight = parseInt( $( this ).outerHeight() );
@@ -251,19 +251,19 @@ jQuery(container).each(function() {
251
  $row.css( 'height', maxHeight );
252
  }
253
  };
254
-
255
  $(function() { setHeights(); });
256
  $( window ).on( 'resize', setHeights );
257
  $( window ).on( 'load', setHeights );
258
  window.onorientationchange = setHeights;
259
  //$list.find( 'img' ).on( 'load', setHeights );
260
-
261
  })( jQuery, window, document );
262
  jQuery(document).ready(function(){
263
  // equalheight('.grid3 .col .cf7db-extension-item-desc');
264
 
265
  jQuery(window).load(function() {
266
-
267
  // equalheight('.grid3 .col .cf7db-extension-item-desc');
268
  });
269
 
4
  width: 48.2%;
5
  }
6
  .grid4 .col:nth-of-type(4n+1), .grid3 .col:nth-of-type(2n+1), .grid2 .col:nth-of-type(2n+1) {
7
+ margin-left: 0;
8
+ clear: left;
9
  position:relative;
10
  }
11
  img {
45
  padding-bottom: 20px;
46
  text-align: center !important;
47
  font-weight: normal;
48
+
49
  }
50
  .buybtn{
51
  display: inline-block;
84
  <div class="wrap about-wrap cf7db-about-wrapp">
85
  <h3>You may be interested in our popular Add-ons of Advanced CF7 DB</h3>
86
  Make your site <i><b> do more </b></i> today.
87
+
88
  <div class="cf7db-extension-wrapper grid3">
89
  <article class="col">
90
  <div class="cf7db-extension-item">
91
  <div class="cf7db-extension-item-img">
92
+ <a href="https://codecanyon.net/item/schedule-report-for-advanced-cf7-db/21560647" target="_blank"><img src="<?php echo VSZ_CF7_URL_PATH; ?>/images/schedule-report.jpg"></a>
93
  </div>
94
  <div class="cf7db-extension-item-desc">
95
  <p class="cf7db-extension-item-heading">Schedule Report For Advanced CF7 DB </p>
115
  <article class="col">
116
  <div class="cf7db-extension-item">
117
  <div class="cf7db-extension-item-img">
118
+ <a href="https://codecanyon.net/item/advanced-cf7-db-gdpr-compliant/22386060" target="_blank"><img src="<?php echo VSZ_CF7_URL_PATH; ?>/images/gdpr-compliant.jpg"></a>
119
  </div>
120
  <div class="cf7db-extension-item-desc">
121
  <p class="cf7db-extension-item-heading">Advanced CF7 DB - GDPR compliant</p>
136
  <a href="https://codecanyon.net/item/advanced-cf7-db-gdpr-compliant/22386060" class="buybtn" target="_blank"><span class="buybtn-text">Get Now</span></a>
137
  </div>
138
  </div>
139
+ </article>
140
  <article class="col">
141
  <div class="cf7db-extension-item">
142
  <div class="cf7db-extension-item-img">
143
+ <a href="https://codecanyon.net/item/advanced-cf7-db-user-access-manager/22058788" target="_blank"><img src="<?php echo VSZ_CF7_URL_PATH; ?>/images/user-access-manager.jpg"></a>
144
  </div>
145
  <div class="cf7db-extension-item-desc">
146
  <p class="cf7db-extension-item-heading"> Advanced CF7 DB - User Access Manager </p>
152
  <li> Provide access of contact form 7 DB to View & Update data to individual users OR based on user Role.</li>
153
  <li>Provide access of Single/Multiple forms to single user.</li>
154
  </ul>
155
+ </div>
156
  </div>
157
  <div class="cf7db-extension-buy-now">
158
  <a href="https://codecanyon.net/item/advanced-cf7-db-user-access-manager/22058788" class="buybtn" target="_blank"><span class="buybtn-text">Get Now</span></a>
159
  </div>
160
  </div>
161
+ </article>
162
  <article class="col">
163
  <div class="cf7db-extension-item">
164
  <div class="cf7db-extension-item-img">
165
+ <a href="https://codecanyon.net/item/advanced-cf7-db-reply-back/22478892" target="_blank"><img src="<?php echo VSZ_CF7_URL_PATH; ?>/images/reply-back.jpg"></a>
166
  </div>
167
  <div class="cf7db-extension-item-desc">
168
  <p class="cf7db-extension-item-heading"> Advanced CF7 DB - Reply Back </p>
175
  <li>Compatible with every versions of Advanced CF7 DB.</li>
176
  <li>Easy to install and use.</li>
177
  </ul>
178
+ </div>
179
  </div>
180
  <div class="cf7db-extension-buy-now">
181
  <a href="https://codecanyon.net/item/advanced-cf7-db-reply-back/22478892" class="buybtn" target="_blank"><span class="buybtn-text">Get Now</span></a>
182
  </div>
183
  </div>
184
  </article>
185
+
186
+
187
  <table style="width: 100%;"></table>
188
  </div>
189
  </div>
227
  ;( function( $, window, document, undefined )
228
  {
229
  'use strict';
230
+
231
  var $list = $( '.grid3' ),
232
  $items = $list.find( '.col .cf7db-extension-item-desc'),
233
  setHeights = function()
234
  {
235
  // DATE Height
236
  $items.css( 'height', 'auto' );
237
+
238
  var perRow = Math.floor( $list.width() / $items.width() );
239
  if( perRow == null || perRow < 2 ) return true;
240
+
241
  for( var i = 0, j = $items.length; i < j; i += perRow )
242
  {
243
  var maxHeight = 0,
244
  $row = $items.slice( i, i + perRow );
245
+
246
  $row.each( function()
247
  {
248
  var itemHeight = parseInt( $( this ).outerHeight() );
251
  $row.css( 'height', maxHeight );
252
  }
253
  };
254
+
255
  $(function() { setHeights(); });
256
  $( window ).on( 'resize', setHeights );
257
  $( window ).on( 'load', setHeights );
258
  window.onorientationchange = setHeights;
259
  //$list.find( 'img' ).on( 'load', setHeights );
260
+
261
  })( jQuery, window, document );
262
  jQuery(document).ready(function(){
263
  // equalheight('.grid3 .col .cf7db-extension-item-desc');
264
 
265
  jQuery(window).load(function() {
266
+
267
  // equalheight('.grid3 .col .cf7db-extension-item-desc');
268
  });
269
 
admin/partials/contact_form_listing.php CHANGED
@@ -9,7 +9,7 @@ if ( !defined( 'ABSPATH' ) ) {
9
  */
10
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
11
 
12
- //Check contact form class exist or not
13
  if(!is_plugin_active('contact-form-7/wp-contact-form-7.php')){
14
  ?><div class="notice error is-dismissible">
15
  <p>Please activate Contact Form plugin first.</p>
@@ -31,7 +31,7 @@ else{
31
  $form_list = vsz_cf7_get_the_form_list();
32
  $url = '';
33
  $fid = '';
34
-
35
  //Get selected form Id value
36
  if(isset($_GET['cf7_id']) && !empty($_GET['cf7_id'])){
37
  $edit = false;
@@ -45,17 +45,17 @@ else{
45
  'delete' => 'Delete'
46
  );
47
  }
48
- $fid = intval($_GET['cf7_id']);
49
  $menu_url = menu_page_url('contact-form-listing',false);
50
  $url = $menu_url.'&cf7_id='.$fid;
51
- }
52
 
53
  //Get search related value
54
  $search = '';
55
  if(isset($_POST['search_cf7_value']) && !empty($_POST['search_cf7_value'])){
56
  $search = addslashes(addslashes(htmlspecialchars(sanitize_text_field($_POST['search_cf7_value']))));
57
- }
58
-
59
  //Get all form names which entry store in DB
60
  global $wpdb;
61
  $sql = "SELECT `cf7_id` FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` GROUP BY `cf7_id`";
@@ -66,14 +66,14 @@ else{
66
  $arr_form_id[] = (int)$arrVal[0];
67
  }
68
  }
69
-
70
  ?><div class="wrap">
71
  <h2>
72
  View Form Information
73
  </h2>
74
  </div>
75
  <div class="wrap select-specific">
76
- <table class="form-table inner-row">
77
  <tr class="form-field form-required select-form">
78
  <th>Select Form name</th>
79
  <td>
@@ -83,22 +83,22 @@ else{
83
  //Display all existing form list here
84
  $exist_entry_flag = false;
85
  if(!empty($form_list)){
86
-
87
  foreach($form_list as $objForm){
88
  if(!empty($arr_form_id) && in_array($objForm->id(),$arr_form_id)){
89
  $exist_entry_flag = true;
90
  if (cf7_check_capability('cf7_db_form_view'.$objForm->id()) || cf7_check_capability('cf7_db_form_edit_'.$objForm->id()) ){
91
  if(!empty($fid) && $fid === $objForm->id())
92
  print '<option value="'.$objForm->id().'" selected>'.esc_html($objForm->title()).'</option>';
93
- else
94
  print '<option value="'.$objForm->id().'" >'.esc_html($objForm->title()).'</option>';
95
- }
96
  }//Close if
97
  }//close for each
98
  }//close if
99
  ?></select>
100
  </form>
101
- </td>
102
  </tr>
103
  </table>
104
  </div><?php
@@ -108,15 +108,15 @@ else{
108
 
109
  //Check contact form id set or not
110
  if (!empty($fid) && !empty($fields)){
111
-
112
  //Add filter for ordering in entry
113
  $cf7d_entry_order_by = apply_filters('vsz_cf7_entry_order_by', '`data_id` DESC');
114
  $cf7d_entry_order_by = sanitize_text_field($cf7d_entry_order_by);
115
-
116
  $start_date = '';
117
  $end_date = '';
118
  $search_date_query = '';
119
-
120
  //Get post per page value from general setting screen
121
  $show_record = '';
122
  $show_record = get_option('vsz_cf7_settings_show_record_' . $fid, array());
@@ -131,7 +131,7 @@ else{
131
  //Setup offset related value here
132
  $offset = (int)( $page * $items_per_page ) - $items_per_page;
133
  //Customize parameter wise listing screen query
134
-
135
  //Check start and end date is valid or not
136
  if(isset($_POST['start_date']) && isset($_POST['end_date']) && !empty($_POST['start_date']) && !empty($_POST['end_date'])){
137
  $s_date = date_create_from_format("d/m/Y",sanitize_text_field($_POST['start_date']));
@@ -141,68 +141,68 @@ else{
141
  $s_date = false;
142
  $e_date = false;
143
  }
144
-
145
-
146
-
147
  //Check search field value empty or not
148
  if(isset($_POST['search_cf7_value']) && !empty($_POST['search_cf7_value']) && isset($_POST['start_date']) && isset($_POST['end_date']) && empty($_POST['start_date']) && empty($_POST['end_date'])){
149
-
150
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
151
  SELECT * FROM (
152
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND
153
- `cf7_id` = ".$fid." ".((!empty($search)) ? "AND `value` LIKE '%%".$search."%%'" : ""). "
154
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
155
- )
156
  temp_table) ORDER BY " . $cf7d_entry_order_by;
157
  $arr_total = $wpdb->get_results("SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = " . (int)$fid . " ".((!empty($search)) ? "AND `value` LIKE '%%".$search."%%'" : "")." GROUP BY `data_id`");
158
-
159
  }
160
  //Check search field value empty and date filter active or not
161
  else if(isset($_POST['search_cf7_value']) && empty($_POST['search_cf7_value']) && isset($_POST['start_date']) && isset($_POST['end_date']) && !empty($_POST['start_date']) && !empty($_POST['end_date']) && $s_date !== false && $e_date !== false){
162
-
163
  //Get start date information
164
  $start_date = date_format($s_date,"Y-m-d");
165
-
166
  //Get end date information
167
  $end_date = date_format($e_date,"Y-m-d");
168
-
169
  //Setup date parameter value in query
170
  $search_date_query = "AND `name` = 'submit_time' AND value between '".$start_date."' and '".$end_date." 23:59:59'";
171
-
172
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
173
  SELECT * FROM (
174
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query."
175
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
176
- )
177
- temp_table)
178
  ORDER BY " . $cf7d_entry_order_by;
179
-
180
  //Get total entries information
181
  $total_query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
182
  SELECT * FROM (
183
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query."
184
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by."
185
- )
186
- temp_table)
187
  GROUP BY `data_id` ORDER BY " . $cf7d_entry_order_by;
188
-
189
  $arr_total = $wpdb->get_results($total_query);
190
  }
191
  //Check search field value not empty and date filter active or not
192
  else if(isset($_POST['search_cf7_value']) && !empty($_POST['search_cf7_value']) && isset($_POST['start_date']) && isset($_POST['end_date']) && !empty($_POST['start_date']) && !empty($_POST['end_date']) && $s_date !== false && $e_date !== false){
193
-
194
-
195
  //Get start date information
196
  $start_date = date_format($s_date,"Y-m-d");
197
-
198
  //Get end date information
199
  $end_date = date_format($e_date,"Y-m-d").' 23:59:59';
200
-
201
- //Get date filter related entries information
202
- $date_query = "SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."`
203
- WHERE 1 = 1 AND `cf7_id` = ".$fid." AND `name` = 'submit_time' AND value between '".$start_date."' and '".$end_date."'
204
  GROUP BY `data_id` ORDER BY `data_id` DESC";
205
-
206
  $rs_date = $wpdb->get_results($date_query);
207
  //Get all entries and setup a string
208
  $data_ids = '';
@@ -212,44 +212,44 @@ else{
212
  }
213
  $data_ids = rtrim($data_ids,',');
214
  }
215
-
216
  //get all entrise information
217
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
218
  SELECT * FROM (
219
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."`
220
- WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query." ".((!empty($search)) ? "AND
221
- `value` LIKE '%%".$search."%%'" : ""). " AND data_id IN (".$data_ids.")
222
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
223
- )
224
- temp_table)
225
- ORDER BY " . $cf7d_entry_order_by;
226
-
227
  //Get total entries information
228
  $total_query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
229
  SELECT * FROM (
230
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query." ".((!empty($search)) ? "AND
231
- `value` LIKE '%%".$search."%%'" : ""). " AND data_id IN (".$data_ids.")
232
- GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by."
233
- )
234
- temp_table)
235
  GROUP BY `data_id` ORDER BY " . $cf7d_entry_order_by;
236
-
237
  $arr_total = $wpdb->get_results($total_query);
238
-
239
  }
240
  //Call when any filter not active on Listing screen
241
  else{
242
-
243
  if(isset($_GET["orderby"]) && isset($_GET["order"]) && !empty($_GET["orderby"]) && !empty($_GET["order"]) && (strtolower($_GET["order"]) == 'asc' || strtolower($_GET["order"]) == 'desc')){
244
-
245
  $order = esc_sql($_GET['order']);
246
  $orderby = esc_sql($_GET['orderby']);
247
  $qry = "SELECT `data_id` FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND `name` = '".$orderby."' AND data_id IN(
248
  SELECT * FROM (
249
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid."
250
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
251
- )
252
- temp_table)
253
  ORDER BY `value` ".$order."," . $cf7d_entry_order_by;
254
  $idVals = $wpdb->get_results ( $qry );
255
  $id_val = array();
@@ -258,46 +258,46 @@ else{
258
  $id_val[] = $o_id->data_id;
259
  }
260
  }
261
-
262
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
263
  SELECT * FROM (
264
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid."
265
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
266
- )
267
- temp_table)
268
  ORDER BY FIELD(`data_id`, ". implode(',',$id_val) ." )";
269
-
270
  }
271
  else{
272
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
273
  SELECT * FROM (
274
- SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid."
275
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
276
- )
277
- temp_table)
278
  ORDER BY " . $cf7d_entry_order_by;
279
 
280
  }
281
-
282
  //Get total entries information
283
  $arr_total = $wpdb->get_results("SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = " .$fid . " ".((!empty($search)) ? "AND `value` LIKE '%%".$search."%%'" : "")." GROUP BY `data_id`");
284
  }
285
-
286
-
287
  //Execute query here
288
  $data = $wpdb->get_results($query);
289
-
290
  //Get entry wise all fields information
291
  $data_sorted = vsz_cf7_sortdata($data);
292
-
293
- //get total count
294
  $total = count($arr_total);
295
-
296
  //Define bulk action array
297
-
298
- //Add filter for customize bulk action values
299
  $entry_actions = apply_filters('vsz_cf7_entry_actions', $entry_actions);
300
-
301
  //Form listing design structure start here
302
  ?><div class="wrap our-class">
303
  <form class="vsz-cf7-listing row" action="<?php print esc_url($url);?>" method="post" id="cf7d-admin-action-frm" >
@@ -313,9 +313,9 @@ else{
313
  <input type="text" name="end_date" id="end_date" placeholder="To" value="<?php print isset($_POST['end_date']) ? esc_attr($_POST['end_date']) : '';?>" class="input-cf-date" >
314
  <input type="button" name="search_date" id="search_date" value="Search By Date" title="Search By Date" class="button action" >
315
  </div>
316
- <div class="type-something"><?php
317
  //Display Search section here
318
- do_action('vsz_cf7_after_datesection_btn', $fid);
319
  ?></div>
320
  <div class="reset-class"><a href="<?php print esc_url($url);?>" title="Reset All" class="button">Reset All</a></div>
321
  </div>
@@ -326,13 +326,13 @@ else{
326
  <div class="actions bulkactions">
327
  <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select bulk action');?></label>
328
  <select name="action" id="bulk-action-selector-top">
329
- <option value="-1"><?php _e('Bulk Actions'); ?></option><?php
330
  //Get all bulk action values
331
- echo vsz_cf7_arr_to_option($entry_actions);
332
  ?></select>
333
- <input id="doaction" name="btn_apply" class="button action" value="<?php _e('Apply'); ?>" title="<?php _e('Apply'); ?>" type="submit" /><?php
334
  //Display Export button option values
335
- do_action('vsz_cf7_after_bulkaction_btn', $fid);
336
  ?><div class="tablenav-pages">
337
  <span class="displaying-num"><?php echo (($total == 1) ?
338
  '1 ' . __('item') :
@@ -347,10 +347,10 @@ else{
347
  'total' => ceil($total / $items_per_page),
348
  'current' => $page,
349
  )));
350
-
351
 
352
  ?></span>
353
- </div>
354
  </div>
355
  <br class="clear">
356
  </div>
@@ -364,7 +364,7 @@ else{
364
  //Display Edit headion field
365
  if($edit == true){
366
  do_action('vsz_cf7_admin_after_heading_field');
367
- }
368
  //Define table header section here
369
  foreach ($fields as $k => $v){
370
  echo '<th class="manage-column" data-key="'.esc_html($v).'">'.vsz_cf7_admin_get_field_name($v).'</th>';
@@ -375,7 +375,7 @@ else{
375
  //Add character count functionalirty here
376
  $display_character = (int) apply_filters('vsz_display_character_count',30);
377
  $arr_field_type_info = vsz_field_type_info($fid);
378
-
379
  //Get all fields related information
380
  if(!empty($data_sorted)){
381
  foreach ($data_sorted as $k => $v) {
@@ -391,7 +391,7 @@ else{
391
  //Get fields related values
392
  $_value = ((isset($v[$k2])) ? $v[$k2] : '&nbsp;');
393
  $_value1 = filter_var($_value, FILTER_SANITIZE_URL);
394
-
395
  //Check value is URL or not
396
  if (!filter_var($_value1, FILTER_VALIDATE_URL) === false) {
397
  $_value = esc_url($_value);
@@ -410,11 +410,11 @@ else{
410
  $_value = esc_html(html_entity_decode($_value));
411
  //var_dump(($_value)); var_dump(strlen($_value)); exit;
412
  if(strlen($_value) > $display_character){
413
-
414
  echo '<td data-head="'.vsz_cf7_admin_get_field_name($v2).'">'.substr($_value, 0, $display_character).'...</td>';
415
  }else{
416
  echo '<td data-head="'.vsz_cf7_admin_get_field_name($v2).'">'.$_value.'</td>';
417
- }
418
  }
419
  }//Close foreach
420
  echo '</tr>';
@@ -435,7 +435,7 @@ else{
435
  echo '<td class="manage-column column-cb check-column"><input type="checkbox" id="cb-select-all-2" /></td>';
436
  if($edit == true){
437
  do_action('vsz_cf7_admin_after_heading_field');
438
- }
439
  foreach ($fields as $k => $v){
440
  echo '<th class="manage-column" data-key="'.esc_html($v).'">'.vsz_cf7_admin_get_field_name($v).'</th>';
441
  }
@@ -444,12 +444,12 @@ else{
444
  </table>
445
  </div>
446
  </div>
447
-
448
- <input type="hidden" name="cpage" value="<?php echo $page;?>" id="cpage">
449
- <input type="hidden" name="totalPage" value="<?php print ceil($total / $items_per_page);?>" id="totalPage">
450
  </form>
451
  <script>
452
- //Setup pagination related functionality when click on page link then form submitted
453
  jQuery(".pagination-links a").on('click',function(){
454
  var final_id;
455
  var url = jQuery(this).attr('href');
@@ -462,24 +462,24 @@ else{
462
  jQuery(this).attr("href","javascript:void(0)");
463
  jQuery('#cpage').val(final_id);
464
  document.getElementById('cf7d-admin-action-frm').submit();
465
- }
466
  });
467
-
468
  //Add custom class in body tag when click on Setting button
469
  jQuery('#cf7d_setting_form').click(function(){
470
  jQuery('body').addClass('our-body-class');
471
  });
472
- //Updating record
473
  jQuery(document).on('click','#update_cf7_value',function(){
474
  var filterdata = jQuery('.vsz-cf7-listing').html();
475
  jQuery('.cf7d-modal-form').append('<div style="display:none">'+filterdata+'</div>');
476
 
477
  });
478
-
479
  </script>
480
- </div><?php
481
  //Define setting and Edit popup call back function
482
- do_action('vsz_cf7_after_admin_form',$fid);
483
  }//Close if for check form id empty or not
484
  else if(!$exist_entry_flag){
485
  print '<div class="popup-note"><span>Currently not submission any form data.</span></div>';
9
  */
10
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
11
 
12
+ //Check contact form class exist or not
13
  if(!is_plugin_active('contact-form-7/wp-contact-form-7.php')){
14
  ?><div class="notice error is-dismissible">
15
  <p>Please activate Contact Form plugin first.</p>
31
  $form_list = vsz_cf7_get_the_form_list();
32
  $url = '';
33
  $fid = '';
34
+
35
  //Get selected form Id value
36
  if(isset($_GET['cf7_id']) && !empty($_GET['cf7_id'])){
37
  $edit = false;
45
  'delete' => 'Delete'
46
  );
47
  }
48
+ $fid = intval(sanitize_text_field($_GET['cf7_id']));
49
  $menu_url = menu_page_url('contact-form-listing',false);
50
  $url = $menu_url.'&cf7_id='.$fid;
51
+ }
52
 
53
  //Get search related value
54
  $search = '';
55
  if(isset($_POST['search_cf7_value']) && !empty($_POST['search_cf7_value'])){
56
  $search = addslashes(addslashes(htmlspecialchars(sanitize_text_field($_POST['search_cf7_value']))));
57
+ }
58
+
59
  //Get all form names which entry store in DB
60
  global $wpdb;
61
  $sql = "SELECT `cf7_id` FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` GROUP BY `cf7_id`";
66
  $arr_form_id[] = (int)$arrVal[0];
67
  }
68
  }
69
+
70
  ?><div class="wrap">
71
  <h2>
72
  View Form Information
73
  </h2>
74
  </div>
75
  <div class="wrap select-specific">
76
+ <table class="form-table inner-row">
77
  <tr class="form-field form-required select-form">
78
  <th>Select Form name</th>
79
  <td>
83
  //Display all existing form list here
84
  $exist_entry_flag = false;
85
  if(!empty($form_list)){
86
+
87
  foreach($form_list as $objForm){
88
  if(!empty($arr_form_id) && in_array($objForm->id(),$arr_form_id)){
89
  $exist_entry_flag = true;
90
  if (cf7_check_capability('cf7_db_form_view'.$objForm->id()) || cf7_check_capability('cf7_db_form_edit_'.$objForm->id()) ){
91
  if(!empty($fid) && $fid === $objForm->id())
92
  print '<option value="'.$objForm->id().'" selected>'.esc_html($objForm->title()).'</option>';
93
+ else
94
  print '<option value="'.$objForm->id().'" >'.esc_html($objForm->title()).'</option>';
95
+ }
96
  }//Close if
97
  }//close for each
98
  }//close if
99
  ?></select>
100
  </form>
101
+ </td>
102
  </tr>
103
  </table>
104
  </div><?php
108
 
109
  //Check contact form id set or not
110
  if (!empty($fid) && !empty($fields)){
111
+
112
  //Add filter for ordering in entry
113
  $cf7d_entry_order_by = apply_filters('vsz_cf7_entry_order_by', '`data_id` DESC');
114
  $cf7d_entry_order_by = sanitize_text_field($cf7d_entry_order_by);
115
+
116
  $start_date = '';
117
  $end_date = '';
118
  $search_date_query = '';
119
+
120
  //Get post per page value from general setting screen
121
  $show_record = '';
122
  $show_record = get_option('vsz_cf7_settings_show_record_' . $fid, array());
131
  //Setup offset related value here
132
  $offset = (int)( $page * $items_per_page ) - $items_per_page;
133
  //Customize parameter wise listing screen query
134
+
135
  //Check start and end date is valid or not
136
  if(isset($_POST['start_date']) && isset($_POST['end_date']) && !empty($_POST['start_date']) && !empty($_POST['end_date'])){
137
  $s_date = date_create_from_format("d/m/Y",sanitize_text_field($_POST['start_date']));
141
  $s_date = false;
142
  $e_date = false;
143
  }
144
+
145
+
146
+
147
  //Check search field value empty or not
148
  if(isset($_POST['search_cf7_value']) && !empty($_POST['search_cf7_value']) && isset($_POST['start_date']) && isset($_POST['end_date']) && empty($_POST['start_date']) && empty($_POST['end_date'])){
149
+
150
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
151
  SELECT * FROM (
152
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND
153
+ `cf7_id` = ".$fid." ".((!empty($search)) ? "AND `value` LIKE '%%".$search."%%'" : ""). "
154
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
155
+ )
156
  temp_table) ORDER BY " . $cf7d_entry_order_by;
157
  $arr_total = $wpdb->get_results("SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = " . (int)$fid . " ".((!empty($search)) ? "AND `value` LIKE '%%".$search."%%'" : "")." GROUP BY `data_id`");
158
+
159
  }
160
  //Check search field value empty and date filter active or not
161
  else if(isset($_POST['search_cf7_value']) && empty($_POST['search_cf7_value']) && isset($_POST['start_date']) && isset($_POST['end_date']) && !empty($_POST['start_date']) && !empty($_POST['end_date']) && $s_date !== false && $e_date !== false){
162
+
163
  //Get start date information
164
  $start_date = date_format($s_date,"Y-m-d");
165
+
166
  //Get end date information
167
  $end_date = date_format($e_date,"Y-m-d");
168
+
169
  //Setup date parameter value in query
170
  $search_date_query = "AND `name` = 'submit_time' AND value between '".$start_date."' and '".$end_date." 23:59:59'";
171
+
172
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
173
  SELECT * FROM (
174
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query."
175
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
176
+ )
177
+ temp_table)
178
  ORDER BY " . $cf7d_entry_order_by;
179
+
180
  //Get total entries information
181
  $total_query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
182
  SELECT * FROM (
183
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query."
184
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by."
185
+ )
186
+ temp_table)
187
  GROUP BY `data_id` ORDER BY " . $cf7d_entry_order_by;
188
+
189
  $arr_total = $wpdb->get_results($total_query);
190
  }
191
  //Check search field value not empty and date filter active or not
192
  else if(isset($_POST['search_cf7_value']) && !empty($_POST['search_cf7_value']) && isset($_POST['start_date']) && isset($_POST['end_date']) && !empty($_POST['start_date']) && !empty($_POST['end_date']) && $s_date !== false && $e_date !== false){
193
+
194
+
195
  //Get start date information
196
  $start_date = date_format($s_date,"Y-m-d");
197
+
198
  //Get end date information
199
  $end_date = date_format($e_date,"Y-m-d").' 23:59:59';
200
+
201
+ //Get date filter related entries information
202
+ $date_query = "SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."`
203
+ WHERE 1 = 1 AND `cf7_id` = ".$fid." AND `name` = 'submit_time' AND value between '".$start_date."' and '".$end_date."'
204
  GROUP BY `data_id` ORDER BY `data_id` DESC";
205
+
206
  $rs_date = $wpdb->get_results($date_query);
207
  //Get all entries and setup a string
208
  $data_ids = '';
212
  }
213
  $data_ids = rtrim($data_ids,',');
214
  }
215
+
216
  //get all entrise information
217
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
218
  SELECT * FROM (
219
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."`
220
+ WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query." ".((!empty($search)) ? "AND
221
+ `value` LIKE '%%".$search."%%'" : ""). " AND data_id IN (".$data_ids.")
222
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
223
+ )
224
+ temp_table)
225
+ ORDER BY " . $cf7d_entry_order_by;
226
+
227
  //Get total entries information
228
  $total_query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
229
  SELECT * FROM (
230
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid." ".$search_date_query." ".((!empty($search)) ? "AND
231
+ `value` LIKE '%%".$search."%%'" : ""). " AND data_id IN (".$data_ids.")
232
+ GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by."
233
+ )
234
+ temp_table)
235
  GROUP BY `data_id` ORDER BY " . $cf7d_entry_order_by;
236
+
237
  $arr_total = $wpdb->get_results($total_query);
238
+
239
  }
240
  //Call when any filter not active on Listing screen
241
  else{
242
+
243
  if(isset($_GET["orderby"]) && isset($_GET["order"]) && !empty($_GET["orderby"]) && !empty($_GET["order"]) && (strtolower($_GET["order"]) == 'asc' || strtolower($_GET["order"]) == 'desc')){
244
+
245
  $order = esc_sql($_GET['order']);
246
  $orderby = esc_sql($_GET['orderby']);
247
  $qry = "SELECT `data_id` FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND `name` = '".$orderby."' AND data_id IN(
248
  SELECT * FROM (
249
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid."
250
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
251
+ )
252
+ temp_table)
253
  ORDER BY `value` ".$order."," . $cf7d_entry_order_by;
254
  $idVals = $wpdb->get_results ( $qry );
255
  $id_val = array();
258
  $id_val[] = $o_id->data_id;
259
  }
260
  }
261
+
262
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
263
  SELECT * FROM (
264
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid."
265
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
266
+ )
267
+ temp_table)
268
  ORDER BY FIELD(`data_id`, ". implode(',',$id_val) ." )";
269
+
270
  }
271
  else{
272
  $query = "SELECT * FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = ".$fid." AND data_id IN(
273
  SELECT * FROM (
274
+ SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE 1 = 1 AND `cf7_id` = ".$fid."
275
  GROUP BY `data_id` ORDER BY ".$cf7d_entry_order_by." LIMIT ".$offset.",".$items_per_page."
276
+ )
277
+ temp_table)
278
  ORDER BY " . $cf7d_entry_order_by;
279
 
280
  }
281
+
282
  //Get total entries information
283
  $arr_total = $wpdb->get_results("SELECT data_id FROM `".VSZ_CF7_DATA_ENTRY_TABLE_NAME."` WHERE `cf7_id` = " .$fid . " ".((!empty($search)) ? "AND `value` LIKE '%%".$search."%%'" : "")." GROUP BY `data_id`");
284
  }
285
+
286
+
287
  //Execute query here
288
  $data = $wpdb->get_results($query);
289
+
290
  //Get entry wise all fields information
291
  $data_sorted = vsz_cf7_sortdata($data);
292
+
293
+ //get total count
294
  $total = count($arr_total);
295
+
296
  //Define bulk action array
297
+
298
+ //Add filter for customize bulk action values
299
  $entry_actions = apply_filters('vsz_cf7_entry_actions', $entry_actions);
300
+
301
  //Form listing design structure start here
302
  ?><div class="wrap our-class">
303
  <form class="vsz-cf7-listing row" action="<?php print esc_url($url);?>" method="post" id="cf7d-admin-action-frm" >
313
  <input type="text" name="end_date" id="end_date" placeholder="To" value="<?php print isset($_POST['end_date']) ? esc_attr($_POST['end_date']) : '';?>" class="input-cf-date" >
314
  <input type="button" name="search_date" id="search_date" value="Search By Date" title="Search By Date" class="button action" >
315
  </div>
316
+ <div class="type-something"><?php
317
  //Display Search section here
318
+ do_action('vsz_cf7_after_datesection_btn', $fid);
319
  ?></div>
320
  <div class="reset-class"><a href="<?php print esc_url($url);?>" title="Reset All" class="button">Reset All</a></div>
321
  </div>
326
  <div class="actions bulkactions">
327
  <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select bulk action');?></label>
328
  <select name="action" id="bulk-action-selector-top">
329
+ <option value="-1"><?php _e('Bulk Actions'); ?></option><?php
330
  //Get all bulk action values
331
+ echo vsz_cf7_arr_to_option($entry_actions);
332
  ?></select>
333
+ <input id="doaction" name="btn_apply" class="button action" value="<?php _e('Apply'); ?>" title="<?php _e('Apply'); ?>" type="submit" /><?php
334
  //Display Export button option values
335
+ do_action('vsz_cf7_after_bulkaction_btn', $fid);
336
  ?><div class="tablenav-pages">
337
  <span class="displaying-num"><?php echo (($total == 1) ?
338
  '1 ' . __('item') :
347
  'total' => ceil($total / $items_per_page),
348
  'current' => $page,
349
  )));
350
+
351
 
352
  ?></span>
353
+ </div>
354
  </div>
355
  <br class="clear">
356
  </div>
364
  //Display Edit headion field
365
  if($edit == true){
366
  do_action('vsz_cf7_admin_after_heading_field');
367
+ }
368
  //Define table header section here
369
  foreach ($fields as $k => $v){
370
  echo '<th class="manage-column" data-key="'.esc_html($v).'">'.vsz_cf7_admin_get_field_name($v).'</th>';
375
  //Add character count functionalirty here
376
  $display_character = (int) apply_filters('vsz_display_character_count',30);
377
  $arr_field_type_info = vsz_field_type_info($fid);
378
+
379
  //Get all fields related information
380
  if(!empty($data_sorted)){
381
  foreach ($data_sorted as $k => $v) {
391
  //Get fields related values
392
  $_value = ((isset($v[$k2])) ? $v[$k2] : '&nbsp;');
393
  $_value1 = filter_var($_value, FILTER_SANITIZE_URL);
394
+
395
  //Check value is URL or not
396
  if (!filter_var($_value1, FILTER_VALIDATE_URL) === false) {
397
  $_value = esc_url($_value);
410
  $_value = esc_html(html_entity_decode($_value));
411
  //var_dump(($_value)); var_dump(strlen($_value)); exit;
412
  if(strlen($_value) > $display_character){
413
+
414
  echo '<td data-head="'.vsz_cf7_admin_get_field_name($v2).'">'.substr($_value, 0, $display_character).'...</td>';
415
  }else{
416
  echo '<td data-head="'.vsz_cf7_admin_get_field_name($v2).'">'.$_value.'</td>';
417
+ }
418
  }
419
  }//Close foreach
420
  echo '</tr>';
435
  echo '<td class="manage-column column-cb check-column"><input type="checkbox" id="cb-select-all-2" /></td>';
436
  if($edit == true){
437
  do_action('vsz_cf7_admin_after_heading_field');
438
+ }
439
  foreach ($fields as $k => $v){
440
  echo '<th class="manage-column" data-key="'.esc_html($v).'">'.vsz_cf7_admin_get_field_name($v).'</th>';
441
  }
444
  </table>
445
  </div>
446
  </div>
447
+
448
+ <input type="hidden" name="cpage" value="<?php echo $page;?>" id="cpage">
449
+ <input type="hidden" name="totalPage" value="<?php print ceil($total / $items_per_page);?>" id="totalPage">
450
  </form>
451
  <script>
452
+ //Setup pagination related functionality when click on page link then form submitted
453
  jQuery(".pagination-links a").on('click',function(){
454
  var final_id;
455
  var url = jQuery(this).attr('href');
462
  jQuery(this).attr("href","javascript:void(0)");
463
  jQuery('#cpage').val(final_id);
464
  document.getElementById('cf7d-admin-action-frm').submit();
465
+ }
466
  });
467
+
468
  //Add custom class in body tag when click on Setting button
469
  jQuery('#cf7d_setting_form').click(function(){
470
  jQuery('body').addClass('our-body-class');
471
  });
472
+ //Updating record
473
  jQuery(document).on('click','#update_cf7_value',function(){
474
  var filterdata = jQuery('.vsz-cf7-listing').html();
475
  jQuery('.cf7d-modal-form').append('<div style="display:none">'+filterdata+'</div>');
476
 
477
  });
478
+
479
  </script>
480
+ </div><?php
481
  //Define setting and Edit popup call back function
482
+ do_action('vsz_cf7_after_admin_form',$fid);
483
  }//Close if for check form id empty or not
484
  else if(!$exist_entry_flag){
485
  print '<div class="popup-note"><span>Currently not submission any form data.</span></div>';
advanced-cf7-db.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: Advanced CF7 DB
10
  * Plugin URI: https://wordpress.org/plugins/advanced-cf7-db/
11
  * Description: Save all contact form 7 submitted data to the database, View, Export, ordering, Change field labels, Import data using CSV very easily.
12
- * Version: 1.7.0
13
  * Author: Vsourz Digital
14
  * Author URI: https://www.vsourz.com
15
  * License: GPL-2.0+
@@ -23,7 +23,7 @@ if ( ! defined( 'WPINC' ) ) {
23
  die;
24
  }
25
  global $vsz_cf7db_current_version;
26
- $vsz_cf7db_current_version = '1.7.0';
27
  /**
28
  * Defining all the table names and setting their prefix here
29
  */
@@ -34,6 +34,7 @@ define('VSZ_CF7_DATA_TABLE_NAME', $wpdb->prefix.'cf7_vdata');
34
  define('VSZ_CF7_DATA_ENTRY_TABLE_NAME', $wpdb->prefix.'cf7_vdata_entry');
35
 
36
  define('VSZ_CF7_UPLOAD_FOLDER','advanced-cf7-upload');
 
37
 
38
  /**
39
  * The code that runs during plugin activation.
9
  * Plugin Name: Advanced CF7 DB
10
  * Plugin URI: https://wordpress.org/plugins/advanced-cf7-db/
11
  * Description: Save all contact form 7 submitted data to the database, View, Export, ordering, Change field labels, Import data using CSV very easily.
12
+ * Version: 1.7.1
13
  * Author: Vsourz Digital
14
  * Author URI: https://www.vsourz.com
15
  * License: GPL-2.0+
23
  die;
24
  }
25
  global $vsz_cf7db_current_version;
26
+ $vsz_cf7db_current_version = '1.7.1';
27
  /**
28
  * Defining all the table names and setting their prefix here
29
  */
34
  define('VSZ_CF7_DATA_ENTRY_TABLE_NAME', $wpdb->prefix.'cf7_vdata_entry');
35
 
36
  define('VSZ_CF7_UPLOAD_FOLDER','advanced-cf7-upload');
37
+ define('VSZ_CF7_URL_PATH',plugins_url('advanced-cf7-db'));
38
 
39
  /**
40
  * The code that runs during plugin activation.
images/gdpr-compliant.jpg ADDED
Binary file
images/reply-back.jpg ADDED
Binary file
images/schedule-report.jpg ADDED
Binary file
images/user-access-manager.jpg ADDED
Binary file
includes/class-advanced-cf7-db.php CHANGED
@@ -107,7 +107,7 @@ class Advanced_Cf7_Db {
107
  * of the plugin.
108
  */
109
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-advanced-cf7-db-i18n.php';
110
-
111
  /**
112
  * The file responsible for defining all functions that used in both admin and frontend
113
  * side of the site.
@@ -118,12 +118,7 @@ class Advanced_Cf7_Db {
118
  * The class responsible for defining all actions that occur in the admin area.
119
  */
120
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-advanced-cf7-db-admin.php';
121
-
122
- /*
123
- *** For dom pdf
124
- */
125
- // require_once(dirname(dirname(__FILE__)).'/admin/pdfgenerate/dompdf/src/Dompdf.php');
126
-
127
  /**
128
  * The class responsible for defining all actions that occur in the public-facing
129
  * side of the site.
@@ -164,55 +159,55 @@ class Advanced_Cf7_Db {
164
 
165
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
166
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
167
-
168
  // Adding custom screen
169
  $this->loader->add_action('admin_menu', $plugin_admin, 'vsz_cf7_plugin_menu',9);
170
-
171
- //Get form related fields information
172
  $this->loader->add_filter('vsz_cf7_admin_fields', $plugin_admin,'vsz_cf7_admin_fields_callback', 10, 2);
173
-
174
  //Display export option box throw this action
175
  $this->loader->add_action('vsz_cf7_after_bulkaction_btn', $plugin_admin,'vsz_cf7_after_bulkaction_btn_callback', 20, 2);
176
-
177
  //Display search text box here
178
  $this->loader->add_action('vsz_cf7_after_datesection_btn', $plugin_admin,'vsz_cf7_after_datesection_btn_callback', 20, 2);
179
-
180
- //Display "Display setting" banner here
181
  $this->loader->add_action('vsz_cf7_display_settings_btn', $plugin_admin,'vsz_cf7_display_settings_btn_callback', 20);
182
-
183
-
184
  //Add additional table header here
185
  $this->loader->add_action('vsz_cf7_admin_after_heading_field',$plugin_admin, 'vsz_cf7_admin_after_heading_field_callback', 11, 2);
186
-
187
  //Display edit information link here
188
  $this->loader->add_action('vsz_cf7_admin_after_body_field',$plugin_admin, 'vsz_cf7_admin_after_body_edit_field_func', 21, 2);
189
-
190
- //Display field setting form here
191
  $this->loader->add_action('vsz_cf7_after_admin_form', $plugin_admin,'vsz_cf7_after_admin_setting_form_callback');
192
  //Display edit entry form here
193
  $this->loader->add_action('vsz_cf7_after_admin_form', $plugin_admin,'vsz_cf7_after_admin_edit_values_form_callback');
194
-
195
  //Save all other additionals values here
196
  $this->loader->add_action('admin_init', $plugin_admin,'vsz_cf7_save_setting_callback');
197
-
198
  //Call Ajax for display entry related form information in edit form
199
  $this->loader->add_action('wp_ajax_vsz_cf7_edit_form_value',$plugin_admin, 'vsz_cf7_edit_form_ajax');
200
-
201
- //Define filter for which field information not editable in edit form
202
  $this->loader->add_filter('vsz_cf7_not_editable_fields',$plugin_admin, 'vsz_cf7_not_editable_fields_callback');
203
 
204
  // Multi site support
205
  $this->loader->add_action( 'wpmu_new_blog',$plugin_admin,'vsz_cf7_add_new_table_for_sites', 10, 6);
206
-
207
  // Provide multi site support for active plugin
208
  $this->loader->add_action( 'plugins_loaded',$plugin_admin,'vsz_cf7_create_new_table_for_sites');
209
-
210
  // Provide custom capability
211
  $this->loader->add_action('save_post',$plugin_admin,'vsz_cf7_create_role_for_contact_form');
212
-
213
  // Edit Popup file upload
214
  $this->loader->add_action('wp_ajax_acf7_db_edit_scr_file_upload',$plugin_admin,'vsz_acf7_db_edit_scr_file_upload');
215
-
216
  // Edit Popup file delete
217
  $this->loader->add_action('wp_ajax_acf7_db_edit_scr_file_delete',$plugin_admin,'vsz_acf7_db_edit_scr_file_delete');
218
  }
@@ -225,12 +220,12 @@ class Advanced_Cf7_Db {
225
  * @access private
226
  */
227
  private function define_public_hooks() {
228
-
229
  $plugin_public = new Advanced_Cf7_Db_Public( $this->get_plugin_name(), $this->get_version() );
230
 
231
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_public, 'enqueue_styles' );
232
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
233
-
234
  // Register shortcode
235
  $this->loader->add_action( 'after_setup_theme',$plugin_public,'vsz_acf7_db_register_shortcode' );
236
 
107
  * of the plugin.
108
  */
109
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-advanced-cf7-db-i18n.php';
110
+
111
  /**
112
  * The file responsible for defining all functions that used in both admin and frontend
113
  * side of the site.
118
  * The class responsible for defining all actions that occur in the admin area.
119
  */
120
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-advanced-cf7-db-admin.php';
121
+
 
 
 
 
 
122
  /**
123
  * The class responsible for defining all actions that occur in the public-facing
124
  * side of the site.
159
 
160
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
161
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
162
+
163
  // Adding custom screen
164
  $this->loader->add_action('admin_menu', $plugin_admin, 'vsz_cf7_plugin_menu',9);
165
+
166
+ //Get form related fields information
167
  $this->loader->add_filter('vsz_cf7_admin_fields', $plugin_admin,'vsz_cf7_admin_fields_callback', 10, 2);
168
+
169
  //Display export option box throw this action
170
  $this->loader->add_action('vsz_cf7_after_bulkaction_btn', $plugin_admin,'vsz_cf7_after_bulkaction_btn_callback', 20, 2);
171
+
172
  //Display search text box here
173
  $this->loader->add_action('vsz_cf7_after_datesection_btn', $plugin_admin,'vsz_cf7_after_datesection_btn_callback', 20, 2);
174
+
175
+ //Display "Display setting" banner here
176
  $this->loader->add_action('vsz_cf7_display_settings_btn', $plugin_admin,'vsz_cf7_display_settings_btn_callback', 20);
177
+
178
+
179
  //Add additional table header here
180
  $this->loader->add_action('vsz_cf7_admin_after_heading_field',$plugin_admin, 'vsz_cf7_admin_after_heading_field_callback', 11, 2);
181
+
182
  //Display edit information link here
183
  $this->loader->add_action('vsz_cf7_admin_after_body_field',$plugin_admin, 'vsz_cf7_admin_after_body_edit_field_func', 21, 2);
184
+
185
+ //Display field setting form here
186
  $this->loader->add_action('vsz_cf7_after_admin_form', $plugin_admin,'vsz_cf7_after_admin_setting_form_callback');
187
  //Display edit entry form here
188
  $this->loader->add_action('vsz_cf7_after_admin_form', $plugin_admin,'vsz_cf7_after_admin_edit_values_form_callback');
189
+
190
  //Save all other additionals values here
191
  $this->loader->add_action('admin_init', $plugin_admin,'vsz_cf7_save_setting_callback');
192
+
193
  //Call Ajax for display entry related form information in edit form
194
  $this->loader->add_action('wp_ajax_vsz_cf7_edit_form_value',$plugin_admin, 'vsz_cf7_edit_form_ajax');
195
+
196
+ //Define filter for which field information not editable in edit form
197
  $this->loader->add_filter('vsz_cf7_not_editable_fields',$plugin_admin, 'vsz_cf7_not_editable_fields_callback');
198
 
199
  // Multi site support
200
  $this->loader->add_action( 'wpmu_new_blog',$plugin_admin,'vsz_cf7_add_new_table_for_sites', 10, 6);
201
+
202
  // Provide multi site support for active plugin
203
  $this->loader->add_action( 'plugins_loaded',$plugin_admin,'vsz_cf7_create_new_table_for_sites');
204
+
205
  // Provide custom capability
206
  $this->loader->add_action('save_post',$plugin_admin,'vsz_cf7_create_role_for_contact_form');
207
+
208
  // Edit Popup file upload
209
  $this->loader->add_action('wp_ajax_acf7_db_edit_scr_file_upload',$plugin_admin,'vsz_acf7_db_edit_scr_file_upload');
210
+
211
  // Edit Popup file delete
212
  $this->loader->add_action('wp_ajax_acf7_db_edit_scr_file_delete',$plugin_admin,'vsz_acf7_db_edit_scr_file_delete');
213
  }
220
  * @access private
221
  */
222
  private function define_public_hooks() {
223
+
224
  $plugin_public = new Advanced_Cf7_Db_Public( $this->get_plugin_name(), $this->get_version() );
225
 
226
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_public, 'enqueue_styles' );
227
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
228
+
229
  // Register shortcode
230
  $this->loader->add_action( 'after_setup_theme',$plugin_public,'vsz_acf7_db_register_shortcode' );
231