Project

General

Profile

Download (4.64 KB) Statistics
| Branch: | Tag: | Revision:
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 6b07c15a Matthew Grooms
##|+PRIV
31
##|*IDENT=page-diagnostics-configurationhistory
32
##|*NAME=Diagnostics: Configuration History page
33
##|*DESCR=Allow access to the 'Diagnostics: Configuration History' page.
34
##|*MATCH=diag_confbak.php*
35
##|-PRIV
36
37
38 359893b0 Colin Smith
require("guiconfig.inc");
39 2f8d0729 Bill Marquette
40 359893b0 Colin Smith
if($_GET['newver'] != "") {
41 1d478d96 Colin Smith
	$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
42 486b4999 Matthew Grooms
	if(config_restore($g['conf_path'] . '/backup/config-' . $_GET['newver'] . '.xml') == 0)
43 cdc0ed31 Colin Smith
		$savemsg = "Successfully reverted to timestamp " . date("n/j/y H:i:s", $_GET['newver']) . " with description \"" . $confvers[$_GET['newver']]['description'] . "\".";
44 486b4999 Matthew Grooms
	else
45 cdc0ed31 Colin Smith
		$savemsg = "Unable to revert to the selected configuration.";
46 359893b0 Colin Smith
}
47 2f8d0729 Bill Marquette
48 359893b0 Colin Smith
if($_GET['rmver'] != "") {
49 1d478d96 Colin Smith
	$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
50 359893b0 Colin Smith
	unlink_if_exists($g['conf_path'] . '/backup/config-' . $_GET['rmver'] . '.xml');
51 cdc0ed31 Colin Smith
	$savemsg = "Deleted backup with timestamp " . date("n/j/y H:i:s", $_GET['rmver']) . " and description \"" . $confvers[$_GET['rmver']]['description'] . "\".";
52 2f8d0729 Bill Marquette
}
53
54 359893b0 Colin Smith
cleanup_backupcache();
55
$confvers = get_backups();
56
unset($confvers['versions']);
57 1d2d6b3c Colin Smith
58 d88c6a9f Scott Ullrich
$pgtitle = array("Diagnostics","Configuration History");
59 b63695db Scott Ullrich
include("head.inc");
60
61 1d2d6b3c Colin Smith
?>
62
63
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
64 486b4999 Matthew Grooms
	<?php
65
		include("fbegin.inc");
66
		if($savemsg)
67
			print_info_box($savemsg);
68
	?>
69
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
70
		<tr>
71
			<td>
72
			<?php
73
				$tab_array = array();
74
				$tab_array[0] = array("Config History", true, "diag_confbak.php");
75
				$tab_array[1] = array("Backup/Restore", false, "diag_backup.php");
76
				display_top_tabs($tab_array);
77
			?>			
78
			</td>
79
		</tr>
80
		<tr>
81
			<td>
82
				<div id="mainarea">
83
					<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
84
						<?php if (is_array($confvers)): ?>
85
						<tr>
86
							<td width="30%" class="listhdrr">Date</td>
87
							<td width="70%" class="listhdrr">Configuration Change</td>
88
						</tr>
89
						<tr valign="top">
90
							<td class="listlr"> <?= date("n/j/y H:i:s", $config['revision']['time']) ?></td>
91
							<td class="listr"> <?= $config['revision']['description'] ?></td>
92
							<td colspan="2" valign="middle" class="list" nowrap><b>Current</b></td>
93
						</tr>
94
						<?php
95
							foreach($confvers as $version):
96
								if($version['time'] != 0)
97
									$date = date("n/j/y H:i:s", $version['time']);
98
								else
99
									$date = "Unknown";
100
								$desc = $version['description'];
101
						?>
102
						<tr valign="top">
103
							<td class="listlr"> <?= $date ?></td>
104
							<td class="listr"> <?= $desc ?></td>
105
							<td valign="middle" class="list" nowrap>
106
								<a href="diag_confbak.php?newver=<?=$version['time'];?>">
107
									<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0">
108
								</a>
109
							</td>
110
							<td valign="middle" class="list" nowrap>
111
								<a href="diag_confbak.php?rmver=<?=$version['time'];?>">
112
									<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
113
								</a>
114
							</td>
115
						</tr>
116
						<?php endforeach; ?>
117
						<?php else: ?>
118
						<tr>
119
							<td>
120
								<?php print_info_box("No backups found."); ?>
121
							</td>
122
						</tr>
123
						<?php endif; ?>
124
					</table>
125
				</div>
126
			</td>
127 2e2d1de7 Bill Marquette
		</tr>
128 0f10aee4 Bill Marquette
	</table>
129 cdb0814b Scott Ullrich
</form>
130 359893b0 Colin Smith
<?php include("fend.inc"); ?>
131 12af52d9 Scott Ullrich
</body>
132 310b2c06 Bill Marquette
</html>