aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/poche/Tools.class.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 750553f1..9d8e1fd6 100644
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -249,4 +249,28 @@ class Tools
249 $lang = explode('.', $userlanguage); 249 $lang = explode('.', $userlanguage);
250 return str_replace('_', '-', $lang[0]); 250 return str_replace('_', '-', $lang[0]);
251 } 251 }
252
253 public static function status($status_code)
254 {
255 if (strpos(php_sapi_name(), 'apache') !== false) {
256
257 header('HTTP/1.0 '.$status_code);
258 }
259 else {
260
261 header('Status: '.$status_code);
262 }
263 }
264
265
266 public static function download_db() {
267 header('Content-Disposition: attachment; filename="poche.sqlite.gz"');
268 self::status(200);
269
270 header('Content-Transfer-Encoding: binary');
271 header('Content-Type: application/octet-stream');
272 echo gzencode(file_get_contents(STORAGE_SQLITE));
273
274 exit;
275 }
252} 276}