Project

General

Profile

Download (17.2 KB) Statistics
| Branch: | Tag: | Revision:
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 for the .xml filename */
32
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
33
	$param_split = explode('&', $uri_split[2]);
34
	foreach ($param_split as $param) {
35
		if (substr($param, 0, 4) == "xml=") {
36
			$xmlfile = explode('=', $param);
37
			$pagename = $xmlfile[1];
38
		}
39
	}
40
}
41

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

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

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

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

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

    
132
// Firewall
133
$firewall_menu = array();
134
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
135
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
136
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
137
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
138
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
139
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
140
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")),0);
141

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

    
168
// VPN
169
$vpn_menu = array();
170
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
171
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
172
$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
173
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
174
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0);
175

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

    
215
// Diagnostics
216
$diagnostics_menu = array();
217
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
218
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
219
$diagnostics_menu[] = array(gettext("Backup/Restore"), "/diag_backup.php");
220
$diagnostics_menu[] = array(gettext("Command Prompt"), "/exec.php");
221
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
222
$diagnostics_menu[] = array(gettext("Edit File"), "/edit.php");
223
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
224

    
225
if (file_exists("/var/run/gmirror_active")) {
226
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php" );
227
}
228
$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php" );
229
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php" );
230
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php" );
231

    
232
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
233
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
234
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
235
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
236
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
237
$diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php");
238
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
239
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
240
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php" );
241
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
242
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
243
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
244
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
245
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
246
if ($g['platform'] == "nanobsd") {
247
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
248
}
249

    
250
if (isset($config['system']['developer'])) {
251
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
252
}
253
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0);
254

    
255
$gold_menu = array();
256
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
257
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")),0);
258

    
259
if (!$g['disablehelpmenu']) {
260
	$help_menu = array();
261
	$help_menu[] = array(gettext("About this Page"), $helpurl);
262
	if ($g['product_name'] == "pfSense") {
263
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
264
	}
265
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
266
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
267
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
268
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
269
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
270
	$help_menu[] = array(gettext("Search portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
271
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
272
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")),0);
273
}
274

    
275
?>
276

    
277
<div id="wrapper">
278
	<div id="header">
279
		<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>
280
		<div id="header-right">
281
			<div class="container">
282
				<div class="left">webConfigurator</div>
283
				<div class="right" id="menu_messages">
284
<?php
285
				echo get_menu_messages();
286
?>
287
				</div>
288
			</div>
289
		</div>
290
	</div> <!-- Header DIV -->
291
	<div id="content">
292
		<div id="left">
293
			<div id="navigation" style="z-index:1000;">
294
				<ul id="menu">
295
					<li class="firstdrop">
296
						<div><?php echo gettext("System"); ?></div>
297
						<ul class="subdrop">
298
						<?php
299
							output_menu($system_menu);
300
						?>
301
						</ul>
302
					</li>
303
					<li class="drop">
304
						<div><?php echo gettext("Interfaces"); ?></div>
305
						<ul class="subdrop">
306
						<?php
307
							output_menu($interfaces_menu);
308
						?>
309
						</ul>
310
					</li>
311
					<li class="drop">
312
						<div><?php echo gettext("Firewall"); ?></div>
313
						<ul class="subdrop">
314
						<?php
315
							output_menu($firewall_menu);
316
						?>
317
						</ul>
318
					</li>
319
					<li class="drop">
320
						<div><?php echo gettext("Services"); ?></div>
321
						<ul class="subdrop">
322
						<?php
323
							output_menu($services_menu);
324
						?>
325
						</ul>
326
					</li>
327
					<li class="drop">
328
						<div><?php echo gettext("VPN"); ?></div>
329
						<ul class="subdrop">
330
						<?php
331
							output_menu($vpn_menu);
332
						?>
333
						</ul>
334
					</li>
335
					<li class="drop">
336
						<div><?php echo gettext("Status"); ?></div>
337
						<ul class="subdrop">
338
						<?php
339
							output_menu($status_menu);
340
						?>
341
						</ul>
342
					</li>
343
					<li class="drop">
344
						<div><?php echo gettext("Diagnostics"); ?></div>
345
						<ul id="diag" class="subdrop">
346
						<?php
347
							output_menu($diagnostics_menu);
348
						?>
349
						</ul>
350
					</li>
351
					<li class="drop">
352
						<div><?php echo gettext("Gold"); ?></div>
353
						<ul id="gold" class="subdrop">
354
						<?php
355
							output_menu($gold_menu, "_blank");
356
						?>
357
						</ul>
358
					</li>
359
					<?php if (!$g['disablehelpmenu']): ?>
360
					<li class="lastdrop">
361
						<div><?php echo gettext("Help"); ?></div>
362
						<ul id="help" class="subdrop">
363
						<?php
364
							output_menu($help_menu, "_blank");
365
						?>
366
						</ul>
367
					</li>
368
					<?php endif; ?>
369
				</ul>
370
			</div>
371

    
372
		</div> <!-- Left DIV -->
373

    
374
		<div id="right">
375

    
376
<?php
377
echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/domLib.js\"></script>\n";
378
echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/domTT.js\"></script>\n";
379
echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/behaviour.js\"></script>\n";
380
echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>\n";
381
/* display a top alert bar if need be */
382
$need_alert_display = false;
383
$found_notices = are_notices_pending();
384
if ($found_notices == true) {
385
	$notices = get_notices();
386
	if (!$notices) {
387
		$need_alert_display = true;
388
		$display_text = print_notices($notices) . "<br />";
389
	}
390
}
391
if ($need_alert_display == true) {
392
	echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
393
	echo "<table summary=\"round alert\">";
394
	echo "<tr><td><font color=\"#ffffff\">";
395
	echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\" alt=\"notification\" />&nbsp;&nbsp;&nbsp;";
396
	echo $display_text;
397
	echo "</font></td>";
398
	echo "</tr>";
399
	echo "</table>";
400
	echo "</div>";
401
}
402

    
403
function add_to_menu($url, $name) {
404
	if (isAllowedPage($url)) {
405
		echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
406
	}
407
}
408

    
409
?>
410

    
411
<div>
412
<span class="pgtitle"><a href="<?= htmlentities($_SERVER['REQUEST_URI']) ?>"><?=genhtmltitle($pgtitle);?></a></span>
413
<span style="float:right; margin: 0 0 20px 20px">
414
<?php
415
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
416
	$ssvc = array();
417
	switch ($shortcut_section) {
418
		case "openvpn":
419
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
420
			break;
421
		case "captiveportal":
422
			$ssvc = find_service_by_cp_zone($cpzone);
423
			break;
424
		default:
425
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
426

    
427
	}
428
	if (!empty($ssvc)) {
429
		echo get_service_status_icon($ssvc, false);
430
		echo get_service_control_links($ssvc, true);
431
	}
432
}
433

    
434
echo get_shortcut_main_link($shortcut_section, true);
435
echo get_shortcut_status_link($shortcut_section, true);
436
echo get_shortcut_log_link($shortcut_section, true);
437

    
438
?>
439
<?php if (!$g['disablehelpicon']): ?>
440

    
441
<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>
442
<?php endif; ?>
443
</span>
444
</div>
445
<br />
446

    
447
<?php
448
/* if upgrade in progress, alert user */
449
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
450
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
451
		$info_text = sprintf(gettext("%s is booting then packages will be reinstalled in the background.<p>Do not make changes in the GUI until this is complete."), $g['product_name']);
452
	} else {
453
		$pgtitle = array(gettext("System"),gettext("Package Manager"));
454
		$info_text = gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.");
455
	}
456
	print_info_box($info_text . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='firmware update' />");
457
}
458
$pgtitle_output = true;
459
?>
(58-58/256)