Project

General

Profile

Download (6.19 KB) Statistics
| Branch: | Tag: | Revision:
1 ee11cc6e Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 ee11cc6e Scott Ullrich
/*
4 31f03b6c Sjon Hortensius
	pkg_mgr_installed.php
5 8a07e316 Sjon Hortensius
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6 31f03b6c Sjon Hortensius
	Copyright (C) 2004-2012 Scott Ullrich <sullrich@gmail.com>
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29 ee11cc6e Scott Ullrich
*/
30 1d333258 Scott Ullrich
/*
31
	pfSense_MODULE:	pkgs
32
*/
33 ee11cc6e Scott Ullrich
34 6b07c15a Matthew Grooms
##|+PRIV
35
##|*IDENT=page-system-packagemanager-installed
36
##|*NAME=System: Package Manager: Installed page
37
##|*DESCR=Allow access to the 'System: Package Manager: Installed' page.
38
##|*MATCH=pkg_mgr_installed.php*
39
##|-PRIV
40
41 9f9dcd98 Scott Ullrich
require_once("guiconfig.inc");
42 f8e335a3 Scott Ullrich
require_once("pkg-utils.inc");
43 ee11cc6e Scott Ullrich
44 06c4bb10 Phil Davis
$timezone = $config['system']['timezone'];
45 943994ff Scott Ullrich
if (!$timezone)
46
	$timezone = "Etc/UTC";
47
48
date_default_timezone_set($timezone);
49
50 261c7de8 jim-p
/* if upgrade in progress, alert user */
51
if(is_subsystem_dirty('packagelock')) {
52
	$pgtitle = array(gettext("System"),gettext("Package Manager"));
53
	include("head.inc");
54 31f03b6c Sjon Hortensius
	print_info_box_np("Please wait while packages are reinstalled in the background.");
55
	include("foot.inc");
56 261c7de8 jim-p
	exit;
57
}
58
59 746ec897 Colin Smith
if(is_array($config['installedpackages']['package'])) {
60
	foreach($config['installedpackages']['package'] as $instpkg) {
61
		$tocheck[] = $instpkg['name'];
62
	}
63 e83a9ff7 Marcello Coutinho
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink','descr'));
64 78dde2d7 Colin Smith
}
65 c6fb839b Colin Fleming
$closehead = false;
66 5ad0cbee Carlos Eduardo Ramos
$pgtitle = array(gettext("System"),gettext("Package Manager"));
67 83ddedcd Scott Ullrich
include("head.inc");
68
69 31f03b6c Sjon Hortensius
/* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */
70
if (!verify_all_package_servers())
71
	print_info_box(package_server_mismatch_message());
72 6916360e jim-p
73 31f03b6c Sjon Hortensius
/* Print package server SSL warning. See https://redmine.pfsense.org/issues/484 */
74
if (check_package_server_ssl() === false)
75 2d26ee5e Sjon Hortensius
	print_info_box(package_server_ssl_failure_message());
76
77
$version = file_get_contents("/etc/version");
78
$tab_array = array();
79
$tab_array[] = array(gettext("Available Packages"), false, "pkg_mgr.php");
80
//	$tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php");
81
//	$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
82
//	$tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
83
$tab_array[] = array(gettext("Installed Packages"), true, "pkg_mgr_installed.php");
84
display_top_tabs($tab_array);
85
86
if(!is_array($config['installedpackages']['package'])):?>
87
	<div class="alert alert-warning">
88
		<?=gettext("There are no packages currently installed.")?>
89
	</div>
90
<?php else: ?>
91
	<table class="table table-striped">
92
	<thead>
93 4c951cc9 Matthew Grooms
		<tr>
94 2d26ee5e Sjon Hortensius
			<th><span class="sr-only"><?=gettext("Status")?></span></th>
95
			<th><?=gettext("Name")?></th>
96
			<th><?=gettext("Category")?></th>
97
			<th><?=gettext("Version")?></th>
