<?php
 include("_config/addCfg.php"); include("_includes/addInc.php"); $userTrailItem->updateActionOld('reportExportOk'); $userTrailItem->updateEntityOld('report', $R['idReport']); $idReport=$R['idReport']; $reportFieldsSQL="SELECT * FROM `$DBTReports` WHERE id='{$idReport}'"; $reportFields=$db->GetRow($reportFieldsSQL); if ($db->ErrorNo()) { writeLog("Could not get report content.", 'events', 10); } $alterSalt="= some stuff = REPORTS = !!! unique string !!!"; $reportKey=md5($alterSalt.$reportFields['name'].$reportFields['description'].$reportFields['format'].$reportFields['source'].$reportFields['columns'].$reportFields['filters'].$reportFields['customFilters'].$reportFields['customColumns'].$reportFields['columnsOrder'].$reportFields['sorting'].$reportFields['pivotTables'].$reportFields['summary']); $startXml='<?xml version="1.0" encoding="UTF-8"?><report></report>'; $report=simplexml_load_string($startXml); $report['key']=$reportKey; $report->name=$reportFields['name']; $report->description=$reportFields['description']; $report->fileNameTemplate=$reportFields['fileNameTemplate']; $report->format=$reportFields['format']; $report->extension=$reportFields['extension']; $report->style=$reportFields['style']; $report->source=$reportFields['source']; $report->columns=$reportFields['columns']; $report->filters=$reportFields['filters']; $report->customFilters=$reportFields['customFilters']; $report->customColumns=$reportFields['customColumns']; $report->columnsOrder=$reportFields['columnsOrder']; $report->sorting=$reportFields['sorting']; $report->pivotTables=$reportFields['pivotTables']; $report->summary=$reportFields['summary']; $reportContent=$report->asXML(); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=\"".\Engine\File::cleanName($reportFields['name']).".trt\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".strlen($reportContent)); echo $reportContent; exit; ?>