1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
pkg_mgr.php
|
5
|
Copyright (C) 2004 Scott Ullrich
|
6
|
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
|
##|+PRIV
|
31
|
##|*IDENT=page-system-packagemanager-installed
|
32
|
##|*NAME=System: Package Manager: Installed page
|
33
|
##|*DESCR=Allow access to the 'System: Package Manager: Installed' page.
|
34
|
##|*MATCH=pkg_mgr_installed.php*
|
35
|
##|-PRIV
|
36
|
|
37
|
|
38
|
require_once("guiconfig.inc");
|
39
|
require_once("pkg-utils.inc");
|
40
|
|
41
|
if(is_array($config['installedpackages']['package'])) {
|
42
|
foreach($config['installedpackages']['package'] as $instpkg) {
|
43
|
$tocheck[] = $instpkg['name'];
|
44
|
}
|
45
|
$currentvers = get_pkg_info($tocheck, array('version', 'xmlver'));
|
46
|
}
|
47
|
|
48
|
$pgtitle = array("System","Package Manager");
|
49
|
include("head.inc");
|
50
|
|
51
|
?>
|
52
|
|
53
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
54
|
<?php include("fbegin.inc"); ?>
|
55
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
56
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td>
|
57
|
<?php
|
58
|
$version = file_get_contents("/etc/version");
|
59
|
$tab_array = array();
|
60
|
$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php");
|
61
|
$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
|
62
|
/* $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); */
|
63
|
$tab_array[] = array("Installed packages", true, "pkg_mgr_installed.php");
|
64
|
display_top_tabs($tab_array);
|
65
|
?>
|
66
|
</td></tr>
|
67
|
<tr>
|
68
|
<td>
|
69
|
<div id="mainarea">
|
70
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
71
|
<tr>
|
72
|
<td width="15%" class="listhdrr">Package Name</td>
|
73
|
<td width="20%" class="listhdrr">Category</td>
|
74
|
<td width="10%" class="listhdrr">Package Version</td>
|
75
|
<td width="45%" class="listhdr">Description</td>
|
76
|
</tr>
|
77
|
<?php
|
78
|
if($config['installedpackages']['package'] != "") {
|
79
|
$instpkgs = array();
|
80
|
foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
|
81
|
asort($instpkgs);
|
82
|
foreach ($instpkgs as $index => $pkgname){
|
83
|
$pkg = $config['installedpackages']['package'][$index];
|
84
|
if($pkg['name'] <> "") {
|
85
|
?>
|
86
|
<tr valign="top">
|
87
|
<td class="listlr">
|
88
|
<?= $pkg['name'] ?>
|
89
|
</td>
|
90
|
<td class="listlr">
|
91
|
<?= $pkg['category'] ?>
|
92
|
</td>
|
93
|
<?php
|
94
|
$latest_package = $currentvers[$pkg['name']]['version'];
|
95
|
if($latest_package == false) {
|
96
|
// We can't determine this package's version status.
|
97
|
?><td class="listlr"><?php
|
98
|
echo "Current: Unknown.<br>Installed: " . $pkg['version'];
|
99
|
?></td><?php
|
100
|
} elseif(strcmp($pkg['version'], $latest_package) > 0) {
|
101
|
/* we're running a newer version of the package */
|
102
|
?><td class="listbggrey"><font color="#FFFFFF"><?php
|
103
|
echo "Current: {$latest_package}";
|
104
|
echo "<br>Installed: {$pkg['version']}";
|
105
|
?></td><?php
|
106
|
} elseif(strcmp($pkg['version'], $latest_package) < 0) {
|
107
|
/* our package is out of date */
|
108
|
?><td class="listbg"><font color="#FFFFFF"><?php
|
109
|
echo "Current: {$latest_package}";
|
110
|
echo "<br>Installed: {$pkg['version']}";
|
111
|
?></td><?php
|
112
|
} else {
|
113
|
?><td class="listlr"><?php
|
114
|
echo $pkg['version'];
|
115
|
?></td><?php
|
116
|
}
|
117
|
?>
|
118
|
<td class="listbg">
|
119
|
<font color="#ffffff">
|
120
|
<?= $pkg['descr'] ?>
|
121
|
</td>
|
122
|
<td valign="middle" class="list" nowrap>
|
123
|
<a onclick="return confirm('Do you really want to remove this package?')" href="pkg_mgr_install.php?mode=delete&pkg=<?= $pkg['name']; ?>"><img title="Remove this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a>
|
124
|
<br>
|
125
|
<a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>"><img title="Reinstall this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0"</a>
|
126
|
<a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>"><img title="Reinstall this package's GUI components." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_xml.gif" width="17" height="17" border="0"</a>
|
127
|
</td>
|
128
|
</tr>
|
129
|
<?php
|
130
|
}
|
131
|
}
|
132
|
} else {
|
133
|
echo "<tr><td colspan=\"5\"><center>There are no packages currently installed.</td></tr>";
|
134
|
}
|
135
|
?>
|
136
|
</table>
|
137
|
</div>
|
138
|
</td>
|
139
|
</tr>
|
140
|
</table>
|
141
|
<?php include("fend.inc"); ?>
|
142
|
</body>
|
143
|
</html>
|
144
|
<?php conf_mount_ro(); ?>
|