Project

General

Profile

Download (6.36 KB) Statistics
| Branch: | Tag: | Revision:
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
	pfSense_MODULE:	pkgs
31
*/
32

    
33
##|+PRIV
34
##|*IDENT=page-system-packagemanager-installed
35
##|*NAME=System: Package Manager: Installed page
36
##|*DESCR=Allow access to the 'System: Package Manager: Installed' page.
37
##|*MATCH=pkg_mgr_installed.php*
38
##|-PRIV
39

    
40
require_once("guiconfig.inc");
41
require_once("pkg-utils.inc");
42

    
43
if(is_array($config['installedpackages']['package'])) {
44
	foreach($config['installedpackages']['package'] as $instpkg) {
45
		$tocheck[] = $instpkg['name'];
46
	}
47
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink'));
48
}
49

    
50
$pgtitle = array("System","Package Manager");
51
include("head.inc");
52

    
53
?>
54

    
55
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
56
	<?php include("fbegin.inc"); ?>
57
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
58
		<tr>
59
			<td>
60
				<?php
61
					$version = file_get_contents("/etc/version");
62
					$tab_array = array();
63
					$tab_array[] = array("{$version} packages", false, "pkg_mgr.php");
64
//					$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
65
//					$tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
66
					$tab_array[] = array("Installed packages", true, "pkg_mgr_installed.php");
67
					display_top_tabs($tab_array);
68
				?>
69
			</td>
70
		</tr>
71
		<tr>
72
			<td>
73
				<div id="mainarea">
74
					<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
75
						<tr>
76
							<td width="10%" class="listhdrr">Package Name</td>
77
							<td width="20%" class="listhdrr">Category</td>
78
							<td width="10%" class="listhdrr">Package Info</td>
79
							<td width="15%" class="listhdrr">Package Version</td>
80
							<td width="45%" class="listhdr">Description</td>
81
						</tr>
82
						<?php
83
							if(is_array($config['installedpackages']['package'])):
84

    
85
								$instpkgs = array();
86
								foreach($config['installedpackages']['package'] as $instpkg) {
87
									$instpkgs[] = $instpkg['name'];
88
								}
89
								asort($instpkgs);
90

    
91
								foreach ($instpkgs as $index => $pkgname):
92

    
93
									$pkg = $config['installedpackages']['package'][$index];
94
									if(!$pkg['name'])
95
										continue;
96

    
97
									$latest_package = $currentvers[$pkg['name']]['version'];
98
									if ($latest_package) {
99
										// we're running a newer version of the package
100
										if(strcmp($pkg['version'], $latest_package) > 0) {
101
											$tdclass = "listbggrey";
102
											$pkgver  = "Available: {$latest_package}<br/>";
103
											$pkgver .= "Installed: {$pkg['version']}";
104
										}
105
										// we're running an older version of the package
106
										if(strcmp($pkg['version'], $latest_package) < 0) {
107
											$tdclass = "listbg";
108
											$pkgver  = "<font color='#ffffff'>Available: {$latest_package}<br/>";
109
											$pkgver .= "Installed: {$pkg['version']}";
110
										}
111
										// we're running the current version
112
										if(!strcmp($pkg['version'], $latest_package)) {
113
											$tdclass = "listr";
114
											$pkgver  = $pkg['version'];
115
										}
116
									} else {
117
										// unknown available package version
118
										if(!strcmp($pkg['version'], $latest_package)) {
119
											$tdclass = "listr";
120
											$pkgver = $pkg['version'];
121
										}
122
									}
123
						?>
124
						<tr valign="top">
125
							<td class="listlr">
126
								<?=$pkg['name'];?>
127
							</td>
128
							<td class="listr">
129
								<?=$pkg['category'];?>
130
							</td>
131
							<td class="listr">
132
							<?php
133
							if($currentvers[$pkg['name']]['pkginfolink']) {
134
								$pkginfolink = $currentvers[$pkg['name']]['pkginfolink'];
135
								echo "<a target='_new' href='$pkginfolink'>Package Info</a>";
136
							} else {
137
								echo "No info, check the <a href='http://forum.pfsense.org/index.php/board,15.0.html'>forum</a>";
138
							}
139
							?>
140
							</td>
141
							<td class="<?=$tdclass;?>">
142
									<?=$pkgver;?>
143
							</td>
144
							<td class="listbg">
145
									<?=$pkg['descr'];?>
146
							</td>
147
							<td valign="middle" class="list" nowrap>
148
								<a onclick="return confirm('Do you really want to remove this package?')" href="pkg_mgr_install.php?mode=delete&pkg=<?= $pkg['name']; ?>">
149
									<img title="Remove this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
150
								</a>
151
								<br>
152
								<a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>">
153
									<img title="Reinstall this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0">
154
								</a>
155
								<a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>">
156
									<img title="Reinstall this package's GUI components." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_xml.gif" width="17" height="17" border="0">
157
								</a>
158
							</td>
159
						</tr>
160
						<?php
161
								endforeach;
162
							else:
163
						 ?>
164
						<tr>
165
							<td colspan="5" align="center">
166
								There are no packages currently installed.
167
							</td>
168
						</tr>
169
						<?php endif; ?>
170
					</table>
171
				</div>
172
			</td>
173
		</tr>
174
	</table>
175
<?php include("fend.inc"); ?>
176
</body>
177
</html>
178
<?php conf_mount_ro(); ?>
(115-115/215)