Commit 971c7831 authored by Franco Fichtner's avatar Franco Fichtner

config manager: fix history in translation mode

parent 2d1f2af5
......@@ -30,11 +30,9 @@
require_once("guiconfig.inc");
// list backups
$cnf = OPNsense\Core\Config::getInstance();
$confvers = $cnf->getBackups(true);
if (isset($_POST['backupcount'])) {
if (is_numeric($_POST['backupcount']) && ($_POST['backupcount'] >= 0)) {
$config['system']['backupcount'] = $_POST['backupcount'];
......@@ -42,39 +40,37 @@ if (isset($_POST['backupcount'])) {
unset($config['system']['backupcount']);
}
write_config('Changed backup revision count');
} elseif ($_POST) {
if (!isset($_POST['confirm']) || ($_POST['confirm'] != "Confirm") || (!isset($_POST['newver']) && !isset($_POST['rmver']))) {
header("Location: diag_confbak.php");
return;
}
if($_POST['newver'] != "") {
// search item by revision
foreach ($confvers as $filename => $revision) {
if (isset($revision['time']) && $revision['time'] == $_POST['newver']) {
if(config_restore($filename)== 0) {
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $revision['description']);
} else {
$savemsg = gettext("Unable to revert to the selected configuration.");
}
break;
} elseif (isset($_POST['newver']) && $_POST['newver'] != '') {
foreach ($confvers as $filename => $revision) {
if (isset($revision['time']) && $revision['time'] == $_POST['newver']) {
if (config_restore($filename)== 0) {
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $revision['description']);
} else {
$savemsg = gettext("Unable to revert to the selected configuration.");
}
break;
}
}
if($_POST['rmver'] != "") {
// search item by revision
foreach ($confvers as $filename => $revision) {
if (isset($revision['time']) && $revision['time'] == $_POST['rmver']) {
} elseif (isset($_POST['rmver']) && $_POST['rmver'] != '') {
foreach ($confvers as $filename => $revision) {
if (isset($revision['time']) && $revision['time'] == $_POST['rmver']) {
if (file_exists($filename)) {
@unlink($filename);
$savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']),$revision['description']);
break;
} else {
$savemsg = gettext("Unable to delete the selected configuration.");
}
break;
}
}
}
if($_GET['getcfg'] != "") {
if (isset($_POST)) {
/* things might have changed */
$confvers = $cnf->getBackups(true);
}
if (isset($_GET['getcfg']) && $_GET['getcfg'] != '') {
foreach ($confvers as $filename => $revision) {
if ($revision['time'] == $_GET['getcfg']) {
$exp_name = urlencode("config-{$config['system']['hostname']}.{$config['system']['domain']}-{$_GET['getcfg']}.xml");
......@@ -267,7 +263,7 @@ include("head.inc");
<div class="container-fluid __mb">
<button type="submit" name="diff" class="btn btn-primary pull-left" style="margin-right: 8px;" value="Diff"><?=gettext('View differences');?></button>
<?= gettext("To view the differences between an older configuration and a newer configuration, select the older configuration using the left column of radio options and select the newer configuration in the right column, then press the Diff button."); ?>
<?= gettext("To view the differences between an older configuration and a newer configuration, select the older configuration using the left column of radio options and select the newer configuration in the right column, then press the button."); ?>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment