PluginProbe
Smart Forms – when you need more than just a contact form / trunk
Smart Forms – when you need more than just a contact form vtrunk
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / smart-forms-export-form.php

smart-forms-export-form.php in Smart Forms – when you need more than just a contact form trunk, at smart-forms-export-form.php

29 lines 701 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) {
4 die('Forbidden');
5 }
6 if(!defined('ABSPATH'))
7 die('Forbidden');
8
9 if(!current_user_can('manage_options'))
10 die('Forbidden');
11 $formId='';
12
13 if(isset($_GET['formId']))
14 $formId=intval($_GET["formId"]);
15
16
17 global $wpdb;
18
19 $result=$wpdb->get_results($wpdb->prepare("SELECT * FROM ".SMART_FORMS_TABLE_NAME.' where form_id=%d',$formId),"ARRAY_A");
20 if(count($result)==0)
21 return;
22
23 header('Content-Encoding: UTF-8');
24 header('Content-type: text/csv; charset=UTF-8');
25 header('Content-Disposition: attachment; filename='.$result[0]['form_name'].'.export');
26 echo json_encode($result[0]);
27
28
29