Project

General

Profile

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