Project

General

Profile

Download (17.4 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
<script src="/javascript/sorttable.js"></script>
3

    
4
<?php
5
/*
6
	pfSense_MODULE:	header
7
*/
8

    
9
require_once("globals.inc");
10
require_once("functions.inc");
11

    
12
/* $Id$ */
13

    
14

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

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

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

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

    
47
function return_ext_menu($section) {
48
	global $config;
49
	$htmltext = "";
50
	$extarray = array();
51
	if($config['installedpackages']['menu'] <> "") {
52
		foreach($config['installedpackages']['menu'] as $menuitem) {
53
			if($menuitem['section'] != $section) continue;
54
			if($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
			}
67
			$extarray[] = array($menuitem['name'], $description);
68
		}
69
	}
70
	return $extarray;
71
}
72

    
73
function output_menu($arrayitem, $target="") {
74
	foreach($arrayitem as $item) {
75
		if($target)
76
			$targetinfo = "target='{$target}'";
77
		echo '<li><a ' . $targetinfo. ' href="' . $item[1] . '" class="navlnk">' . $item[0] . '</a></li>' . "\n";
78
	}
79
}
80

    
81
// System
82
$system_menu = array();
83
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
84
$system_menu[] = array(gettext("Firmware"), "/system_firmware.php");
85
$system_menu[] = array(gettext("General Setup"), "/system.php");
86
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
87
$system_menu[] = array(gettext("Logout"), "/index.php?logout");
88
if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd")
89
	$system_menu[] = array(gettext("Packages"), "/pkg_mgr_installed.php");
90
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
91
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
92
$system_menu[] = array(gettext("Cert Manager"), "/system_camanager.php");
93
if (!isAllowedPage("system_usermanager.php*"))
94
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
95
else
96
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
97
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")),0);
98

    
99
// Interfaces
100
$interfaces_menu = array();
101
if (!isset($config['system']['webgui']['noassigninterfaces']))
102
	$interfaces_menu[] = array("(assign)", "/interfaces_assign.php");
103
$opts = get_configured_interface_with_descr(false, true);
104
foreach ($opts as $oif => $odescr)
105
	if (!isset($config['interfaces'][$oif]['ovpn']))
106
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
107
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")),0);
108

    
109
// Firewall
110
$firewall_menu = array();
111
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
112
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
113
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
114
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
115
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
116
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
117
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")),0);
118

    
119
// Services
120
$services_menu = array();
121
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
122
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
123
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
124
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
125
if($g['services_dhcp_server_enable']) {
126
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
127
	$services_menu[] = array(gettext("DHCPv6 Server"), "/services_dhcpv6.php");
128
}
129
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
130
$services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php");
131
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
132
$services_menu[] = array(gettext("OLSR"), "/pkg_edit.php?xml=olsrd.xml&id=0");
133
$services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php");
134
$services_menu[] = array(gettext("RIP"), "/pkg_edit.php?xml=routed.xml&id=0");
135
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
136
if(count($config['interfaces']) > 1) {
137
	/* no use for UPnP in single-interface deployments
138
	remove to reduce user confusion
139
	*/
140
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml&id=0");
141
}
142
$services_menu[] = array(gettext("OpenNTPD"), "/pkg_edit.php?xml=openntpd.xml&id=0");
143
$services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php");
144
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")),0);
145

    
146
// VPN
147
$vpn_menu = array();
148
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
149
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
150
$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
151
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
152
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0);
153

    
154
// Status
155
$status_menu = array();
156
if (count($config['captiveportal']) > 0)
157
	$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
158
$status_menu[] = array(gettext("CARP (failover)"), "/carp_status.php");
159
$status_menu[] = array(gettext("Dashboard"), "/index.php");
160
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
161
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
162
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
163
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
164
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
165
$status_menu[] = array(gettext("IPsec"), "/diag_ipsec.php");
166
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
167
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
168
if ($g['platform'] == "pfSense")
169
	$status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php");
