Project

General

Profile

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