Project

General

Profile

Download (13 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
function return_ext_menu($section) {
15
	global $config;
16
	$htmltext = "";
17
	$extarray = array();
18
	if($config['installedpackages']['menu'] <> "") {
19
		foreach($config['installedpackages']['menu'] as $menuitem) {
20
			if($menuitem['section'] != $section) continue;
21
			if($menuitem['url'] <> "") {
22
			 	$addresswithport = getenv("HTTP_HOST");
23
				$colonpos = strpos($addresswithport, ":");
24
				if ($colonpos !== False){
25
					//my url is actually just the IP address of the pfsense box
26
					$myurl = substr($addresswithport, 0, $colonpos);
27
				}
28
				else
29
				{
30
					$myurl = $addresswithport;
31
				}
32

    
33
				$description = str_replace('$myurl', $myurl, $menuitem['url']);
34
			} else {
35
				$description = '/pkg.php?xml=' . $menuitem['configfile'];
36
			}
37
			$extarray[] = array($menuitem['name'], $description);
38
		}
39
	}
40
	return $extarray;
41
}
42

    
43
function output_menu($arrayitem, $target="") {
44
	foreach($arrayitem as $item) {
45
		if($target)
46
			$targetinfo = "target='{$target}'";
47
		echo '<li><a ' . $targetinfo. ' href="' . $item[1] . ' "class="navlnk">' . $item[0] . '</a></li>' . "\n";
48
	}
49
}
50

    
51
// System
52
$system_menu = array();
53
$system_menu[] = array("Advanced", "/system_advanced_admin.php");
54
$system_menu[] = array("Firmware", "/system_firmware.php");
55
$system_menu[] = array("General Setup", "/system.php");
56
$system_menu[] = array("Logout", "/index.php?logout");
57
if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd")
58
	$system_menu[] = array("Packages", "/pkg_mgr_installed.php");
59
$system_menu[] = array("Setup Wizard", "/wizard.php?xml=setup_wizard.xml");
60
$system_menu[] = array("Routing", "/system_gateways.php");
61
$system_menu[] = array("Cert Manager", "/system_camanager.php");
62
$system_menu[] = array("User Manager", "/system_usermanager.php");
63
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")),0);
64

    
65
// Interfaces
66
$interfaces_menu = array();
67
if (!isset($config['system']['webgui']['noassigninterfaces']))
68
	$interfaces_menu[] = array("(assign)", "/interfaces_assign.php");
69
$opts = get_configured_interface_with_descr(false, true);
70
foreach ($opts as $oif => $odescr)
71
	if (!isset($config['interfaces'][$oif]['ovpn']))
72
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
73
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")),0);
74

    
75
// Firewall
76
$firewall_menu = array();
77
$firewall_menu[] = array("Aliases", "/firewall_aliases.php");
78
if($config['interfaces']['lan']) 
79
	$firewall_menu[] = array("NAT", "/firewall_nat.php");
80
$firewall_menu[] = array("Rules", "/firewall_rules.php");
81
$firewall_menu[] = array("Schedules", "/firewall_schedule.php");
82
if($config['interfaces']['lan']) 
83
	$firewall_menu[] = array("Traffic Shaper", "/firewall_shaper.php");
84
$firewall_menu[] = array("Virtual IPs", "/firewall_virtual_ip.php");
85
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")),0);
86

    
87
// Services
88
$services_menu = array();
89
$services_menu[] = array("Captive Portal", "/services_captiveportal.php");
90
$services_menu[] = array("DNS Forwarder", "/services_dnsmasq.php");
91
$services_menu[] = array("DHCP Relay", "/services_dhcp_relay.php");
92
if($g['services_dhcp_server_enable'])
93
	$services_menu[] = array("DHCP Server", "/services_dhcp.php");
94
$services_menu[] = array("Dynamic DNS", "/services_dyndns.php");
95
$services_menu[] = array("IGMP proxy", "/services_igmpproxy.php");
96
$services_menu[] = array("Load Balancer", "/load_balancer_monitor.php");
97
$services_menu[] = array("OLSR", "/pkg_edit.php?xml=olsrd.xml&id=0");
98
$services_menu[] = array("PPPoE Server", "/vpn_pppoe.php");
99
$services_menu[] = array("RIP", "/pkg_edit.php?xml=routed/routed.xml&id=0");
100
$services_menu[] = array("SNMP", "/services_snmp.php");
101
if($config['interfaces']['lan']) {
102
	/* no use for UPnP in single-interface deployments
103
	remove to reduce user confusion
104
	*/
105
	$services_menu[] = array("UPnP", "/pkg_edit.php?xml=miniupnpd.xml&id=0");
106
}
107
$services_menu[] = array("OpenNTPD", "/pkg_edit.php?xml=openntpd.xml&id=0");
108
$services_menu[] = array("Wake on LAN", "/services_wol.php");
109
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")),0);
110

    
111
// VPN
112
$vpn_menu = array();
113
$vpn_menu[] = array("IPsec", "/vpn_ipsec.php");
114
$vpn_menu[] = array("OpenVPN", "/vpn_openvpn_server.php");
115
$vpn_menu[] = array("PPTP", "/vpn_pptp.php");
116
$vpn_menu[] = array("L2TP", "/vpn_l2tp.php");
117
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0);
118

    
119
// Status
120
$status_menu = array();
121
if (isset($config['captiveportal']['enable']))
122
	$status_menu[] = array("Captive Portal", "/status_captiveportal.php");
