Project

General

Profile

Download (7.19 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 261c7de8 jim-p
/* if upgrade in progress, alert user */
44
if(is_subsystem_dirty('packagelock')) {
45
	$pgtitle = array(gettext("System"),gettext("Package Manager"));
46
	include("head.inc");
47
	echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
48
	include("fbegin.inc");
49
	echo "Please wait while packages are reinstalled in the background.";
50
	include("fend.inc");
51
	echo "</body>";
52
	echo "</html>";
53
	exit;
54
}
55
56 746ec897 Colin Smith
if(is_array($config['installedpackages']['package'])) {
57
	foreach($config['installedpackages']['package'] as $instpkg) {
58
		$tocheck[] = $instpkg['name'];
59
	}
60 b24697f9 Chris Buechler
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink'));
61 78dde2d7 Colin Smith
}
62 83ddedcd Scott Ullrich
63 5ad0cbee Carlos Eduardo Ramos
$pgtitle = array(gettext("System"),gettext("Package Manager"));
64 83ddedcd Scott Ullrich
include("head.inc");
65
66 ee11cc6e Scott Ullrich
?>
67
68
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
69 4c951cc9 Matthew Grooms
	<?php include("fbegin.inc"); ?>
70
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
71
		<tr>
72
			<td>
73
				<?php
74
					$version = file_get_contents("/etc/version");
75
					$tab_array = array();
76 bf924b16 Chris Buechler
					$tab_array[] = array(gettext("Available Packages"), false, "pkg_mgr.php");
77
//					$tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php");
78 cc1d20ab Scott Ullrich
//					$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
79 4c951cc9 Matthew Grooms
//					$tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
80 bf924b16 Chris Buechler
					$tab_array[] = array(gettext("Installed Packages"), true, "pkg_mgr_installed.php");
81 4c951cc9 Matthew Grooms
					display_top_tabs($tab_array);
82
				?>
83
			</td>
84
		</tr>
85
		<tr>
86
			<td>
87
				<div id="mainarea">
88
					<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
89
						<tr>
90 5ad0cbee Carlos Eduardo Ramos
							<td width="10%" class="listhdrr"><?=gettext("Package Name"); ?></td>
91 968b84bc Chris Buechler
							<td width="20%" class="listhdrr"><?=gettext("Category"); ?></td>
92 5ad0cbee Carlos Eduardo Ramos
							<td width="10%" class="listhdrr"><?=gettext("Package Info"); ?></td>
93
							<td width="15%" class="listhdrr"><?=gettext("Package Version"); ?></td>
94
							<td width="45%" class="listhdr"><?=gettext("Description"); ?></td>
95 4c951cc9 Matthew Grooms
						</tr>
96
						<?php
97
							if(is_array($config['installedpackages']['package'])):
98
99
								$instpkgs = array();
100 a848d6c2 mcrane
								foreach($config['installedpackages']['package'] as $instpkg) {
101
									$instpkgs[] = $instpkg['name'];
102
								}
103 001cbed2 jim-p
								natcasesort($instpkgs);
104 4c951cc9 Matthew Grooms
105
								foreach ($instpkgs as $index => $pkgname):
106
107
									$pkg = $config['installedpackages']['package'][$index];
108
									if(!$pkg['name'])
109
										continue;
110
111
									$latest_package = $currentvers[$pkg['name']]['version'];
112
									if ($latest_package) {
113
										// we're running a newer version of the package
114
										if(strcmp($pkg['version'], $latest_package) > 0) {
115
											$tdclass = "listbggrey";
116 79eaddf4 Renato Botelho
											$pkgver  = gettext("Available") .": ". $latest_package . "<br/>";
117
											$pkgver .= gettext("Installed") .": ". $pkg['version'];
118 4c951cc9 Matthew Grooms
										}
119
										// we're running an older version of the package
120
										if(strcmp($pkg['version'], $latest_package) < 0) {
121
											$tdclass = "listbg";
122 79eaddf4 Renato Botelho
											$pkgver  = "<font color='#ffffff'>" . gettext("Available") .": ". $latest_package . "<br/>";
123
											$pkgver .= gettext("Installed") .": ". $pkg['version'];
124 4c951cc9 Matthew Grooms
										}
125
										// we're running the current version
126
										if(!strcmp($pkg['version'], $latest_package)) {
127
											$tdclass = "listr";
128
											$pkgver  = $pkg['version'];
129
										}
130
									} else {
131
										// unknown available package version
132 2d1298ce jim-p
										$pkgver = "";
133 4c951cc9 Matthew Grooms
										if(!strcmp($pkg['version'], $latest_package)) {
134
											$tdclass = "listr";
135
											$pkgver = $pkg['version'];
136
										}
137
									}
138
						?>
139
						<tr valign="top">
140
							<td class="listlr">
141
								<?=$pkg['name'];?>
142
							</td>
143
							<td class="listr">
144
								<?=$pkg['category'];?>
145
							</td>
146 b24697f9 Chris Buechler
							<td class="listr">
147
							<?php
148
							if($currentvers[$pkg['name']]['pkginfolink']) {
149
								$pkginfolink = $currentvers[$pkg['name']]['pkginfolink'];
150 5ad0cbee Carlos Eduardo Ramos
								echo "<a target='_new' href='$pkginfolink'>" . gettext("Package Info") . "</a>";
151 b24697f9 Chris Buechler
							} else {
152 c099a987 Scott Ullrich
								echo gettext("No info, check the") . " <a href='http://forum.pfsense.org/index.php/board,15.0.html'>" . gettext("forum") . "</a>";
153 b24697f9 Chris Buechler
							}
154
							?>
155
							</td>
156 4c951cc9 Matthew Grooms
							<td class="<?=$tdclass;?>">
157 f6afff20 Scott Ullrich
									<?=$pkgver;?>
158 4c951cc9 Matthew Grooms
							</td>
159
							<td class="listbg">
160
									<?=$pkg['descr'];?>
161
							</td>
162
							<td valign="middle" class="list" nowrap>
163 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']; ?>">
164
									<img title="<?=gettext("Remove this package."); ?>" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
165 4c951cc9 Matthew Grooms
								</a>
166
								<br>
167
								<a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>">
168 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">
169 4c951cc9 Matthew Grooms
								</a>
170
								<a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>">
171 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">
172 4c951cc9 Matthew Grooms
								</a>
173
							</td>
174
						</tr>
175
						<?php
176
								endforeach;
177
							else:
178
						 ?>
179
						<tr>
180
							<td colspan="5" align="center">
181 5ad0cbee Carlos Eduardo Ramos
								<?=gettext("There are no packages currently installed."); ?>
182 4c951cc9 Matthew Grooms
							</td>
183
						</tr>
184
						<?php endif; ?>
185
					</table>
186
				</div>
187
			</td>
188
		</tr>
189
	</table>
190 ee11cc6e Scott Ullrich
<?php include("fend.inc"); ?>
191
</body>
192
</html>