Spurious chars corrupting CSV download:

- factorized in WebPage as TrashUnexpectedOutput()
- added early tracking and reporting into MetaModel::IncludeModule, use the new config flag 'debug_track_spurious_chars' to blame the harmful module/file.
- protected export.php
- removed a space at the beginning of page 'createfrommail.php'

SVN:trunk[2260]
This commit is contained in:
Romain Quetiez
2012-10-16 13:06:50 +00:00
parent 6039ea47fc
commit b304307ad7
6 changed files with 50 additions and 14 deletions

View File

@@ -828,11 +828,8 @@ try
if ($oMenu instanceof DashboardMenuNode)
{
$oDashboard = $oMenu->GetDashboard();
$sPreviousContent = ob_get_clean();
if (trim($sPreviousContent) != '')
{
IssueLog::Error("Output already started before downloading file:\nContent was:'$sPreviousContent'\n");
}
$oPage->TrashUnexpectedOutput();
$oPage->SetContentType('text/xml');
$oPage->SetContentDisposition('attachment', $oMenu->GetLabel().'.xml');
$oPage->add($oDashboard->ToXml());
@@ -907,12 +904,7 @@ function DownloadDocument(WebPage $oPage, $sClass, $id, $sAttCode, $sContentDisp
$oDocument = $oObj->Get($sAttCode);
if (is_object($oDocument))
{
// Make sure there is NO output at all before our content, otherwise the document will be corrupted
$sPreviousContent = ob_get_clean();
if (trim($sPreviousContent) != '')
{
IssueLog::Error("Output already started before downloading file:\nContent was:'$sPreviousContent'\n");
}
$oPage->TrashUnexpectedOutput();
$oPage->SetContentType($oDocument->GetMimeType());
$oPage->SetContentDisposition($sContentDisposition,$oDocument->GetFileName());
$oPage->add($oDocument->GetData());
@@ -923,4 +915,4 @@ function DownloadDocument(WebPage $oPage, $sClass, $id, $sAttCode, $sContentDisp
$oPage->p($e->getMessage());
}
}
?>
?>