123
$status_menu[] = array("CARP (failover)", "/carp_status.php");
124
$status_menu[] = array("Dashboard", "/index.php");
125
$status_menu[] = array("Gateways", "/status_gateways.php");
126
$status_menu[] = array("DHCP Leases", "/diag_dhcp_leases.php");
127
$status_menu[] = array("Filter Reload", "/status_filter_reload.php");
128
$status_menu[] = array("Interfaces", "/status_interfaces.php");
129
$status_menu[] = array("IPsec", "/diag_ipsec.php");
130
$status_menu[] = array("Load Balancer", "/status_slbd_pool.php");
131
$status_menu[] = array("OpenVPN", "/status_openvpn.php");
132
if ($g['platform'] == "pfSense")
133
	$status_menu[] = array("Package Logs", "/diag_pkglogs.php");
134
$status_menu[] = array("Queues", "/status_queues.php");
135
$status_menu[] = array("RRD Graphs", "/status_rrd_graph.php");
136
$status_menu[] = array("Services", "/status_services.php");
137
$status_menu[] = array("System Logs", "/diag_logs.php");
138
$status_menu[] = array("Traffic Graph", "/status_graph.php?if=wan");
139
if($config['interfaces']['lan']) 
140
	$status_menu[] = array("UPnP", "/status_upnp.php");
