= 0)) { $config['system']['backupcount'] = $_POST['backupcount']; $changedescr = $config['system']['backupcount']; } else { unset($config['system']['backupcount']); $changedescr = "(platform default)"; } write_config("Changed backup revision count to {$changedescr}"); } elseif ($_GET) { if (!isset($_GET['newver']) && !isset($_GET['rmver']) && !isset($_GET['getcfg']) && !isset($_GET['diff'])) { header("Location: diag_confbak.php"); return; } conf_mount_rw(); $confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); if ($_GET['newver'] != "") { if (config_restore($g['conf_path'] . '/backup/config-' . $_GET['newver'] . '.xml') == 0) { $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['newver']), htmlspecialchars($confvers[$_GET['newver']]['description'])); } else { $savemsg = gettext("Unable to revert to the selected configuration."); } } if ($_GET['rmver'] != "") { unlink_if_exists($g['conf_path'] . '/backup/config-' . $_GET['rmver'] . '.xml'); $savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['rmver']), htmlspecialchars($confvers[$_GET['rmver']]['description'])); } conf_mount_ro(); } if ($_GET['getcfg'] != "") { $file = $g['conf_path'] . '/backup/config-' . $_GET['getcfg'] . '.xml'; $exp_name = urlencode("config-{$config['system']['hostname']}.{$config['system']['domain']}-{$_GET['getcfg']}.xml"); $exp_data = file_get_contents($file); $exp_size = strlen($exp_data); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename={$exp_name}"); header("Content-Length: $exp_size"); echo $exp_data; exit; } if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime']) && (is_numeric($_GET['oldtime'])) && (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) { $diff = ""; $oldfile = $g['conf_path'] . '/backup/config-' . $_GET['oldtime'] . '.xml'; $oldtime = $_GET['oldtime']; if ($_GET['newtime'] == 'current') { $newfile = $g['conf_path'] . '/config.xml'; $newtime = $config['revision']['time']; } else { $newfile = $g['conf_path'] . '/backup/config-' . $_GET['newtime'] . '.xml'; $newtime = $_GET['newtime']; } if (file_exists($oldfile) && file_exists($newfile)) { exec("/usr/bin/diff -u " . escapeshellarg($oldfile) . " " . escapeshellarg($newfile), $diff); } } cleanup_backupcache(false); $confvers = get_backups(); unset($confvers['versions']); $pgtitle = array(gettext("Diagnostics"), gettext("Configuration History")); include("head.inc"); if ($savemsg) { print_info_box($savemsg, 'success'); } if ($diff) { ?>
=htmlentities($line)?> |