1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/* $Id$ */
|
4
|
/*
|
5
|
pkg_mgr.php
|
6
|
Copyright (C) 2004 Scott Ullrich
|
7
|
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
|
require("guiconfig.inc");
|
32
|
require("xmlparse_pkg.inc");
|
33
|
|
34
|
conf_mount_rw();
|
35
|
|
36
|
?>
|
37
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
38
|
<html>
|
39
|
<head>
|
40
|
<title><?=gentitle("System: Package Manager");?></title>
|
41
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
42
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
43
|
</head>
|
44
|
|
45
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
46
|
<?php
|
47
|
include("fbegin.inc");
|
48
|
?>
|
49
|
<p class="pgtitle">System: Package Manager</p>
|
50
|
<form action="firewall_nat_out_load_balancing.php" method="post">
|
51
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
52
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td>
|
53
|
<ul id="tabnav">
|
54
|
<li class="tabinact"><a href="pkg_mgr.php">Available Packages</a></li>
|
55
|
<li class="tabact">Installed Packages</li>
|
56
|
</ul>
|
57
|
</td></tr>
|
58
|
<tr>
|
59
|
<td class="tabcont">
|
60
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
61
|
<tr>
|
62
|
<td width="25%" class="listhdrr">Package Name</td>
|
63
|
<td width="20%" class="listhdrr">Category</td>
|
64
|
<td width="10%" class="listhdrr">Version</td>
|
65
|
<td width="45%" class="listhdr">Description</td>
|
66
|
</tr>
|
67
|
|
68
|
<?php
|
69
|
$i = 0;
|
70
|
if($config['installedpackages']['package'] != "") {
|
71
|
foreach ($config['installedpackages']['package'] as $pkg) {
|
72
|
if($pkg['name'] <> "") {
|
73
|
?>
|
74
|
<tr valign="top">
|
75
|
<td class="listlr">
|
76
|
<?= $pkg['name'] ?>
|
77
|
</td>
|
78
|
<td class="listlr">
|
79
|
<?= $pkg['category'] ?>
|
80
|
</td>
|
81
|
<td class="listlr">
|
82
|
<?php
|
83
|
$latest_version = get_latest_package_version($pkg['name']);
|
84
|
if($latest_version == false) {
|
85
|
// We can't determine this package's version status.
|
86
|
echo "Upgrade: Unknown.<br>Installed: " . $pkg['version'];
|
87
|
} elseif($pkg['version'] <> $latest_version) {
|
88
|
/* a new version of the package is available */
|
89
|
$id = get_pkg_id($pkg['name']);
|
90
|
echo "Upgrade: <a href='pkg_mgr_delete.php?upgrade=true&id={$id}'>" . $latest_version . "</a>";
|
91
|
echo "<br>Installed: " . $pkg['version'];
|
92
|
} else {
|
93
|
echo $pkg['version'];
|
94
|
}
|
95
|
?>
|
96
|
</td>
|
97
|
<td class="listbg">
|
98
|
<font color="#FFFFFFF">
|
99
|
<?= $pkg['descr'] ?>
|
100
|
</td>
|
101
|
<td valign="middle" class="list" nowrap>
|
102
|
<a onclick="return confirm('Do you really want to remove this package?')" href="pkg_mgr_delete.php?pkg=<?= $pkg['name']; ?>"><img src="x.gif" width="17" height="17" border="0"></a>
|
103
|
</td>
|
104
|
</tr>
|
105
|
<?php
|
106
|
$i++;
|
107
|
}
|
108
|
}
|
109
|
}
|
110
|
if($i == 0) echo "<tr><td colspan=\"3\"><center>There are currently no packages installed.</td></tr>";
|
111
|
?>
|
112
|
</table>
|
113
|
</td>
|
114
|
</tr>
|
115
|
</table>
|
116
|
</form>
|
117
|
<?php include("fend.inc"); ?>
|
118
|
</body>
|
119
|
</html>
|
120
|
|
121
|
<?php
|
122
|
conf_mount_ro();
|
123
|
?>
|
124
|
|
125
|
|
126
|
|
127
|
|
128
|
|
129
|
|
130
|
|
131
|
|
132
|
|