141
$ifentries = get_configured_interface_with_descr();
142
foreach ($ifentries as $ent => $entdesc) {
143
	if (is_array($config['interfaces'][$ent]['wireless']) &&
144
		preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if']))
145
		$ifdescrs[$ent] = $entdesc;
146
}
147
if (count($ifdescrs) > 0)
148
	$status_menu[] = array("Wireless", "/status_wireless.php");
149
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")),0);
150

    
151
// Diagnostics
152
$diagnostics_menu = array();
153
$diagnostics_menu[] = array("ARP Tables", "/diag_arp.php");
154
$diagnostics_menu[] = array("Backup/Restore", "/diag_backup.php");
155
$diagnostics_menu[] = array("Command Prompt", "/exec.php");
156
$diagnostics_menu[] = array("DNS Lookup", "/diag_dns.php");
157
$diagnostics_menu[] = array("Edit File", "/edit.php");
158
$diagnostics_menu[] = array("Factory Defaults", "/diag_defaults.php");
159
$diagnostics_menu[] = array("Halt System", "/halt.php" );
160
$diagnostics_menu[] = array("Ping", "/diag_ping.php");
161
$diagnostics_menu[] = array("pfTOP", "/diag_system_pftop.php");
162
$diagnostics_menu[] = array("Reboot", "/reboot.php");
163
$diagnostics_menu[] = array("Routes", "/diag_routes.php");
164
$diagnostics_menu[] = array("Show Bogons", "/diag_showbogons.php");
165
$diagnostics_menu[] = array("States", "/diag_dump_states.php");
166
$diagnostics_menu[] = array("System Activity", "/diag_system_activity.php");
167
$diagnostics_menu[] = array("Traceroute", "/diag_traceroute.php");
168
$diagnostics_menu[] = array("Packet Capture", "/diag_packet_capture.php");
169
if($g['platform'] == "nanobsd")
170
	$diagnostics_menu[] = array("/diag_nanobsd.php", "NanoBSD");
171

    
172
if (isset($config['system']['developer'])) {
173
	echo "<li><hr width=\"80%\"/></li>";
174
	$diagnostics_menu[] = array("/restart_httpd.php", "Restart HTTPD");
175
}
176
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0);
177

    
178
$help_menu = array();
179
$help_menu[] = array("User Forum", "http://www.pfsense.org/j.php?jumpto=forum");
180
$help_menu[] = array("Documentation", "http://www.pfsense.org/j.php?jumpto=doc");
181
$help_menu[] = array("Developers Wiki", "http://www.pfsense.org/j.php?jumpto=devwiki");
182
$help_menu[] = array("Paid Support", "http://www.pfsense.org/j.php?jumpto=portal");
183
$help_menu[] = array("pfSense Book", "http://www.pfsense.org/j.php?jumpto=book");
184
$help_menu[] = array("Search portal", "http://www.pfsense.org/j.php?jumpto=searchportal");
185
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")),0);
186

    
187
/* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */
188
if ($_REQUEST['noticeaction'] == 'acknowledge') {
189
	$notice_id = $_REQUEST['noticeid'];
190
	close_notice($notice_id);
191
}
192
/**********************************************/
193

    
194
?>
195

    
196
<div id="wrapper">
197

    
198
	<div id="header">
199
		<div id="header-left"><a href="index.php" id="status-link"><img src="/themes/<?= $g['theme']; ?>/images/transparent.gif" border="0"></img></a></div>
200
		<div id="header-right">
201
			<div class="container">
202
				<div class="left">webConfigurator</div>
203
				<div class="right">
204
<?
205
				if (are_notices_pending()) {
206
					$notices = get_notices();
207

    
208
					$requests=array();
209

    
210
					## Get Query Arguments from URL ###
211
					foreach ($_REQUEST as $key => $value) {
212
						if ($key != "PHPSESSID")
213
							$requests[] = $key.'='.$value;
214
					}
215
					if(is_array($requests))
216
						$request_string = implode("&", $requests);
217

    
218
					if(is_array($notices)) {
219
						foreach ($notices as $key => $value) {
220
							$date = date("m-d-y H:i:s", $key);
221
							$noticemsg = str_replace("'", "", $value['notice']);
222
							$noticemsg = str_replace('"', "", $noticemsg);
223
							$noticemsg = str_replace("\n", "", $noticemsg);
224
							$noticemsg = str_replace("<p>", "", $noticemsg);
225
							$noticemsg = str_replace("<pre>", "", $noticemsg);
226
							$noticemsg = str_replace("</pre>", "", $noticemsg);
227
							$noticemsg = str_replace("</p>", "", $noticemsg);
228
							$noticemsg = str_replace("<br>", "", $noticemsg);
229
							$extra_args = "";
230
							if($_GET['xml']) 
231
								$extraargs="&xml=" . $_GET['xml'];
232
							if($_POST['xml']) 
233
								$extraargs="&xml=" . $_POST['xml'];
234
							if($_GET['id']) 
235
								$extraargs="&xml=" . $_GET['id'];
236
							if($_POST['id'])
237
								$extraargs="&xml=" . $_POST['id'];
238
							$notice_msgs = '<a href="?noticeaction=acknowledge&noticeid=all' . $extraargs . '">Acknowledge All</a> &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ';
239
							if ($value['url']) {
240
								$notice_msgs .= $date.' - <a href="'.$url.'?'.$request_string.'&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']</a>';
241
							} else {
242
								$notice_msgs .= $date.' - <a href="?'.$request_string.'&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']'.$noticemsg.'</a>';
243
							}
244
							$notice_msgs .= " &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ";
245
						}
