Version 0.9.9

- Code cleaning
This commit is contained in:
football
2021-04-06 22:08:58 +02:00
parent 7ab5247437
commit 80e99f7a11

View File

@@ -40,26 +40,37 @@ if (!defined('IN_PHPBB'))
} }
$download = $request->variable('d', false); $download = $request->variable('d', false);
$string = xml_data($season, $league); $xml_string = xml_data($season, $league);
if ( $string == '') if ( $xml_string == '')
{ {
trigger_error('Fehler! Die XML-Datei konnte nicht erzeugt werden.'); trigger_error('Fehler! Die XML-Datei konnte nicht erzeugt werden.');
} }
if ($download) if ($download)
{ {
// Download header // Download XML-File
$filename = 'league_' . $season . '_' . $league . '.xml';
$fp = fopen('php://output', 'w');
header('Pragma: no-cache'); header('Pragma: no-cache');
header('Content-Type: application/xml name=\"league_' . $season . '_' . $league . '.xml'); header("Content-Type: application/xml name=\"" . basename($filename) . "\"");
header('Content-disposition: attachment; filename=league_' . $season . '_' . $league . '.xml'); header("Content-disposition: attachment; filename=\"" . basename($filename) . "\"");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Pragma: public');
fwrite($fp, $xml_string);
fclose($fp);
exit_handler();
} }
else else
{ {
// XML header // XML header
header ("content-type: text/xml"); header ("content-type: text/xml");
echo $xml_string;
} }
echo $string;
} }
function xml_data($season, $league) function xml_data($season, $league)