diff options
author | Andrew Dolgov <[email protected]> | 2011-12-28 11:01:16 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2011-12-28 11:01:16 +0400 |
commit | 8015933d2d4be28ccd42f1acb4178067ec328d88 (patch) | |
tree | 594986a50c030e1ad6d9d47273fab36e9b21a927 | |
parent | 051195eccd783b6a2fa9e02c6829ce4087dc4774 (diff) | |
parent | 3382bce16dd885d4f2894c18c2d4c82438be1dcc (diff) |
Merge branch 'master' of github.com:gothfox/Tiny-Tiny-RSS
-rw-r--r-- | include/functions.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/functions.php b/include/functions.php index 018e518eb..1b780d955 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5116,13 +5116,35 @@ return $rv; } + if (!function_exists('gzdecode')) { + function gzdecode($string) { // no support for 2nd argument + return file_get_contents('compress.zlib://data:who/cares;base64,'. + base64_encode($string)); + } + } + function perform_data_import($link, $filename, $owner_uid) { $num_imported = 0; $num_processed = 0; $num_feeds_created = 0; - $doc = DOMDocument::load($filename); + $doc = @DOMDocument::load($filename); + + if (!$doc) { + $contents = file_get_contents($filename); + + if ($contents) { + $data = @gzuncompress($contents); + } + + if (!$data) { + $data = @gzdecode($contents); + } + + if ($data) + $doc = DOMDocument::loadXML($data); + } if ($doc) { |