Project

General

Profile

Download (16.1 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("Advanced", "/system_advanced_admin.php");
84
$system_menu[] = array("Firmware", "/system_firmware.php");
85
$system_menu[] = array("General Setup", "/system.php");
86
$system_menu[] = array("Logout", "/index.php?logout");
87
if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd")
88
	$system_menu[] = array("Packages", "/pkg_mgr_installed.php");
89
$system_menu[] = array("Setup Wizard", "/wizard.php?xml=setup_wizard.xml");
90
$system_menu[] = array("Routing", "/system_gateways.php");
91
$system_menu[] = array("Cert Manager", "/system_camanager.php");
92
if (!isAllowedPage("system_usermanager.php*"))
93
	$system_menu[] = array("User Manager", "/system_usermanager_passwordmg.php");
94
else
95
	$system_menu[] = array("User Manager", "/system_usermanager.php");
96
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")),0);
97

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

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

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

    
142
// VPN
143
$vpn_menu = array();
144
$vpn_menu[] = array("IPsec", "/vpn_ipsec.php");
145
$vpn_menu[] = array("OpenVPN", "/vpn_openvpn_server.php");
146
$vpn_menu[] = array("PPTP", "/vpn_pptp.php");
147
$vpn_menu[] = array("L2TP", "/vpn_l2tp.php");
148
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0);
149

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

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

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

    
210
if (isset($config['system']['developer'])) {
211
	echo "<li><hr width=\"80%\"/></li>";
212
	$diagnostics_menu[] = array("Restart HTTPD", "/restart_httpd.php");
213
}
214
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0);
215

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

    
231
/* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */
232
if ($_REQUEST['noticeaction'] == 'acknowledge') {
233
	$notice_id = htmlspecialchars($_REQUEST['noticeid']);
234
	close_notice($notice_id);
235
}
236
/**********************************************/
237

    
238
?>
239

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

    
251
					$requests=array();
252

    
253
					## Get Query Arguments from URL ###
254
					foreach ($_REQUEST as $key => $value) {
255
						if ($key != "PHPSESSID")
256
							$requests[] = $key.'='.$value;
257
					}
258
					if(is_array($requests))
259
						$request_string = implode("&", $requests);
260

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

    
383
		</div> <!-- Left DIV -->
384

    
385
		<div id="right">
386

    
387
<?php
388

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

    
411
function add_to_menu($url, $name) {
412
	if (isAllowedPage($url))
413
		echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
414
}
415
?>
416

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

    
433
<?php
434
/* if upgrade in progress, alert user */
435
if(is_subsystem_dirty('packagelock')) {
436
	$pgtitle = array(gettext("System"),gettext("Package Manager"));
437
	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'>");
438
}
439
	$pgtitle_output = true;
440
?>
(50-50/226)