Projet

Général

Profil

Télécharger (16,6 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / fbegin.inc @ fa8be5de

1
<?php
2
/*
3
	pfSense_MODULE:	header
4
*/
5

    
6
require_once("globals.inc");
7
require_once("functions.inc");
8
require_once("shortcuts.inc");
9
require_once("service-utils.inc");
10

    
11
/* $Id$ */
12

    
13

    
14
/* Determine automated help URL. Should output the page name and
15
   parameters separately */
16
$uri_split = "";
17
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
18

    
19
/* If there was no match, there were no parameters, just grab the filename
20
   Otherwise, use the matched filename from above. */
21
if (empty($uri_split[0])) {
22
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
23
} else {
24
	$pagename = $uri_split[1];
25
}
26
/* If the page name is still empty, the user must have requested / (index.php) */
27
if (empty($pagename)) {
28
	$pagename = "index.php";
29
}
30

    
31
/* If the filename is pkg_edit.php or wizard.php, reparse looking
32
	for the .xml filename */
33
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
34
	$param_split = explode('&', $uri_split[2]);
35
	foreach ($param_split as $param) {
36
		if (substr($param, 0, 4) == "xml=") {
37
			$xmlfile = explode('=', $param);
38
			$pagename = $xmlfile[1];
39
		}
40
	}
41
}
42

    
43
/* Build the full help URL. */
44
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
45

    
46
function return_ext_menu($section) {
47
	global $config;
48
	$htmltext = "";
49
	$extarray = array();
50
	if($config['installedpackages']['menu'] <> "") {
51
		foreach($config['installedpackages']['menu'] as $menuitem) {
52
			if($menuitem['section'] != $section) continue;
53
			if($menuitem['url'] <> "") {
54
				$test_url=$menuitem['url'];
55
			 	$addresswithport = getenv("HTTP_HOST");
56
				$colonpos = strpos($addresswithport, ":");
57
				if ($colonpos !== False){
58
					//my url is actually just the IP address of the pfsense box
59
					$myurl = substr($addresswithport, 0, $colonpos);
60
				} else {
61
					$myurl = $addresswithport;
62
				}
63
				$description = str_replace('$myurl', $myurl, $menuitem['url']);
64
			} else {
65
				$description = '/pkg.php?xml=' . $menuitem['configfile'];
66
				$test_url=$description;
67
			}
68
			 if(isAllowedPage($test_url)){
69
				$extarray[] = array($menuitem['name'], $description);
70
			 }
71
		}
72
	}
73
	return $extarray;
74
}
75

    
76
function output_menu($arrayitem, $target = null) {
77
	foreach ($arrayitem as $item) {
78
		if (isAllowedPage($item[1]) || $item[1]=="/index.php?logout"){
79
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
80
			if ($target) {
81
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
82
			}
83
			$class = "navlnk";
84
			if ($item['class']) {
85
				$class .= " {$item['class']}";
86
			}
87
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
88
			if ($item['style']) {
89
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
90
			}
91
			echo "<li>\n";
92
			printf("<a %s>%s</a>\n", $attr, $item[0]);
93
			echo "</li>\n";
94
		}
95
	}
96
}
97

    
98
// System
99
$system_menu = array();
100
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
101
$system_menu[] = array(gettext("Firmware"), "/system_firmware.php");
102
$system_menu[] = array(gettext("General Setup"), "/system.php");
103
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
104
$system_menu[] = array(gettext("Logout"), "/index.php?logout");
105
if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd")
106
	$system_menu[] = array(gettext("Packages"), "/pkg_mgr_installed.php");
107
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
108
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
109
$system_menu[] = array(gettext("Cert Manager"), "/system_camanager.php");
110
if (!isAllowedPage("system_usermanager.php*"))
111
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
112
else
113
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
114
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")),0);
115

    
116
// Interfaces
117
$interfaces_menu = array();
118
if (!isset($config['system']['webgui']['noassigninterfaces']))
119
	$interfaces_menu[] = array("(assign)", "/interfaces_assign.php");
120
$opts = get_configured_interface_with_descr(false, true);
121
foreach ($opts as $oif => $odescr)
122
	if (!isset($config['interfaces'][$oif]['ovpn']))
123
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
124
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")),0);
125

    
126
// Firewall
127
$firewall_menu = array();
128
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
129
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
130
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
131
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
132
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
133
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
134
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")),0);
135

    
136
// Services
137
$services_menu = array();
138
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
139
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
140
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
141
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
142
if($g['services_dhcp_server_enable']) {
143
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
144
	$services_menu[] = array(gettext("DHCPv6 Server/RA"), "/services_dhcpv6.php");
145
}
146
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
147
$services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php");
148
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
149
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
150
$services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php");
151
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
152
if(count($config['interfaces']) > 1) {
153
	/* no use for UPnP in single-interface deployments
154
	remove to reduce user confusion
155
	*/
156
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
157
}
158
$services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php");
159
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")),0);
160

    
161
// VPN
162
$vpn_menu = array();
163
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
164
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
165
$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
166
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
167
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0);
168

    
169
// Status
170
$status_menu = array();
171
if (count($config['captiveportal']) > 0)
172
	$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
173
$status_menu[] = array(gettext("CARP (failover)"), "/carp_status.php");
174
$status_menu[] = array(gettext("Dashboard"), "/index.php");
175
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
176
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
177
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
178
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
179
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
180
$status_menu[] = array(gettext("IPsec"), "/diag_ipsec.php");
181
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
182
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
183
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
184
if ($g['platform'] == "pfSense")
185
	$status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php");
186
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
187
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
188
$status_menu[] = array(gettext("Services"), "/status_services.php");
189
$status_menu[] = array(gettext("System Logs"), "/diag_logs.php");
190
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
191
if(count($config['interfaces']) > 1) 
192
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
193
$ifentries = get_configured_interface_with_descr();
194
foreach ($ifentries as $ent => $entdesc) {
195
	if (is_array($config['interfaces'][$ent]['wireless']) &&
196
		preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if']))
197
		$wifdescrs[$ent] = $entdesc;
198
}
199
if (count($wifdescrs) > 0)
200
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
201
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")),0);
202

    
203
// Diagnostics
204
$diagnostics_menu = array();
205
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
206
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
207
$diagnostics_menu[] = array(gettext("Backup/Restore"), "/diag_backup.php");
208
$diagnostics_menu[] = array(gettext("Command Prompt"), "/exec.php");
209
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
210
$diagnostics_menu[] = array(gettext("Edit File"), "/edit.php");
211
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
212
$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php" );
213
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php" );
214
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php" );
215

    
216
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
217
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
218
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
219
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
220
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
221
$diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php");
222
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
223
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
224
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php" );
225
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
226
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
227
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
228
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
229
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
230
if($g['platform'] == "nanobsd")
231
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
232

    
233
if (isset($config['system']['developer'])) {
234
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
235
	
236
}
237
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0);
238

    
239
$gold_menu = array();
240
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
241
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")),0);
242

    
243
if(! $g['disablehelpmenu']) {
244
	$help_menu = array();
245
	$help_menu[] = array(gettext("About this Page"), $helpurl);
246
	if($g['product_name'] == "pfSense") 
247
	$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
248
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
249
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
250
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
251
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
252
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
253
	$help_menu[] = array(gettext("Search portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
254
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
255
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")),0);	
256
}
257

    
258
?>
259

    
260
<div id="wrapper">
261
	<div id="header">
262
		<div id="header-left"><a href="/index.php" id="status-link"><img src="/themes/<?= $g['theme']; ?>/images/transparent.gif" border="0" alt="transparent" /></a></div>
263
		<div id="header-right">
264
			<div class="container">
265
				<div class="left">webConfigurator</div>
266
				<div class="right" id="menu_messages">
267
<?php
268
				echo get_menu_messages();
269
?>
270
	</div>
271
			</div>
272
		</div>
273
	</div> <!-- Header DIV -->
274
	<div id="content">
275
		<div id="left">
276
			<div id="navigation" style="z-index:1000;">
277
				<ul id="menu">
278
					<li class="firstdrop">
279
						<div><?php echo gettext("System"); ?></div>
280
						<ul class="subdrop">
281
						<?php
282
							output_menu($system_menu);
283
						?>
284
						</ul>
285
					</li>
286
					<li class="drop">
287
						<div><?php echo gettext("Interfaces"); ?></div>
288
						<ul class="subdrop">
289
						<?php
290
							output_menu($interfaces_menu);
291
						?>
292
						</ul>
293
					</li>
294
					<li class="drop">
295
						<div><?php echo gettext("Firewall"); ?></div>
296
						<ul class="subdrop">
297
						<?php
298
							output_menu($firewall_menu);
299
						?>
300
						</ul>
301
					</li>
302
					<li class="drop">
303
						<div><?php echo gettext("Services"); ?></div>
304
						<ul class="subdrop">
305
						<?php
306
							output_menu($services_menu);
307
						?>
308
						</ul>
309
					</li>
310
					<li class="drop">
311
						<div><?php echo gettext("VPN"); ?></div>
312
						<ul class="subdrop">
313
						<?php
314
							output_menu($vpn_menu);
315
						?>
316
						</ul>
317
					</li>
318
					<li class="drop">
319
						<div><?php echo gettext("Status"); ?></div>
320
						<ul class="subdrop">
321
						<?php
322
							output_menu($status_menu);
323
						?>
324
						</ul>
325
					</li>
326
					<li class="drop">
327
						<div><?php echo gettext("Diagnostics"); ?></div>
328
						<ul id="diag" class="subdrop">
329
						<?php
330
							output_menu($diagnostics_menu);
331
						?>
332
						</ul>
333
					</li>
334
					<li class="drop">
335
						<div><?php echo gettext("Gold"); ?></div>
336
						<ul id="diag" class="subdrop">
337
						<?php
338
							output_menu($gold_menu, "_blank");
339
						?>
340
						</ul>
341
					</li>
342
					<?php if(! $g['disablehelpmenu']): ?>
343
					<li class="lastdrop">
344
						<div><?php echo gettext("Help"); ?></div>
345
						<ul id="help" class="subdrop">
346
						<?php
347
							output_menu($help_menu, "_blank");
348
						?>
349
						</ul>
350
					</li>
351
					<?php endif; ?>
352
				</ul>
353
			</div>
354

    
355
		</div> <!-- Left DIV -->
356

    
357
		<div id="right">
358

    
359
<?php
360
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/domLib.js\"></script>\n";
361
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/domTT.js\"></script>\n";
362
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/behaviour.js\"></script>\n";
363
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/fadomatic.js\"></script>\n";
364
	/* display a top alert bar if need be */
365
	$need_alert_display = false;
366
	$found_notices = are_notices_pending();
367
	if($found_notices == true) {
368
		$notices = get_notices();
369
		if(!$notices) {
370
			$need_alert_display = true;
371
			$display_text = print_notices($notices) . "<br />";
372
		}
373
	}
374
	if($need_alert_display == true) {
375
                echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
376
                echo "<table summary=\"round alert\">";
377
		echo "<tr><td><font color=\"#ffffff\">";
378
		echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\" alt=\"notification\" />&nbsp;&nbsp;&nbsp;";
379
		echo $display_text;
380
		echo "</font></td>";
381
		echo "</tr>";
382
		echo "</table>";
383
		echo "</div>";
384
	}
385

    
386
function add_to_menu($url, $name) {
387
	if (isAllowedPage($url))
388
		echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
389
}
390

    
391
?>
392

    
393
<div>
394
<span class="pgtitle"><a href="<?= htmlentities($_SERVER['REQUEST_URI']) ?>"><?=genhtmltitle($pgtitle);?></a></span>
395
<span style="float:right; margin: 0 0 20px 20px">
396
<?php
397
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
398
	$ssvc = array();
399
	switch ($shortcut_section) {
400
		case "openvpn":
401
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
402
			break;
403
		case "captiveportal":
404
			$ssvc = find_service_by_cp_zone($cpzone);
405
			break;
406
		default:
407
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
408

    
409
	}
410
	if (!empty($ssvc)) {
411
		echo get_service_status_icon($ssvc, false);
412
		echo get_service_control_links($ssvc, true);
413
	}
414
}
415

    
416
echo get_shortcut_main_link($shortcut_section, true);
417
echo get_shortcut_status_link($shortcut_section, true);
418
echo get_shortcut_log_link($shortcut_section, true);
419

    
420
?>
421
<?php if(! $g['disablehelpicon']): ?>
422

    
423
<a href="<?php echo $helpurl; ?>" title="<?php echo gettext("Help for items on this page"); ?>"><img style="vertical-align:middle" src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_help.gif" border="0" alt="help" /></a>
424
<?php endif; ?>
425
</span>
426
</div>
427
<br />
428

    
429
<?php
430
/* if upgrade in progress, alert user */
431
if(is_subsystem_dirty('packagelock')) {
432
	$pgtitle = array(gettext("System"),gettext("Package Manager"));
433
	print_info_box(gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.") . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='firmware update' />");
434
}
435
	$pgtitle_output = true;
436
?>
(56-56/246)