Project

General

Profile

Download (14.3 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
				}
61
				else
62
				{
63
					$myurl = $addresswithport;
64
				}
65

    
66
				$description = str_replace('$myurl', $myurl, $menuitem['url']);
67
			} else {
68
				$description = '/pkg.php?xml=' . $menuitem['configfile'];
69
			}
70
			$extarray[] = array($menuitem['name'], $description);
71
		}
72
	}
73
	return $extarray;
74
}
75

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

    
84
// System
85
$system_menu = array();
86
$system_menu[] = array("Advanced", "/system_advanced_admin.php");
87
$system_menu[] = array("Firmware", "/system_firmware.php");
88
$system_menu[] = array("General Setup", "/system.php");
89
$system_menu[] = array("Logout", "/index.php?logout");
90
if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd")
91
	$system_menu[] = array("Packages", "/pkg_mgr_installed.php");
92
$system_menu[] = array("Setup Wizard", "/wizard.php?xml=setup_wizard.xml");
93
$system_menu[] = array("Routing", "/system_gateways.php");
94
$system_menu[] = array("Cert Manager", "/system_camanager.php");
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
if($config['interfaces']['lan']) 
112
	$firewall_menu[] = array("NAT", "/firewall_nat.php");
113
$firewall_menu[] = array("Rules", "/firewall_rules.php");
114
$firewall_menu[] = array("Schedules", "/firewall_schedule.php");
115
if($config['interfaces']['lan']) 
116
	$firewall_menu[] = array("Traffic Shaper", "/firewall_shaper.php");
117
$firewall_menu[] = array("Virtual IPs", "/firewall_virtual_ip.php");
118
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")),0);
119

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

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

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

    
184
// Diagnostics
185
$diagnostics_menu = array();
186
$diagnostics_menu[] = array("ARP Tables", "/diag_arp.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("Ping", "/diag_ping.php");
194
$diagnostics_menu[] = array("pfTOP", "/diag_system_pftop.php");
195
$diagnostics_menu[] = array("Reboot", "/reboot.php");
196
$diagnostics_menu[] = array("Routes", "/diag_routes.php");
197
$diagnostics_menu[] = array("Show Bogons", "/diag_showbogons.php");
198
$diagnostics_menu[] = array("States", "/diag_dump_states.php");
199
$diagnostics_menu[] = array("System Activity", "/diag_system_activity.php");
200
$diagnostics_menu[] = array("Traceroute", "/diag_traceroute.php");
201
$diagnostics_menu[] = array("Packet Capture", "/diag_packet_capture.php");
202
if($g['platform'] == "nanobsd")
203
	$diagnostics_menu[] = array("NanoBSD", "/diag_nanobsd.php");
204

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

    
211
$help_menu = array();
212
$help_menu[] = array("About this Page", $helpurl);
213
$help_menu[] = array("User Forum", "http://www.pfsense.org/j.php?jumpto=forum");
214
$help_menu[] = array("Documentation", "http://www.pfsense.org/j.php?jumpto=doc");
215
$help_menu[] = array("Developers Wiki", "http://www.pfsense.org/j.php?jumpto=devwiki");
216
$help_menu[] = array("Paid Support", "http://www.pfsense.org/j.php?jumpto=portal");
217
$help_menu[] = array("pfSense Book", "http://www.pfsense.org/j.php?jumpto=book");
218
$help_menu[] = array("Search portal", "http://www.pfsense.org/j.php?jumpto=searchportal");
219
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")),0);
220

    
221
/* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */
222
if ($_REQUEST['noticeaction'] == 'acknowledge') {
223
	$notice_id = $_REQUEST['noticeid'];
224
	close_notice($notice_id);
225
}
226
/**********************************************/
227

    
228
?>
229

    
230
<div id="wrapper">
231

    
232
	<div id="header">
233
		<div id="header-left"><a href="index.php" id="status-link"><img src="/themes/<?= $g['theme']; ?>/images/transparent.gif" border="0"></img></a></div>
234
		<div id="header-right">
235
			<div class="container">
236
				<div class="left">webConfigurator</div>
237
				<div class="right">
238
<?
239
				if (are_notices_pending()) {
240
					$notices = get_notices();
241

    
242
					$requests=array();
243

    
244
					## Get Query Arguments from URL ###
245
					foreach ($_REQUEST as $key => $value) {
246
						if ($key != "PHPSESSID")
247
							$requests[] = $key.'='.$value;
248
					}
249
					if(is_array($requests))
250
						$request_string = implode("&", $requests);
251

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

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

    
374
		<div id="right">
375

    
376
<?php
377

    
378
	/* display a top alert bar if need be */
379
	$need_alert_display = false;
380
	$found_notices = are_notices_pending();
381
	if($found_notices == true) {
382
		$notices = get_notices();
383
		if(!$notices) {
384
			$need_alert_display = true;
385
			$display_text = print_notices() . "<br>";
386
		}
387
	}
388
	if($need_alert_display == true) {
389
                echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
390
                echo "<table>";
391
		echo "<tr><td><font color=\"#ffffff\">";
392
		echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\">&nbsp;&nbsp;&nbsp;";
393
		echo $display_text;
394
		echo "</td>";
395
		echo "</tr>";
396
		echo "</table>";
397
		echo "</div>";
398
	}
399

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

    
406
<div>
407
<span class="pgtitle"><?=genhtmltitle($pgtitle);?></font></span>
408
<span style="float:right; margin: 0 0 20px 20px;"><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></span>
409
</div>
410
<br />
411

    
412
<?php
413
	$pgtitle_output = true;
414
?>
(44-44/216)