Projet

Général

Profil

Télécharger (10,1 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / pkg_mgr_installed.php @ fab1cd2f

1
<?php
2
/* $Id$ */
3
/*
4
    pkg_mgr.php
5
    Copyright (C) 2004-2012 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 = $config['system']['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
function domTT_title($title_msg, $return="echo"){
63
	if (!empty($title_msg)){
64
		$title_msg=preg_replace("/\s+/"," ",$title_msg);
65
        $title_msg=preg_replace("/'/","\'",$title_msg);
66
        $title= "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '{$title_msg}', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\"";
67
        if ($return =="echo")
68
		 echo $title;
69
		else
70
		return $title;	
71
	}
72
}
73
if(is_array($config['installedpackages']['package'])) {
74
	foreach($config['installedpackages']['package'] as $instpkg) {
75
		$tocheck[] = $instpkg['name'];
76
	}
77
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink','descr'));
78
}
79
$closehead = false;
80
$pgtitle = array(gettext("System"),gettext("Package Manager"));
81
include("head.inc");
82

    
83
?>
84
<script type="text/javascript" src="javascript/domTT/domLib.js"></script>
85
<script type="text/javascript" src="javascript/domTT/domTT.js"></script>
86
<script type="text/javascript" src="javascript/domTT/behaviour.js"></script>
87
<script type="text/javascript" src="javascript/domTT/fadomatic.js"></script>
88
<script type="text/javascript" src="/javascript/row_helper_dynamic.js"></script>
89
</head>
90

    
91
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
92
	<?php include("fbegin.inc"); 
93

    
94
	/* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */
95
	if (!verify_all_package_servers())
96
		print_info_box(package_server_mismatch_message());
97

    
98
	/* Print package server SSL warning. See https://redmine.pfsense.org/issues/484 */
99
	if (check_package_server_ssl() === false)
100
		print_info_box(package_server_ssl_failure_message()); ?>
101

    
102
	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="packages installed">
103
		<tr>
104
			<td>
105
				<?php
106
					$version = file_get_contents("/etc/version");
107
					$tab_array = array();
108
					$tab_array[] = array(gettext("Available Packages"), false, "pkg_mgr.php");
109
//					$tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php");
110
//					$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
111
//					$tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
112
					$tab_array[] = array(gettext("Installed Packages"), true, "pkg_mgr_installed.php");
113
					display_top_tabs($tab_array);
114
				?>
115
			</td>
116
		</tr>
117
		<tr>
118
			<td>
119
				<div id="mainarea">
120
					<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
121
						<tr>
122
							<td width="12%" class="listhdrr"><?=gettext("Name"); ?></td>
123
							<td width="16%" class="listhdrr"><?=gettext("Category"); ?></td>
124
							<td width="15%" class="listhdrr"><?=gettext("Version"); ?></td>
125
							<td width="53%" class="listhdr"><?=gettext("Description"); ?></td>
126
							<td width="40">&nbsp;</td>
127
						</tr>
128
						<?php
129
							if(is_array($config['installedpackages']['package'])):
130

    
131
								$instpkgs = array();
132
								foreach($config['installedpackages']['package'] as $instpkg) {
133
									$instpkgs[] = $instpkg['name'];
134
								}
135
								natcasesort($instpkgs);
136

    
137
								foreach ($instpkgs as $index => $pkgname):
138

    
139
									$pkg = $config['installedpackages']['package'][$index];
140
									if(!$pkg['name'])
141
										continue;
142

    
143
									// get history/changelog git dir
144
									$commit_dir=explode("/",$pkg['config_file']);
145
									$changeloglink ="https://github.com/pfsense/pfsense-packages/commits/master/config/".$commit_dir[(count($commit_dir)-2)]; 
146
									#check package version
147
									$latest_package = $currentvers[$pkg['name']]['version'];
148
									if ($latest_package) {
149
										// we're running a newer version of the package
150
										if(strcmp($pkg['version'], $latest_package) > 0) {
151
											$tdclass = "listbggrey";
152
											if ($g['disablepackagehistory'])
153
												$pkgver  = "<a>".gettext("Available") .": ". $latest_package . "<br />";
154
											else
155
												$pkgver  = "<a target='_blank' href='$changeloglink'>".gettext("Available") .": ". $latest_package . "<br />";
156
											$pkgver .= gettext("Installed") .": ". $pkg['version']. "</a>";
157
										}
158
										// we're running an older version of the package
159
										if(strcmp($pkg['version'], $latest_package) < 0) {
160
											$tdclass = "listbg";
161
											if ($g['disablepackagehistory'])
162
												$pkgver  = "<a><font color='#ffffff'>" . gettext("Available") .": ". $latest_package . "</font><br />";
163
											else
164
												$pkgver  = "<a target='_blank' href='$changeloglink'><font color='#ffffff'>" . gettext("Available") .": ". $latest_package . "<br />";
165
											$pkgver .= gettext("Installed") .": ". $pkg['version']."</font></a>";
166
										}
167
										// we're running the current version
168
										if(!strcmp($pkg['version'], $latest_package)) {
169
											$tdclass = "listr";
170
											if ($g['disablepackagehistory'])
171
												$pkgver = "<a>{$pkg['version']}</a>";
172
											else
173
												$pkgver = "<a target='_blank' href='$changeloglink'>{$pkg['version']}</a>";
174
										}
175
									} else {
176
										// unknown available package version
177
										$pkgver = "";
178
										if(!strcmp($pkg['version'], $latest_package)) {
179
											$tdclass = "listr";
180
											if ($g['disablepackagehistory'])
181
												$pkgver = "<a>{$pkg['version']}</a>";
182
											else
183
												$pkgver = "<a target='_blank' href='$changeloglink'>{$pkg['version']}</a>";
184
											}
185
									}
186
									/* Check package info link */
187
									if($pkg['pkginfolink']){
188
										$pkginfolink = $pkg['pkginfolink'];
189
										$pkginfo=gettext("Package info");
190
										}
191
									else{
192
										$pkginfolink = "https://forum.pfsense.org/index.php/board,15.0.html";
193
										$pkginfo=gettext("No package info, check the forum");
194
										}
195
									
196
						?>
197
						<tr valign="top">
198
							<td class="listlr">
199
								<?=$pkg['name'];?>
200
							</td>
201
							<td class="listr">
202
								<?=$pkg['category'];?>
203
							</td>
204
							<?php 
205
							if (isset($g['disablepackagehistory']))
206
									echo "<td class='{$tdclass}'>{$pkgver}</td>";
207
							else
208
									echo "<td class='{$tdclass}' ".domTT_title(gettext("Click on ".ucfirst($pkg['name'])." version to check its change log."),"return").">{$pkgver}</td>";
209
							?>
210
							<td class="listbg" style="overflow:hidden; text-align:justify;" <?=domTT_title(gettext("Click package info for more details about ".ucfirst($pkg['name'])." package."))?>>
211
									<?=$currentvers[$pkg['name']]['descr'];?>
212
							<?php if (! $g['disablepackageinfo']): ?>
213
							<br /><br />
214
							<a target='_blank' href='<?=$pkginfolink?>' style='align:center;color:#ffffff; filter:Glow(color=#ff0000, strength=12);'><?=$pkginfo?></a>
215
							<?php endif; ?>
216
							</td>
217
							<td valign="middle" class="list nowrap">
218
								<a href="pkg_mgr_install.php?mode=delete&amp;pkg=<?= $pkg['name']; ?>">
219
									<img <?=domTT_title(gettext("Remove ".ucfirst($pkg['name'])." package."))?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" />
220
								</a>
221
								<br />
222
								<a href="pkg_mgr_install.php?mode=reinstallpkg&amp;pkg=<?= $pkg['name']; ?>">
223
									<img <?=domTT_title(gettext("Reinstall ".ucfirst($pkg['name'])." package."));?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0" alt="reinstall" />
224
								</a>
225
								<a href="pkg_mgr_install.php?mode=reinstallxml&amp;pkg=<?= $pkg['name']; ?>">
226
									<img <?=domTT_title(gettext("Reinstall ".ucfirst($pkg['name'])."'s GUI components."));?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_xml.gif" width="17" height="17" border="0" alt="reinstall" />
227
								</a>
228
							</td>
229
						</tr>
230
						<?php
231
								endforeach;
232
							else:
233
						 ?>
234
						<tr>
235
							<td colspan="5" align="center">
236
								<?=gettext("There are no packages currently installed."); ?>
237
							</td>
238
						</tr>
239
						<?php endif; ?>
240
					</table>
241
				</div>
242
			</td>
243
		</tr>
244
	</table>
245
<?php include("fend.inc"); ?>
246
</body>
247
</html>
(133-133/255)