Backups/Restore: fixed compressed backup view, fixed obsolete ajax indicator during...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 1 Dec 2017 19:53:46 +0000 (20:53 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 1 Dec 2017 19:55:40 +0000 (20:55 +0100)
admin/backups.php
includes/ui/ui_input.inc
js/inserts.js

index e4364def3b5537bd5ed4d3862e84c31a62fc11e3..102deb55a187b2f2cb1421893921d10285aac01e 100644 (file)
@@ -24,14 +24,21 @@ if (get_post('view')) {
                if (in_ajax()) 
                        $Ajax->popup( $filename );
                else {
-                   header('Content-type: text/plain');
-               header('Content-Length: '.filesize($filename));
+                       header('Content-type: text/plain');
+                       header('Content-Length: '.filesize($filename));
                        header("Content-Disposition: inline; filename=".basename($filename));
-               readfile($filename);
+                       if (substr($filename, -3, 3) == '.gz')
+                               header("Content-Encoding: gzip");
+
+                       if (substr($filename, -4, 4) == '.zip')
+                               echo db_unzip('', $filename);
+                       else
+                               readfile($filename);
                        exit();
                }
        }
 };
+
 if (get_post('download')) {
        if (get_post('backups')) {
                download_file($SysPrefs->backup_dir().clean_file_name(get_post('backups')));
@@ -180,7 +187,7 @@ if (get_post('upload'))
 
 }
 //-------------------------------------------------------------------------------
-start_form(true, true);
+start_form(false, true);
 start_outer_table(TABLESTYLE2);
 table_section(1);
 table_section_title(_("Create backup"));
@@ -196,7 +203,7 @@ table_section_title(_("Backup scripts maintenance"));
        echo "<td style='padding-left:20px' valign='top'>";
        start_table();
        submit_row('view',_("View Backup"), false, '', '', false);
-       submit_row('download',_("Download Backup"), false, '', '', false);
+       submit_row('download',_("Download Backup"), false, '', '', 'download');
        submit_row('restore',_("Restore Backup"), false, '','', 'process');
        submit_js_confirm('restore',_("You are about to restore database from backup file.\nDo you want to continue?"));
 
index 054af15e98ee463c3587ab87b11e4908de4089f1..d2854d865b6e4d01fd684f756b5472b38b2e7829 100644 (file)
@@ -159,6 +159,7 @@ function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=fal
                                        if ($icon===false) $icon=ICON_ESCAPE; break;
 
                                case 'nonajax':
+                               case 'download':
                                        $atype = false;
                        }
                }
index ccc8024c2d2ca1158dfdfb620c9bb02b18c7ae63..17b71143b60187ac01455c2be1c0031b1f69d255 100644 (file)
@@ -314,7 +314,8 @@ var inserts = {
                e.onclick = function(){
                        if (validate(e)) {
                                setTimeout(function() { var asp = e.getAttribute('aspect');
-                                       set_mark((asp && ((asp.indexOf('process') !== -1) || (asp.indexOf('nonajax') !== -1))) ? 'progressbar.gif' : 'ajax-loader.gif');
+                                       if (asp && asp.indexOf('download') === -1)
+                                               set_mark((asp && ((asp.indexOf('process') !== -1) || (asp.indexOf('nonajax') !== -1))) ? 'progressbar.gif' : 'ajax-loader.gif');
                                }, 100);
                                return true;
                        }