Project

General

Profile

Download (7.3 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    pkg_mgr.php
5
    Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
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
$timezone = $syscfg['timezone'];
44
if (!$timezone)
45
	$timezone = "Etc/UTC";
46

    
47
date_default_timezone_set($timezone);
48

    
49
/* if upgrade in progress, alert user */
50
if(is_subsystem_dirty('packagelock')) {
51
	$pgtitle = array(gettext("System"),gettext("Package Manager"));
52
	include("head.inc");
53
	echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
54
	include("fbegin.inc");
55
	echo "Please wait while packages are reinstalled in the background.";
56
	include("fend.inc");
57
	echo "</body>";
58
	echo "</html>";
59
	exit;
60
}
61

    
62
if(is_array($config['installedpackages']['package'])) {
63
	foreach($config['installedpackages']['package'] as $instpkg) {
64
		$tocheck[] = $instpkg['name'];
65
	}
66
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink'));
67
}
68

    
69
$pgtitle = array(gettext("System"),gettext("Package Manager"));
70
include("head.inc");
71

    
72
?>
73

    
74
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
75
	<?php include("fbegin.inc"); ?>
76
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
77
		<tr>
78
			<td>
79
				<?php
80
					$version = file_get_contents("/etc/version");
81
					$tab_array = array();
82
					$tab_array[] = array(gettext("Available Packages"), false, "pkg_mgr.php");
83
//					$tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php");
84
//					$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
85
//					$tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
86
					$tab_array[] = array(gettext("Installed Packages"), true, "pkg_mgr_installed.php");
87
					display_top_tabs($tab_array);
88
				?>
89
			</td>
90
		</tr>
91
		<tr>
92
			<td>
93
				<div id="mainarea">
94
					<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
95
						<tr>
96
							<td width="10%" class="listhdrr"><?=gettext("Package Name"); ?></td>
97
							<td width="20%" class="listhdrr"><?=gettext("Category"); ?></td>
98
							<td width="10%" class="listhdrr"><?=gettext("Package Info"); ?></td>
99
							<td width="15%" class="listhdrr"><?=gettext("Package Version"); ?></td>
100
							<td width="45%" class="listhdr"><?=gettext("Description"); ?></td>
101
						</tr>
102
						<?php
103
							if(is_array($config['installedpackages']['package'])):
104

    
105
								$instpkgs = array();
106
								foreach($config['installedpackages']['package'] as $instpkg) {
107
									$instpkgs[] = $instpkg['name'];
108
								}
109
								natcasesort($instpkgs);
110

    
111
								foreach ($instpkgs as $index => $pkgname):
112

    
113
									$pkg = $config['installedpackages']['package'][$index];
114
									if(!$pkg['name'])
115
										continue;
116

    
117
									$latest_package = $currentvers[$pkg['name']]['version'];
118
									if ($latest_package) {
119
										// we're running a newer version of the package
120
										if(strcmp($pkg['version'], $latest_package) > 0) {
121
											$tdclass = "listbggrey";
122
											$pkgver  = gettext("Available") .": ". $latest_package . "<br/>";
123
											$pkgver .= gettext("Installed") .": ". $pkg['version'];
124
										}
125
										// we're running an older version of the package
126
										if(strcmp($pkg['version'], $latest_package) < 0) {
127
											$tdclass = "listbg";
128
											$pkgver  = "<font color='#ffffff'>" . gettext("Available") .": ". $latest_package . "<br/>";
129
											$pkgver .= gettext("Installed") .": ". $pkg['version'];
130
										}
131
										// we're running the current version
132
										if(!strcmp($pkg['version'], $latest_package)) {
133
											$tdclass = "listr";
134
											$pkgver  = $pkg['version'];
135
										}
136
									} else {
137
										// unknown available package version
138
										$pkgver = "";
139
										if(!strcmp($pkg['version'], $latest_package)) {
140
											$tdclass = "listr";
141
											$pkgver = $pkg['version'];
142
										}
143
									}
144
						?>
145
						<tr valign="top">
146
							<td class="listlr">
147
								<?=$pkg['name'];?>
148
							</td>
149
							<td class="listr">
150
								<?=$pkg['category'];?>
151
							</td>
152
							<td class="listr">
153
							<?php
154
							if($currentvers[$pkg['name']]['pkginfolink']) {
155
								$pkginfolink = $currentvers[$pkg['name']]['pkginfolink'];
156
								echo "<a target='_new' href='$pkginfolink'>" . gettext("Package Info") . "</a>";
157
							} else {
158
								echo gettext("No info, check the") . " <a href='http://forum.pfsense.org/index.php/board,15.0.html'>" . gettext("forum") . "</a>";
159
							}
160
							?>
161
							</td>
162
							<td class="<?=$tdclass;?>">
163
									<?=$pkgver;?>
164
							</td>
165
							<td class="listbg">
166
									<?=$pkg['descr'];?>
167
							</td>
168
							<td valign="middle" class="list" nowrap>
169
								<a onclick="return confirm('<?=gettext("Do you really want to remove this package?"); ?>')" href="pkg_mgr_install.php?mode=delete&pkg=<?= $pkg['name']; ?>">
170
									<img title="<?=gettext("Remove this package."); ?>" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
171
								</a>
172
								<br>
173
								<a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>">
174
									<img title="<?=gettext("Reinstall this package."); ?>" src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0">
175
								</a>
176
								<a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>">
177
									<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">
178
								</a>
179
							</td>
180
						</tr>
181
						<?php
182
								endforeach;
183
							else:
184
						 ?>
185
						<tr>
186
							<td colspan="5" align="center">
187
								<?=gettext("There are no packages currently installed."); ?>
188
							</td>
189
						</tr>
190
						<?php endif; ?>
191
					</table>
192
				</div>
193
			</td>
194
		</tr>
195
	</table>
196
<?php include("fend.inc"); ?>
197
</body>
198
</html>
(127-127/238)