Révision b6513591
Ajouté par jim-p il y a plus de 9 ans
usr/local/www/diag_confbak.php | ||
---|---|---|
50 | 50 |
$changedescr = "(platform default)"; |
51 | 51 |
} |
52 | 52 |
write_config("Changed backup revision count to {$changedescr}"); |
53 |
} |
|
54 |
|
|
55 |
if($_GET['newver'] != "") { |
|
56 |
conf_mount_rw(); |
|
57 |
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); |
|
58 |
if(config_restore($g['conf_path'] . '/backup/config-' . $_GET['newver'] . '.xml') == 0) |
|
59 |
|
|
60 |
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['newver']), $confvers[$_GET['newver']]['description']); |
|
61 |
else |
|
62 |
$savemsg = gettext("Unable to revert to the selected configuration."); |
|
63 |
conf_mount_ro(); |
|
64 |
} |
|
53 |
} elseif ($_POST) { |
|
54 |
if (!isset($_POST['confirm']) || ($_POST['confirm'] != gettext("Confirm")) || (!isset($_POST['newver']) && !isset($_POST['rmver']))) { |
|
55 |
header("Location: diag_confbak.php"); |
|
56 |
return; |
|
57 |
} |
|
65 | 58 |
|
66 |
if($_GET['rmver'] != "") { |
|
67 | 59 |
conf_mount_rw(); |
68 | 60 |
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); |
69 |
unlink_if_exists($g['conf_path'] . '/backup/config-' . $_GET['rmver'] . '.xml'); |
|
70 |
$savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['rmver']),$confvers[$_GET['rmver']]['description']); |
|
61 |
if($_POST['newver'] != "") { |
|
62 |
if(config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0) |
|
63 |
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $confvers[$_POST['newver']]['description']); |
|
64 |
else |
|
65 |
$savemsg = gettext("Unable to revert to the selected configuration."); |
|
66 |
} |
|
67 |
if($_POST['rmver'] != "") { |
|
68 |
unlink_if_exists($g['conf_path'] . '/backup/config-' . $_POST['rmver'] . '.xml'); |
|
69 |
$savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']),$confvers[$_POST['rmver']]['description']); |
|
70 |
} |
|
71 | 71 |
conf_mount_ro(); |
72 | 72 |
} |
73 | 73 |
|
... | ... | |
158 | 158 |
<div id="mainarea"> |
159 | 159 |
<form action="diag_confbak.php" method="post"> |
160 | 160 |
<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont"> |
161 |
|
|
162 |
<?PHP if ($_GET["newver"] || $_GET["rmver"]): ?> |
|
163 |
<tr> |
|
164 |
<td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("Confirm Action"); ?></td> |
|
165 |
</tr> |
|
166 |
<tr> |
|
167 |
<td width="22%" valign="top" class="vncell"> </td> |
|
168 |
<td width="78%" class="vtable"> |
|
169 |
|
|
170 |
<strong><?PHP echo gettext("Please confirm the selected action"); ?></strong>: |
|
171 |
<br /> |
|
172 |
<br /><strong><?PHP echo gettext("Action"); ?>:</strong> |
|
173 |
<?PHP if (!empty($_GET["newver"])) { |
|
174 |
echo gettext("Restore from Configuration Backup"); |
|
175 |
$target_config = $_GET["newver"]; ?> |
|
176 |
<input type="hidden" name="newver" value="<?PHP echo htmlspecialchars($_GET["newver"]); ?>" /> |
|
177 |
<?PHP } elseif (!empty($_GET["rmver"])) { |
|
178 |
echo gettext("Remove Configuration Backup"); |
|
179 |
$target_config = $_GET["rmver"]; ?> |
|
180 |
<input type="hidden" name="rmver" value="<?PHP echo htmlspecialchars($_GET["rmver"]); ?>" /> |
|
181 |
<?PHP } ?> |
|
182 |
<br /><strong><?PHP echo gettext("Target Configuration"); ?>:</strong> |
|
183 |
<?PHP echo sprintf(gettext('Timestamp %1$s'), date(gettext("n/j/y H:i:s"), $target_config)); ?> |
|
184 |
<br /><input type="submit" name="confirm" value="<?PHP echo gettext("Confirm"); ?>" /> |
|
185 |
</td> |
|
186 |
</tr> |
|
187 |
<?PHP else: ?> |
|
188 |
|
|
161 | 189 |
<tr> |
162 | 190 |
<td width="10%"> </td> |
163 | 191 |
<td width="15%" valign="top"><?=gettext("Backup Count");?></td> |
... | ... | |
230 | 258 |
<td class="listr"> <?= format_bytes($version['filesize']) ?></td> |
231 | 259 |
<td class="listr"> <?= $version['description'] ?></td> |
232 | 260 |
<td valign="middle" class="list nowrap"> |
233 |
<a href="diag_confbak.php?newver=<?=$version['time'];?>" onclick="return confirm('<?=gettext("Revert to this configuration?");?>')">
|
|
261 |
<a href="diag_confbak.php?newver=<?=$version['time'];?>"> |
|
234 | 262 |
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="<?=gettext("Revert to this configuration");?>" title="<?=gettext("Revert to this configuration");?>" /> |
235 | 263 |
</a> |
236 |
<a href="diag_confbak.php?rmver=<?=$version['time'];?>" onclick="return confirm('<?=gettext("Delete this configuration backup?");?>')">
|
|
264 |
<a href="diag_confbak.php?rmver=<?=$version['time'];?>"> |
|
237 | 265 |
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="<?=gettext("Remove this backup");?>" title="<?=gettext("Remove this backup");?>" /> |
238 | 266 |
</a> |
239 | 267 |
<a href="diag_confbak.php?getcfg=<?=$version['time'];?>"> |
... | ... | |
253 | 281 |
</td> |
254 | 282 |
</tr> |
255 | 283 |
<?php endif; ?> |
284 |
<?php endif; ?> |
|
256 | 285 |
</table> |
257 | 286 |
</form> |
258 | 287 |
</div> |
Formats disponibles : Unified diff
Require click-through POST confirmation when restoring or deleting a configuation from the backup history page.