246
					}
247
?>
248
					<div id="alerts">
249
						<script type="text/javascript">
250
							var content='<div id="marquee-text"><?= $notice_msgs; ?></div>'
251
						</script>
252
						<script type="text/javascript" src="/javascript/ticker.js"></script>
253
					</div>
254
<?
255
				} else {
256
?>
257
					<div id="hostname">
258
						<? print $config['system']['hostname'] . "." . $config['system']['domain']; ?>
259
					</div>
260
<?
261
				}
262
?>
263
				</div>
264
			</div>
265
		</div>
266
	</div> <!-- Header DIV -->
267
	<div id="content">
268
		<div id="left">
269
			<div id="navigation" style="z-index:1000">
270
				<ul id="menu">
271
					<li class="firstdrop">
272
						<div>System</div>
273
						<ul class="subdrop">
274
						<?php
275
							output_menu($system_menu);
276
						?>
277
						</ul>
278
					</li>
279
					<li class="drop">
280
						<div>Interfaces</div>
281
						<ul class="subdrop">
282
						<?php
283
							output_menu($interfaces_menu);
284
						?>
285
						</ul>
286
					</li>
287
					<li class="drop">
288
						<div>Firewall</div>
289
						<ul class="subdrop">
290
						<?php
291
							output_menu($firewall_menu);
292
						?>
293
						</ul>
294
					</li>
295
					<li class="drop">
296
						<div>Services</div>
297
						<ul class="subdrop">
298
						<?
299
							output_menu($services_menu);
300
						?>
301
						</ul>
302
					</li>
303
					<li class="drop">
304
						<div>VPN</div>
305
						<ul class="subdrop">
306
						<?php
307
							output_menu($vpn_menu);
308
						?>
309
						</ul>
310
					</li>
311
					<li class="drop">
312
						<div>Status</div>
313
						<ul class="subdrop">
314
						<?php
315
							output_menu($status_menu);
316
						?>
317
						</ul>
318
					</li>
319
					<li class="drop">
320
						<div>Diagnostics</div>
321
						<ul id="diag" class="subdrop">
322
						<?
323
							output_menu($diagnostics_menu);
324
						?>
325
						</ul>
326
					</li>
327
					<li class="lastdrop">
328
						<div>Help</div>
329
						<ul id="help" class="subdrop">
330
						<?
331
							output_menu($help_menu, "_new");
332
						?>
333
						</ul>
334
					</li>
335
				</ul>
336
			</div>
337

    
338
		</div> <!-- Left DIV -->
339

    
340
		<div id="right">
341

    
342
<?php
343

    
344
	/* display a top alert bar if need be */
345
	$need_alert_display = false;
346
	$found_notices = are_notices_pending();
347
	if($found_notices == true) {
348
		$notices = get_notices();
349
		if(!$notices) {
350
			$need_alert_display = true;
351
			$display_text = print_notices() . "<br>";
352
		}
353
	}
354
	if($need_alert_display == true) {
355
                echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
356
                echo "<table>";
357
		echo "<tr><td><font color=\"#ffffff\">";
358
		echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\">&nbsp;&nbsp;&nbsp;";
359
		echo $display_text;
360
		echo "</td>";
361
		echo "</tr>";
362
		echo "</table>";
363
		echo "</div>";
364
	}
365

    
366
function add_to_menu($url, $name) {
367
	if (isAllowedPage($url))
368
		echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
369
}
370
	
371
?>
372

    
373
<p class="pgtitle"><?=genhtmltitle($pgtitle);?></font></p>
374

    
375
<?php
376
	$pgtitle_output = true;
377
?>
(44-44/217)