170
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
171
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
172
$status_menu[] = array(gettext("Services"), "/status_services.php");
173
$status_menu[] = array(gettext("System Logs"), "/diag_logs.php");
174
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
175
if(count($config['interfaces']) > 1) 
176
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
177
$ifentries = get_configured_interface_with_descr();
178
foreach ($ifentries as $ent => $entdesc) {
179
	if (is_array($config['interfaces'][$ent]['wireless']) &&
180
		preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if']))
181
		$wifdescrs[$ent] = $entdesc;
182
}
183
if (count($wifdescrs) > 0)
184
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
185
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")),0);
186

    
187
// Diagnostics
188
$diagnostics_menu = array();
189
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
190
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
191
$diagnostics_menu[] = array(gettext("Backup/Restore"), "/diag_backup.php");
192
$diagnostics_menu[] = array(gettext("Command Prompt"), "/exec.php");
193
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
194
$diagnostics_menu[] = array(gettext("Edit File"), "/edit.php");
195
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
196
$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php" );
197
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php" );
198
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php" );
199

    
200
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
201
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
202
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
203
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
204
$diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php");
205
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
206
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
207
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
208
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
209
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
210
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
211
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
212
if($g['platform'] == "nanobsd")
213
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
214

    
215
if (isset($config['system']['developer'])) {
216
	echo "<li><hr width=\"80%\"/></li>";
217
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php");
218
}
219
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0);
220

    
221
if(! $g['disablehelpmenu']) {
222
	$help_menu = array();
223
	$help_menu[] = array(gettext("About this Page"), $helpurl);
224
	if($g['product_name'] == "pfSense") 
225
		$help_menu[] = array(gettext("Bug Database"), "http://www.pfsense.org/j.php?jumpto=redmine");
226
	$help_menu[] = array(gettext("User Forum"), "http://www.pfsense.org/j.php?jumpto=forum");
227
	$help_menu[] = array(gettext("Documentation"), "http://www.pfsense.org/j.php?jumpto=doc");
228
	$help_menu[] = array(gettext("Developers Wiki"), "http://www.pfsense.org/j.php?jumpto=devwiki");
229
	$help_menu[] = array(gettext("Paid Support"), "http://www.pfsense.org/j.php?jumpto=portal");
230
	$help_menu[] = array(gettext("pfSense Book"), "http://www.pfsense.org/j.php?jumpto=book");
231
	$help_menu[] = array(gettext("Search portal"), "http://www.pfsense.org/j.php?jumpto=searchportal");
232
	$help_menu[] = array(gettext("FreeBSD Handbook"), "http://www.pfsense.org/j.php?jumpto=fbsdhandbook");
233
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")),0);	
234
}
235

    
236
/* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */
237
if ($_REQUEST['noticeaction'] == 'acknowledge') {
238
	$notice_id = htmlspecialchars($_REQUEST['noticeid']);
239
	close_notice($notice_id);
240
}
241
/**********************************************/
242

    
243
?>
244

    
245
<div id="wrapper">
246
	<div id="header">
247
		<div id="header-left"><a href="/index.php" id="status-link"><img src="/themes/<?= $g['theme']; ?>/images/transparent.gif" border="0"></a></div>
248
		<div id="header-right">
249
			<div class="container">
250
				<div class="left">webConfigurator</div>
251
				<div class="right">
252
<?
253
				if (are_notices_pending()) {
254
					$notices = get_notices();
255

    
256
					$requests=array();
257

    
258
					## Get Query Arguments from URL ###
259
					foreach ($_REQUEST as $key => $value) {
260
						if ($key != "PHPSESSID")
261
							$requests[] = $key.'='.$value;
262
					}
263
					if(is_array($requests))
264
						$request_string = implode("&", $requests);
265

    
266
					if(is_array($notices)) {
267
						foreach ($notices as $key => $value) {
268
							$date = date("m-d-y H:i:s", $key);
269
							$noticemsg = str_replace("'", "", $value['notice']);
270
							$noticemsg = str_replace('"', "", $noticemsg);
271
							$noticemsg = str_replace("\n", "", $noticemsg);
272
							$noticemsg = str_replace("<p>", "", $noticemsg);
273
							$noticemsg = str_replace("<pre>", "", $noticemsg);
274
							$noticemsg = str_replace("</pre>", "", $noticemsg);
275
							$noticemsg = str_replace("</p>", "", $noticemsg);
276
							$noticemsg = str_replace("<br>", "", $noticemsg);
277
							$extra_args = "";
278
							if($_GET['xml']) 
279
								$extraargs="&xml=" .  htmlspecialchars($_GET['xml']);
280
							if($_POST['xml']) 
281
								$extraargs="&xml=" .  htmlspecialchars($_POST['xml']);
282
							if($_GET['id']) 
283
								$extraargs="&xml=" .  htmlspecialchars($_GET['id']);
284
							if($_POST['id'])
285
								$extraargs="&xml=" .  htmlspecialchars($_POST['id']);
286
							$notice_msgs = '<a href="?noticeaction=acknowledge&noticeid=all' . $extraargs . '">Acknowledge All</a> &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ';
287
							if ($value['url']) {
288
								$notice_msgs .= $date.' - <a href="'.$url.'?' . htmlspecialchars($request_string) . '&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']</a>';
289
							} else {
290
								$notice_msgs .= $date.' - <a href="?' . htmlspecialchars($request_string) . '&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']'.htmlspecialchars($noticemsg).'</a>';
291
							}
292
							$notice_msgs .= " &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ";
293
						}
294
					}
295
?>
296
					<div id="alerts">
297
						<script type="text/javascript">
298
							var content='<div id="marquee-text"><?= $notice_msgs; ?></div>'
299
						</script>
300
						<script type="text/javascript" src="/javascript/ticker.js"></script>
301
					</div>
