diff --git a/modules/Vtiger/actions/ExportData.php b/modules/Vtiger/actions/ExportData.php index 503804793b0a3b09ec5ca3c3d3e452de5ff868c4..ef3a7fc8382143d57b20130788e6162ecaf8f391 100644 --- a/modules/Vtiger/actions/ExportData.php +++ b/modules/Vtiger/actions/ExportData.php @@ -251,22 +251,12 @@ class Vtiger_ExportData_Action extends Vtiger_Mass_Action { header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); header("Cache-Control: post-check=0, pre-check=0", false ); - $header = implode("\", \"", $headers); - $header = "\"" .$header; - $header .= "\"\r\n"; - echo $header; + ob_clean(); + $fp = fopen("php://output", "a+"); + fputcsv($fp, $headers); foreach($entries as $row) { - foreach ($row as $key => $value) { - /* To support double quotations in CSV format - * To review: http://creativyst.com/Doc/Articles/CSV/CSV01.htm#EmbedBRs - */ - $row[$key] = str_replace('"', '""', $value); - } - $line = implode("\",\"",$row); - $line = "\"" .$line; - $line .= "\"\r\n"; - echo $line; + fputcsv($fp, $row); } } @@ -382,4 +372,4 @@ class Vtiger_ExportData_Action extends Vtiger_Mass_Action { public function moduleFieldInstances($moduleName) { return $this->moduleInstance->getFields(); } -} \ No newline at end of file +}