diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a118b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +/logs/* +/config.php diff --git a/app/controllers/db.php b/app/controllers/db.php index 46b90ea..366d56b 100644 --- a/app/controllers/db.php +++ b/app/controllers/db.php @@ -237,8 +237,8 @@ public function doDbExport() { if (x("gzip")) { ob_end_clean(); header("Content-type: application/x-gzip"); - header("Content-Disposition: attachment; filename=\"{$prefix}.gz\""); - echo gzcompress($this->contents, 9); + header("Content-Disposition: attachment; filename=\"{$prefix}.js.gz\""); + echo gzencode($this->contents, 9); exit(); } else { @@ -264,12 +264,9 @@ public function doDbImport() { $tmp = $_FILES["json"]["tmp_name"]; //read file by it's format - $body = ""; - if (preg_match("/\\.gz$/", $_FILES["json"]["name"])) { - $body = gzuncompress(file_get_contents($tmp)); - } - else { - $body = file_get_contents($tmp); + $body = file_get_contents($tmp); + if (preg_match("/\\.js\\.gz$/", $_FILES["json"]["name"])) { + $body = gzdecode($body); } //check format diff --git a/app/funcs/functions.php b/app/funcs/functions.php index 7a6c269..2c896f5 100644 --- a/app/funcs/functions.php +++ b/app/funcs/functions.php @@ -280,4 +280,12 @@ function r_get_collection_icon($collectionName) { return "table"; } +// PHP < 5.4 +if (!function_exists('gzdecode')) { + // http://php.net/manual/ru/function.gzdecode.php#106397 + function gzdecode($data) { + return gzinflate(substr($data,10,-8)); + } +} + ?> \ No newline at end of file diff --git a/config.php b/config.php deleted file mode 100644 index 5dd3a9f..0000000 --- a/config.php +++ /dev/null @@ -1,55 +0,0 @@ - \ No newline at end of file