302
<?
303
				} else {
304
?>
305
					<div id="hostname">
306
						<? print $config['system']['hostname'] . "." . $config['system']['domain']; ?>
307
					</div>
308
<?
309
				}
310
?>
311
				</div>
312
			</div>
313
		</div>
314
	</div> <!-- Header DIV -->
315
	<div id="content">
316
		<div id="left">
317
			<div id="navigation" style="z-index:1000">
318
				<ul id="menu">
319
					<li class="firstdrop">
320
						<div><?php echo gettext("System"); ?></div>
321
						<ul class="subdrop">
322
						<?php
323
							output_menu($system_menu);
324
						?>
325
						</ul>
326
					</li>
327
					<li class="drop">
328
						<div><?php echo gettext("Interfaces"); ?></div>
329
						<ul class="subdrop">
330
						<?php
331
							output_menu($interfaces_menu);
332
						?>
333
						</ul>
334
					</li>
335
					<li class="drop">
336
						<div><?php echo gettext("Firewall"); ?></div>
337
						<ul class="subdrop">
338
						<?php
339
							output_menu($firewall_menu);
340
						?>
341
						</ul>
342
					</li>
343
					<li class="drop">
344
						<div><?php echo gettext("Services"); ?></div>
345
						<ul class="subdrop">
346
						<?
347
							output_menu($services_menu);
348
						?>
349
						</ul>
350
					</li>
351
					<li class="drop">
352
						<div><?php echo gettext("VPN"); ?></div>
353
						<ul class="subdrop">
354
						<?php
355
							output_menu($vpn_menu);
356
						?>
357
						</ul>
358
					</li>
359
					<li class="drop">
360
						<div><?php echo gettext("Status"); ?></div>
361
						<ul class="subdrop">
362
						<?php
363
							output_menu($status_menu);
364
						?>
365
						</ul>
366
					</li>
367
					<li class="drop">
368
						<div><?php echo gettext("Diagnostics"); ?></div>
369
						<ul id="diag" class="subdrop">
370
						<?
371
							output_menu($diagnostics_menu);
372
						?>
373
						</ul>
374
					</li>
375
					<?php if(! $g['disablehelpmenu']): ?>
376
					<li class="lastdrop">
377
						<div><?php echo gettext("Help"); ?></div>
378
						<ul id="help" class="subdrop">
379
						<?
380
							output_menu($help_menu, "_new");
381
						?>
382
						</ul>
383
					</li>
384
					<?php endif; ?>
385
				</ul>
386
			</div>
387

    
388
		</div> <!-- Left DIV -->
389

    
390
		<div id="right">
391

    
392
<?php
393

    
394
	/* display a top alert bar if need be */
395
	$need_alert_display = false;
396
	$found_notices = are_notices_pending();
397
	if($found_notices == true) {
398
		$notices = get_notices();
399
		if(!$notices) {
400
			$need_alert_display = true;
401
			$display_text = print_notices($notices) . "<br>";
402
		}
403
	}
404
	if($need_alert_display == true) {
405
                echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
406
                echo "<table>";
407
		echo "<tr><td><font color=\"#ffffff\">";
408
		echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\">&nbsp;&nbsp;&nbsp;";
409
		echo $display_text;
410
		echo "</td>";
411
		echo "</tr>";
412
		echo "</table>";
413
		echo "</div>";
414
	}
415

    
416
function add_to_menu($url, $name) {
417
	if (isAllowedPage($url))
418
		echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
419
}
420
?>
421

    
422
<div>
423
<span class="pgtitle"><a href="<?= $_SERVER['SCRIPT_NAME'] ?>"><?=genhtmltitle($pgtitle);?></a></span>
424
<span style="float:right; margin: 0 0 20px 20px;">
425
<?php if(! empty($statusurl)): ?>
426
<a href="<?php echo $statusurl; ?>" target="_new" title="<?php echo gettext("Status of items on this page."); ?>"><img src="/themes/<?php echo $g['theme']; ?>/images/status.png" border="0"></a>
427
<?php endif; ?>
428
<?php if(! empty($logurl)): ?>
429
<a href="<?php echo $logurl; ?>" target="_new" title="<?php echo gettext("Log entries for items on this page."); ?>"><img src="/themes/<?php echo $g['theme']; ?>/images/log.png" border="0"></a>
430
<?php endif; ?>
431
<?php if(! $g['disablehelpicon']): ?>
432
<a href="<?php echo $helpurl; ?>" target="_new" title="<?php echo gettext("Help for items on this page."); ?>"><img src="/themes/<?php echo $g['theme']; ?>/images/help.png" border="0"></a>
433
<?php endif; ?>
434
</span>
435
</div>
436
<br />
437

    
438
<?php
439
/* if upgrade in progress, alert user */
440
if(is_subsystem_dirty('packagelock')) {
441
	$pgtitle = array(gettext("System"),gettext("Package Manager"));
442
	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'>");
443
}
444
	$pgtitle_output = true;
445
?>
(52-52/240)