1 |
1d2d6b3c
|
Colin Smith
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
359893b0
|
Colin Smith
|
diag_confbak.php
|
5 |
|
|
Copyright (C) 2005 Colin Smith
|
6 |
1d2d6b3c
|
Colin Smith
|
All rights reserved.
|
7 |
|
|
|
8 |
|
|
Redistribution and use in source and binary forms, with or without
|
9 |
|
|
modification, are permitted provided that the following conditions are met:
|
10 |
|
|
|
11 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
this list of conditions and the following disclaimer.
|
13 |
|
|
|
14 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
15 |
|
|
notice, this list of conditions and the following disclaimer in the
|
16 |
|
|
documentation and/or other materials provided with the distribution.
|
17 |
|
|
|
18 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
359893b0
|
Colin Smith
|
require("guiconfig.inc");
|
31 |
2f8d0729
|
Bill Marquette
|
|
32 |
359893b0
|
Colin Smith
|
if($_GET['newver'] != "") {
|
33 |
1d478d96
|
Colin Smith
|
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
|
34 |
359893b0
|
Colin Smith
|
if(config_restore($g['conf_path'] . '/backup/config-' . $_GET['newver'] . '.xml') == 0) {
|
35 |
cdc0ed31
|
Colin Smith
|
$savemsg = "Successfully reverted to timestamp " . date("n/j/y H:i:s", $_GET['newver']) . " with description \"" . $confvers[$_GET['newver']]['description'] . "\".";
|
36 |
359893b0
|
Colin Smith
|
} else {
|
37 |
cdc0ed31
|
Colin Smith
|
$savemsg = "Unable to revert to the selected configuration.";
|
38 |
359893b0
|
Colin Smith
|
}
|
39 |
|
|
}
|
40 |
2f8d0729
|
Bill Marquette
|
|
41 |
359893b0
|
Colin Smith
|
if($_GET['rmver'] != "") {
|
42 |
1d478d96
|
Colin Smith
|
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
|
43 |
359893b0
|
Colin Smith
|
unlink_if_exists($g['conf_path'] . '/backup/config-' . $_GET['rmver'] . '.xml');
|
44 |
cdc0ed31
|
Colin Smith
|
$savemsg = "Deleted backup with timestamp " . date("n/j/y H:i:s", $_GET['rmver']) . " and description \"" . $confvers[$_GET['rmver']]['description'] . "\".";
|
45 |
2f8d0729
|
Bill Marquette
|
}
|
46 |
|
|
|
47 |
359893b0
|
Colin Smith
|
cleanup_backupcache();
|
48 |
|
|
$confvers = get_backups();
|
49 |
|
|
unset($confvers['versions']);
|
50 |
1d2d6b3c
|
Colin Smith
|
|
51 |
310b2c06
|
Bill Marquette
|
$pgtitle = "Diagnostics: Configuration History";
|
52 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
53 |
|
|
|
54 |
1d2d6b3c
|
Colin Smith
|
?>
|
55 |
|
|
|
56 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
57 |
2e2d1de7
|
Bill Marquette
|
<?php include("fbegin.inc"); ?>
|
58 |
310b2c06
|
Bill Marquette
|
<p class="pgtitle"><?=$pgtitle?></p>
|
59 |
2e2d1de7
|
Bill Marquette
|
<?php if($savemsg) print_info_box($savemsg); ?>
|
60 |
1d2d6b3c
|
Colin Smith
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td>
|
61 |
12af52d9
|
Scott Ullrich
|
<?php
|
62 |
|
|
$tab_array = array();
|
63 |
17912fda
|
Chris Buechler
|
$tab_array[0] = array("Config History", true, "diag_confbak.php");
|
64 |
|
|
$tab_array[1] = array("Backup/Restore", false, "diag_backup.php");
|
65 |
12af52d9
|
Scott Ullrich
|
display_top_tabs($tab_array);
|
66 |
|
|
?>
|
67 |
1d2d6b3c
|
Colin Smith
|
</td></tr>
|
68 |
|
|
<tr>
|
69 |
0f10aee4
|
Bill Marquette
|
<td>
|
70 |
|
|
<div id="mainarea">
|
71 |
|
|
<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
|
72 |
359893b0
|
Colin Smith
|
<?php
|
73 |
|
|
if(is_array($confvers)) {
|
74 |
|
|
?>
|
75 |
1d2d6b3c
|
Colin Smith
|
<tr>
|
76 |
|
|
<td width="30%" class="listhdrr">Date</td>
|
77 |
|
|
<td width="70%" class="listhdrr">Configuration Change</td>
|
78 |
|
|
</tr>
|
79 |
|
|
|
80 |
2e2d1de7
|
Bill Marquette
|
<tr valign="top">
|
81 |
|
|
<td class="listlr"> <?= date("n/j/y H:i:s", $config['revision']['time']) ?></td>
|
82 |
|
|
<td class="listlr"> <?= $config['revision']['description'] ?></td>
|
83 |
dcf9eb16
|
Bill Marquette
|
<td colspan="2" valign="middle" class="list" nowrap><b>Current</b></td>
|
84 |
2e2d1de7
|
Bill Marquette
|
</tr>
|
85 |
1d2d6b3c
|
Colin Smith
|
<?php
|
86 |
|
|
foreach($confvers as $version) {
|
87 |
359893b0
|
Colin Smith
|
if($version['time'] != 0) {
|
88 |
25540c7c
|
Colin Smith
|
$date = date("n/j/y H:i:s", $version['time']);
|
89 |
359893b0
|
Colin Smith
|
} else {
|
90 |
|
|
$date = "Unknown";
|
91 |
1d2d6b3c
|
Colin Smith
|
}
|
92 |
359893b0
|
Colin Smith
|
$desc = $version['description'];
|
93 |
1d2d6b3c
|
Colin Smith
|
?>
|
94 |
|
|
<tr valign="top">
|
95 |
359893b0
|
Colin Smith
|
<td class="listlr"> <?= $date ?></td>
|
96 |
|
|
<td class="listlr"> <?= $desc ?></td>
|
97 |
1d2d6b3c
|
Colin Smith
|
<td valign="middle" class="list" nowrap>
|
98 |
afe4bc36
|
Holger Bauer
|
<a href="diag_confbak.php?newver=<?=$version['time'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
|
99 |
1d2d6b3c
|
Colin Smith
|
</td>
|
100 |
359893b0
|
Colin Smith
|
<td valign="middle" class="list" nowrap>
|
101 |
afe4bc36
|
Holger Bauer
|
<a href="diag_confbak.php?rmver=<?=$version['time'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a>
|
102 |
1d2d6b3c
|
Colin Smith
|
</tr>
|
103 |
|
|
<?php
|
104 |
|
|
} ?>
|
105 |
cdb0814b
|
Scott Ullrich
|
<?php } else { ?>
|
106 |
|
|
<tr><td>
|
107 |
|
|
<?php print_info_box("No backups found."); ?>
|
108 |
|
|
</td></tr>
|
109 |
|
|
<?php }
|
110 |
359893b0
|
Colin Smith
|
?>
|
111 |
0f10aee4
|
Bill Marquette
|
</table>
|
112 |
|
|
</div>
|
113 |
1d2d6b3c
|
Colin Smith
|
</td>
|
114 |
|
|
</tr>
|
115 |
|
|
</table>
|
116 |
cdb0814b
|
Scott Ullrich
|
</form>
|
117 |
359893b0
|
Colin Smith
|
<?php include("fend.inc"); ?>
|
118 |
12af52d9
|
Scott Ullrich
|
</body>
|
119 |
310b2c06
|
Bill Marquette
|
</html>
|