Project

General

Profile

Download (6.69 KB) Statistics
| Branch: | Tag: | Revision:
1 ee11cc6e Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 ee11cc6e Scott Ullrich
/*
4
    pkg_mgr.php
5 4f6a5e6a Scott Ullrich
    Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
6 ee11cc6e Scott Ullrich
    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 1d333258 Scott Ullrich
/*
30
	pfSense_MODULE:	pkgs
31
*/
32 ee11cc6e Scott Ullrich
33 6b07c15a Matthew Grooms
##|+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 9f9dcd98 Scott Ullrich
require_once("guiconfig.inc");
41 f8e335a3 Scott Ullrich
require_once("pkg-utils.inc");
42 ee11cc6e Scott Ullrich
43 746ec897 Colin Smith
if(is_array($config['installedpackages']['package'])) {
44
	foreach($config['installedpackages']['package'] as $instpkg) {
45
		$tocheck[] = $instpkg['name'];
46
	}
47 b24697f9 Chris Buechler
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink'));
48 78dde2d7 Colin Smith
}
49 83ddedcd Scott Ullrich
50 5ad0cbee Carlos Eduardo Ramos
$pgtitle = array(gettext("System"),gettext("Package Manager"));
51 83ddedcd Scott Ullrich
include("head.inc");
52
53 ee11cc6e Scott Ullrich
?>
54
55
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
56 4c951cc9 Matthew Grooms
	<?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 51ecb99e Renato Botelho
					$tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php");
64 cc1d20ab Scott Ullrich
//					$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
65 4c951cc9 Matthew Grooms
//					$tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
66 5ad0cbee Carlos Eduardo Ramos
					$tab_array[] = array(gettext("Installed packages"), true, "pkg_mgr_installed.php");
67 4c951cc9 Matthew Grooms
					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 5ad0cbee Carlos Eduardo Ramos
							<td width="10%" class="listhdrr"><?=gettext("Package Name"); ?></td>
77 968b84bc Chris Buechler
							<td width="20%" class="listhdrr"><?=gettext("Category"); ?></td>
78 5ad0cbee Carlos Eduardo Ramos
							<td width="10%" class="listhdrr"><?=gettext("Package Info"); ?></td>
79
							<td width="15%" class="listhdrr"><?=gettext("Package Version"); ?></td>
80
							<td width="45%" class="listhdr"><?=gettext("Description"); ?></td>
81 4c951cc9 Matthew Grooms
						</tr>
82
						<?php
83
							if(is_array($config['installedpackages']['package'])):
84
85
								$instpkgs = array();
86 a848d6c2 mcrane
								foreach($config['installedpackages']['package'] as $instpkg) {
87
									$instpkgs[] = $instpkg['name'];
88
								}
89 4c951cc9 Matthew Grooms
								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 79eaddf4 Renato Botelho
											$pkgver  = gettext("Available") .": ". $latest_package . "<br/>";
103
											$pkgver .= gettext("Installed") .": ". $pkg['version'];
104 4c951cc9 Matthew Grooms
										}
105
										// we're running an older version of the package
106
										if(strcmp($pkg['version'], $latest_package) < 0) {
107
											$tdclass = "listbg";
108 79eaddf4 Renato Botelho
											$pkgver  = "<font color='#ffffff'>" . gettext("Available") .": ". $latest_package . "<br/>";
109
											$pkgver .= gettext("Installed") .": ". $pkg['version'];
110 4c951cc9 Matthew Grooms
										}
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 b24697f9 Chris Buechler
							<td class="listr">
132
							<?php
133
							if($currentvers[$pkg['name']]['pkginfolink']) {
134
								$pkginfolink = $currentvers[$pkg['name']]['pkginfolink'];
135 5ad0cbee Carlos Eduardo Ramos
								echo "<a target='_new' href='$pkginfolink'>" . gettext("Package Info") . "</a>";
136 b24697f9 Chris Buechler
							} else {
137 c099a987 Scott Ullrich
								echo gettext("No info, check the") . " <a href='http://forum.pfsense.org/index.php/board,15.0.html'>" . gettext("forum") . "</a>";
138 b24697f9 Chris Buechler
							}
139
							?>
140
							</td>
141 4c951cc9 Matthew Grooms
							<td class="<?=$tdclass;?>">
142 f6afff20 Scott Ullrich
									<?=$pkgver;?>
143 4c951cc9 Matthew Grooms
							</td>
144
							<td class="listbg">
145
									<?=$pkg['descr'];?>
146
							</td>
147
							<td valign="middle" class="list" nowrap>
148 5ad0cbee Carlos Eduardo Ramos
								<a onclick="return confirm('<?=gettext("Do you really want to remove this package?"); ?>')" href="pkg_mgr_install.php?mode=delete&pkg=<?= $pkg['name']; ?>">
149
									<img title="<?=gettext("Remove this package."); ?>" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
150 4c951cc9 Matthew Grooms
								</a>
151
								<br>
152
								<a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>">
153 5ad0cbee Carlos Eduardo Ramos
									<img title="<?=gettext("Reinstall this package."); ?>" src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0">
154 4c951cc9 Matthew Grooms
								</a>
155
								<a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>">
156 5ad0cbee Carlos Eduardo Ramos
									<img title="<?=gettext("Reinstall this package's GUI components."); ?>" src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_xml.gif" width="17" height="17" border="0">
157 4c951cc9 Matthew Grooms
								</a>
158
							</td>
159
						</tr>
160
						<?php
161
								endforeach;
162
							else:
163
						 ?>
164
						<tr>
165
							<td colspan="5" align="center">
166 5ad0cbee Carlos Eduardo Ramos
								<?=gettext("There are no packages currently installed."); ?>
167 4c951cc9 Matthew Grooms
							</td>
168
						</tr>
169
						<?php endif; ?>
170
					</table>
171
				</div>
172
			</td>
173
		</tr>
174
	</table>
175 ee11cc6e Scott Ullrich
<?php include("fend.inc"); ?>
176
</body>
177
</html>