diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/poche/Tools.class.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 6da53023..63916582 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -226,4 +226,28 @@ class Tools | |||
226 | $lang = explode('.', $userlanguage); | 226 | $lang = explode('.', $userlanguage); |
227 | return str_replace('_', '-', $lang[0]); | 227 | return str_replace('_', '-', $lang[0]); |
228 | } | 228 | } |
229 | |||
230 | public static function status($status_code) | ||
231 | { | ||
232 | if (strpos(php_sapi_name(), 'apache') !== false) { | ||
233 | |||
234 | header('HTTP/1.0 '.$status_code); | ||
235 | } | ||
236 | else { | ||
237 | |||
238 | header('Status: '.$status_code); | ||
239 | } | ||
240 | } | ||
241 | |||
242 | |||
243 | public static function download_db() { | ||
244 | header('Content-Disposition: attachment; filename="poche.sqlite.gz"'); | ||
245 | self::status(200); | ||
246 | |||
247 | header('Content-Transfer-Encoding: binary'); | ||
248 | header('Content-Type: application/octet-stream'); | ||
249 | echo gzencode(file_get_contents(STORAGE_SQLITE)); | ||
250 | |||
251 | exit; | ||
252 | } | ||
229 | } | 253 | } |