98
			<th><?=gettext("Description")?></th>
99 4c951cc9 Matthew Grooms
		</tr>
100 2d26ee5e Sjon Hortensius
	</thead>
101
	<tbody>
102
<?php
103
	$instpkgs = array();
104
	foreach($config['installedpackages']['package'] as $instpkg) {
105
		$instpkgs[] = $instpkg['name'];
106
	}
107
	natcasesort($instpkgs);
108
109
	foreach ($instpkgs as $index => $pkgname):
110
		$pkg = $config['installedpackages']['package'][$index];
111
		if(!$pkg['name'])
112
			continue;
113
114
		// get history/changelog git dir
115
		$commit_dir=explode("/",$pkg['config_file']);
116
		$changeloglink ="https://github.com/pfsense/pfsense-packages/commits/master/config/".$commit_dir[(count($commit_dir)-2)];
117
		#check package version
118
		$latest_package = $currentvers[$pkg['name']]['version'];
119
		if ($latest_package) {
120
			// we're running a newer version of the package
121
			if(strcmp($pkg['version'], $latest_package) > 0) {
122
				$status = 'Newer then available ('. $latest_package .')';
123
				$statusicon = 'exclamation';
124
			}
125
			// we're running an older version of the package
126
			if(strcmp($pkg['version'], $latest_package) < 0) {
127
				$status = 'Upgrade available to '.$latest_package;
128
				$statusicon = 'plus';
129
			}
130
			// we're running the current version
131
			if(!strcmp($pkg['version'], $latest_package)) {
132
				$status = 'Up-to-date';
133
				$statusicon = 'ok';
134
			}
135
			$pkgdescr = $currentvers[$pkg['name']]['descr'];
136
		} else {
137
			// unknown available package version
138
			$status = 'Unknown';
139
			$statusicon = 'question';
140
			$pkgdescr = $pkg['descr'];
141
		}
142 31f03b6c Sjon Hortensius
?>
143 2d26ee5e Sjon Hortensius
	<tr>
144
		<td>
145
			<i title="<?=$status?>" class="icon icon-<?=$statusicon?>-sign"></i>
146
		</td>
147
		<td>
148
			<?=$pkg['name']?>
149
		</td>
150
		<td>
151
			<?=$pkg['category']?>
152
		</td>
153
		<td>
154
<?php if (!$g['disablepackagehistory']):?>
155
			<a target="_blank" title="<?=gettext("View changelog")?>" href="<?=htmlspecialchars($changeloglink)?>">
156
<?php endif;?>
157
				<?=htmlspecialchars($pkg['version'])?>
158
			</a>
159
		</td>
160
		<td>
161
			<?=$pkgdescr?>
162
		</td>
163
		<td>
164 7c804c69 Sjon Hortensius
			<a href="pkg_mgr_install.php?mode=delete&amp;pkg=<?=$pkg['name']?>" class="btn btn-danger">remove</a>
165
			<a href="pkg_mgr_install.php?mode=reinstallpkg&amp;pkg=<?=$pkg['name']?>" class="btn btn-info">reinstall</a>
166
			<a href="pkg_mgr_install.php?mode=reinstallxml&amp;pkg=<?=$pkg['name']?>" class="btn btn-info"><?=gettext("reinstall GUI")?></a>
167 2d26ee5e Sjon Hortensius
<?php if(!$g['disablepackageinfo'] && $pkg['pkginfolink'] && $pkg['pkginfolink'] != $pkg['website']):?>
168 7c804c69 Sjon Hortensius
			<a target="_blank" title="<?=gettext("View more inforation")?>" href="<?=htmlspecialchars($pkg['pkginfolink'])?>" class="btn btn-default">info</a>
169 2d26ee5e Sjon Hortensius
<?php endif;?>
170
		</td>
171
	</tr>
172
<?php endforeach;?>
173
	</tbody>
174
</table>
175
<?php endif; ?>
176 31f03b6c Sjon Hortensius
<?php include("foot.inc")?>