From 7b435722b9b2fa28fbbd6cfd5901eaf1e92cdc4f Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Wed, 2 Dec 2009 16:36:02 +0000 Subject: [PATCH] Fixed view/download backup --- CHANGELOG.txt | 4 +++- admin/backups.php | 31 ++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 69719485..5ddc1061 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -30,6 +30,8 @@ $ /includes/errors.inc # Display settings are restored in every login in demo mode. $ /admin/display_prefs.php /includes/current_user.inc +# Fixed view/download backup +$ /admin/backups.php 02-Dec-2009 Joe Hunt ! Release 2.2.1 @@ -38,7 +40,7 @@ $ config.default.php /lang/en_US/LC_MESSAGES/en_US.mo # More restrictions on deleting gl_accounts $ /gl/manage/gl_accounts.php -! Changed 'delete' to 'delete2' in backups.php to better satisfy IE8 (Yes!) +! Changed 'delete' to 'deldump' in backups.php to better satisfy IE8 (Yes!) $ /admin/backups.php 01-Dec-2009 Janusz Dobrowolski diff --git a/admin/backups.php b/admin/backups.php index 93ef6dfc..a70a2846 100644 --- a/admin/backups.php +++ b/admin/backups.php @@ -17,7 +17,7 @@ include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/admin/db/maintenance_db.inc"); if (get_post('view')) { - $filename = BACKUP_PATH . get_post('cmb_backups'); + $filename = BACKUP_PATH . get_post('backups'); if (in_ajax()) $Ajax->popup( $filename ); else { @@ -30,7 +30,7 @@ if (get_post('view')) { }; if (get_post('download')) { - download_file(BACKUP_PATH . get_post('cmb_backups')); + download_file(BACKUP_PATH . get_post('backups')); exit; } @@ -67,7 +67,7 @@ function get_backup_file_combo() global $path_to_root, $Ajax; $ar_files = array(); - default_focus('cmb_backups'); + default_focus('backups'); $dh = opendir(BACKUP_PATH); while (($file = readdir($dh)) !== false) $ar_files[] = $file; @@ -79,10 +79,10 @@ function get_backup_file_combo() if (preg_match("/.sql(.zip|.gz)?$/", $file)) $opt_files .= ""; - $selector = ""; + $selector = ""; - $Ajax->addUpdate('cmd_backups', "_cmd_backups_sel", $selector); - $selector = "".$selector."\n"; + $Ajax->addUpdate('backups', "_backups_sel", $selector); + $selector = "".$selector."\n"; return $selector; } @@ -121,19 +121,19 @@ $conn = $db_connections[$db_name]; if (get_post('creat')) { generate_backup($conn, get_post('comp'), get_post('comments')); - $Ajax->activate('cmd_backups'); + $Ajax->activate('backups'); }; if (get_post('restore')) { - if (db_import(BACKUP_PATH . get_post('cmb_backups'), $conn)) + if (db_import(BACKUP_PATH . get_post('backups'), $conn)) display_notification(_("Restore backup completed.")); } -if (get_post('delete2')) { - if (unlink(BACKUP_PATH . get_post('cmb_backups'))) { +if (get_post('deldump')) { + if (unlink(BACKUP_PATH . get_post('backups'))) { display_notification(_("File successfully deleted.")." " - . _("Filename") . ": " . get_post('cmb_backups')); - $Ajax->activate('cmd_backups'); + . _("Filename") . ": " . get_post('backups')); + $Ajax->activate('backups'); } else display_error(_("Can't delete backup file.")); @@ -149,7 +149,7 @@ if (get_post('upload')) elseif (is_uploaded_file($tmpname)) { rename($tmpname, BACKUP_PATH . $fname); display_notification( "File uploaded to backup directory"); - $Ajax->activate('cmd_backups'); + $Ajax->activate('backups'); } else display_error(_("File was not uploaded into the system.")); } @@ -174,8 +174,9 @@ table_section_title(_("Backup scripts maintenance")); 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?")); - submit_row('delete2', _("Delete Backup"), false, '','', true); - submit_js_confirm('delete2', sprintf(_("You are about to remove selected backup file.\nDo you want to continue ?"))); + submit_row('deldump', _("Delete Backup"), false, '','', true); + // don't use 'delete' name or IE js errors appear + submit_js_confirm('deldump', sprintf(_("You are about to remove selected backup file.\nDo you want to continue ?"))); end_table(); echo ""; end_row(); -- 2.30.2