only gzip xml exported data when gz functions are available

This commit is contained in:
Andrew Dolgov 2011-12-28 11:03:24 +04:00
parent 8015933d2d
commit dddd80cf1b

View file

@ -20,9 +20,14 @@ class RPC extends Protected_Handler {
if (file_exists($exportname)) {
header("Content-type: text/xml");
header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml.gz");
echo gzencode(file_get_contents($exportname));
if (function_exists('gzencode')) {
header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml.gz");
echo gzencode(file_get_contents($exportname));
} else {
header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml");
echo file_get_contents($exportname);
}
} else {
echo "File not found.";
}