Project

General

Profile

Download (4.44 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 310b2c06 Bill Marquette
$pgtitle = "Diagnostics: Configuration History";
53 b63695db Scott Ullrich
include("head.inc");
54
55 1d2d6b3c Colin Smith
?>
56
57
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
58 2e2d1de7 Bill Marquette
<?php include("fbegin.inc"); ?>
59 310b2c06 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
60 2e2d1de7 Bill Marquette
<?php if($savemsg) print_info_box($savemsg); ?>
61 1d2d6b3c Colin Smith
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
62 12af52d9 Scott Ullrich
<?php
63
	$tab_array = array();
64 38d48421 Colin Smith
	$tab_array[0] = array("Remote", false, "diag_backup.php");
65
	$tab_array[1] = array("Local", true, "diag_confbak.php");
66 12af52d9 Scott Ullrich
	display_top_tabs($tab_array);
67
?>			
68 1d2d6b3c Colin Smith
  </td></tr>
69
  <tr>
70 0f10aee4 Bill Marquette
    <td>
71
	<div id="mainarea">
72
              <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
73 359893b0 Colin Smith
<?php
74
if(is_array($confvers)) { 
75
		?>
76 1d2d6b3c Colin Smith
                <tr>
77
                  <td width="30%" class="listhdrr">Date</td>
78
		  <td width="70%" class="listhdrr">Configuration Change</td>
79
                </tr>
80
81 2e2d1de7 Bill Marquette
                <tr valign="top">
82
		  <td class="listlr"> <?= date("n/j/y H:i:s", $config['revision']['time']) ?></td>
83
                  <td class="listlr"> <?= $config['revision']['description'] ?></td>
84 dcf9eb16 Bill Marquette
		  <td colspan="2" valign="middle" class="list" nowrap><b>Current</b></td>
85 2e2d1de7 Bill Marquette
		</tr>
86 1d2d6b3c Colin Smith
		<?php
87
		  foreach($confvers as $version) {
88 359893b0 Colin Smith
			if($version['time'] != 0) {
89 25540c7c Colin Smith
				$date = date("n/j/y H:i:s", $version['time']);
90 359893b0 Colin Smith
			} else {
91
				$date = "Unknown";
92 1d2d6b3c Colin Smith
			}
93 359893b0 Colin Smith
			$desc = $version['description'];
94 1d2d6b3c Colin Smith
               ?>
95
                            <tr valign="top">
96 359893b0 Colin Smith
				<td class="listlr"> <?= $date ?></td>
97
                                <td class="listlr"> <?= $desc ?></td>
98 1d2d6b3c Colin Smith
				<td valign="middle" class="list" nowrap>
99 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>
100 1d2d6b3c Colin Smith
                                </td>
101 359893b0 Colin Smith
				<td valign="middle" class="list" nowrap>
102 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>
103 1d2d6b3c Colin Smith
			    </tr>
104
               <?php
105
                  } ?>
106 359893b0 Colin Smith
<?php } else {
107
		print_info_box("No backups found.");
108
      }
109
?>
110 0f10aee4 Bill Marquette
	</table>
111
	</div>
112 1d2d6b3c Colin Smith
    </td>
113
  </tr>
114
</table>
115
</body>
116
</html>
117 359893b0 Colin Smith
<?php include("fend.inc"); ?>
118 12af52d9 Scott Ullrich
</body>
119 310b2c06 Bill Marquette
</html>