From 80e99f7a1159770e2eb357ccc319a8bfe8f60942 Mon Sep 17 00:00:00 2001 From: football Date: Tue, 6 Apr 2021 22:08:58 +0200 Subject: [PATCH] Version 0.9.9 - Code cleaning --- xml/league.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/xml/league.php b/xml/league.php index bcd1c9e..2f7d00d 100644 --- a/xml/league.php +++ b/xml/league.php @@ -40,26 +40,37 @@ if (!defined('IN_PHPBB')) } $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.'); } if ($download) { - // Download header + // Download XML-File + $filename = 'league_' . $season . '_' . $league . '.xml'; + $fp = fopen('php://output', 'w'); + header('Pragma: no-cache'); - header('Content-Type: application/xml name=\"league_' . $season . '_' . $league . '.xml'); - header('Content-disposition: attachment; filename=league_' . $season . '_' . $league . '.xml'); + header("Content-Type: application/xml name=\"" . basename($filename) . "\""); + 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 { // XML header header ("content-type: text/xml"); + echo $xml_string; } - echo $string; } function xml_data($season, $league)