mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Add CSV Escaping to the Sample Export CSV Files
This commit is contained in:
@@ -995,6 +995,8 @@ if (isset($_GET['download_assets_csv_template'])) {
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
$delimiter = ",";
|
||||
$enclosure = '"';
|
||||
$escape = '\\';
|
||||
$filename = strtoAZaz09($client_name) . "-Assets-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
@@ -1002,7 +1004,7 @@ if (isset($_GET['download_assets_csv_template'])) {
|
||||
|
||||
//set column headers
|
||||
$fields = array('Name', 'Description', 'Type', 'Make', 'Model', 'Serial', 'OS', 'Purchase Date', 'Assigned To', 'Location', 'Physical Location', 'Notes');
|
||||
fputcsv($f, $fields, $delimiter);
|
||||
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
|
||||
|
||||
//move back to beginning of file
|
||||
fseek($f, 0);
|
||||
@@ -1619,6 +1621,8 @@ if (isset($_GET['download_client_asset_interfaces_csv_template'])) {
|
||||
$asset_name = $row['asset_name'];
|
||||
|
||||
$delimiter = ",";
|
||||
$enclosure = '"';
|
||||
$escape = '\\';
|
||||
$filename = strtoAZaz09($asset_name) . "-Asset-Interfaces-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
@@ -1626,7 +1630,7 @@ if (isset($_GET['download_client_asset_interfaces_csv_template'])) {
|
||||
|
||||
//set column headers
|
||||
$fields = array('Name', 'Description', 'Type', 'MAC', 'IP', 'NAT IP', 'IPv6', 'Network');
|
||||
fputcsv($f, $fields, $delimiter);
|
||||
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
|
||||
|
||||
//move back to beginning of file
|
||||
fseek($f, 0);
|
||||
|
||||
@@ -700,6 +700,8 @@ if (isset($_POST["import_clients_csv"])) {
|
||||
if (isset($_GET['download_clients_csv_template'])) {
|
||||
|
||||
$delimiter = ",";
|
||||
$enclosure = '"';
|
||||
$escape = '\\'; // backsla
|
||||
$filename = "Clients-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
@@ -707,7 +709,7 @@ if (isset($_GET['download_clients_csv_template'])) {
|
||||
|
||||
//set column headers
|
||||
$fields = array('Client Name', 'Industry', 'Referral', 'Website', 'Primary Location Name', 'Location Phone', 'Location Address', 'City', 'State', 'Postal Code', 'Country', 'Primary Contact Name', 'Title', 'Contact Phone', 'Extension', 'Contact Mobile', 'Contact Email', 'Hourly Rate', 'Currency', 'Payment Terms', 'Tax ID', 'Abbreviation');
|
||||
fputcsv($f, $fields, $delimiter);
|
||||
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
|
||||
|
||||
//move back to beginning of file
|
||||
fseek($f, 0);
|
||||
|
||||
@@ -1305,7 +1305,10 @@ if (isset($_POST["import_contacts_csv"])) {
|
||||
}
|
||||
|
||||
if (isset($_GET['download_contacts_csv_template'])) {
|
||||
|
||||
$delimiter = ",";
|
||||
$enclosure = '"';
|
||||
$escape = '\\';
|
||||
$filename = "Contacts-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
@@ -1322,7 +1325,7 @@ if (isset($_GET['download_contacts_csv_template'])) {
|
||||
'Mobile Phone ',
|
||||
'Office Location '
|
||||
);
|
||||
fputcsv($f, $fields, $delimiter);
|
||||
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
|
||||
|
||||
//move back to beginning of file
|
||||
fseek($f, 0);
|
||||
|
||||
@@ -456,6 +456,8 @@ if (isset($_POST["import_credentials_csv"])) {
|
||||
if (isset($_GET['download_credentials_csv_template'])) {
|
||||
|
||||
$delimiter = ",";
|
||||
$enclosure = '"';
|
||||
$escape = '\\';
|
||||
$filename = "Credentials-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
@@ -463,7 +465,7 @@ if (isset($_GET['download_credentials_csv_template'])) {
|
||||
|
||||
//set column headers
|
||||
$fields = array('Name', 'Description', 'Username', 'Password', 'TOTP', 'URI');
|
||||
fputcsv($f, $fields, $delimiter);
|
||||
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
|
||||
|
||||
//move back to beginning of file
|
||||
fseek($f, 0);
|
||||
|
||||
@@ -507,6 +507,8 @@ if (isset($_POST["import_locations_csv"])) {
|
||||
if(isset($_GET['download_locations_csv_template'])){
|
||||
|
||||
$delimiter = ",";
|
||||
$enclosure = '"';
|
||||
$escape = '\\';
|
||||
$filename = "Locations-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
@@ -514,7 +516,7 @@ if(isset($_GET['download_locations_csv_template'])){
|
||||
|
||||
//set column headers
|
||||
$fields = array('Name', 'Description', 'Address', 'City', 'State', 'Postal Code', 'Phone', 'Hours');
|
||||
fputcsv($f, $fields, $delimiter);
|
||||
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
|
||||
|
||||
//move back to beginning of file
|
||||
fseek($f, 0);
|
||||
|
||||
Reference in New Issue
Block a user