$lang = explode('.', $userlanguage);
return str_replace('_', '-', $lang[0]);
}
+
+ public static function status($status_code)
+ {
+ if (strpos(php_sapi_name(), 'apache') !== false) {
+
+ header('HTTP/1.0 '.$status_code);
+ }
+ else {
+
+ header('Status: '.$status_code);
+ }
+ }
+
+
+ public static function download_db() {
+ header('Content-Disposition: attachment; filename="poche.sqlite.gz"');
+ self::status(200);
+
+ header('Content-Transfer-Encoding: binary');
+ header('Content-Type: application/octet-stream');
+ echo gzencode(file_get_contents(STORAGE_SQLITE));
+
+ exit;
+ }
}
$poche->updatePassword();
} elseif (isset($_GET['import'])) {
$import = $poche->import($_GET['from']);
+} elseif (isset($_GET['download'])) {
+ Tools::download_db();;
} elseif (isset($_GET['export'])) {
$poche->export();
} elseif (isset($_GET['updatetheme'])) {
</ul>
<h2>{% trans "Export your poche datas" %}</h2>
+ {% if constant('STORAGE') == 'sqlite' %}
+ <p><a href="?download" target="_blank">{% trans "Click here" %}</a> {% trans "to download your database." %}</p>{% endif %}
<p><a href="?export" target="_blank">{% trans "Click here" %}</a> {% trans "to export your poche datas." %}</p>
{% endblock %}