32 lines
924 B
PHP
32 lines
924 B
PHP
<?php
|
|
|
|
include __DIR__ . '/../../../config/settings.inc.php';
|
|
include __DIR__ . '/../../../config/config.inc.php';
|
|
include __DIR__ . '/../sensefuel.php';
|
|
|
|
// {DOMAIN}/module/sensefuel/download.php?language=(fr,es)[&conso_only=1]
|
|
|
|
if (Tools::getValue('language')) {
|
|
if (Tools::getValue('conso_only') && (int)Tools::getValue('conso_only') === 1) {
|
|
$type = SenseFuelFluxExport::SALE_TYPE_CONSO;
|
|
} else {
|
|
$type = SenseFuelFluxExport::SALE_TYPE_GLOBAL;
|
|
}
|
|
$language = Tools::getValue('language');
|
|
|
|
$file = SenseFuelFluxExport::getFilePath($language, $type);
|
|
|
|
if (file_exists($file)) {
|
|
$fp = fopen($file, 'rb');
|
|
header('Content-Type: text/xml');
|
|
header('Content-Disposition: attachment; filename=xml_data_' . $type . '_' .$language . '.xml');
|
|
header('Content-Length: ' . filesize($file));
|
|
fpassthru($fp);
|
|
} else {
|
|
echo 'false';
|
|
}
|
|
|
|
}
|
|
|
|
|