Projet

Général

Profil

Télécharger (9,78 ko) Statistiques
| Branche: | Tag: | Révision:

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

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

    
122
								$instpkgs = array();
123
								foreach($config['installedpackages']['package'] as $instpkg) {
124
									$instpkgs[] = $instpkg['name'];
125
								}
126
								natcasesort($instpkgs);
127

    
128
								foreach ($instpkgs as $index => $pkgname):
129

    
130
									$pkg = $config['installedpackages']['package'][$index];
131
									if(!$pkg['name'])
132
										continue;
133

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