Project

General

Profile

Download (11.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2

    
3
require_once("functions.inc");
4
/* $Id$ */
5

    
6
function return_ext_menu($section) {
7
	global $config;
8
	$htmltext = "";
9
	if($config['installedpackages']['menu'] <> "") {
10
		foreach($config['installedpackages']['menu'] as $menuitem) {
11
			if($menuitem['section'] != $section) continue;
12
			if($menuitem['url'] <> "") {
13
			 	$addresswithport = getenv("HTTP_HOST");
14
				$colonpos = strpos($addresswithport, ":");
15
				if ($colonpos !== False){
16
					//my url is actually just the IP address of the pfsense box
17
					$myurl = substr($addresswithport, 0, $colonpos);
18
				}
19
				else
20
				{
21
					$myurl = $addresswithport;
22
				}
23

    
24
				$description = str_replace('$myurl', $myurl, $menuitem['url']);
25
			} else {
26
				$description = '/pkg.php?xml=' . $menuitem['configfile'];
27
			}
28
			$htmltext .= '<li><a href="' . $description . ' "class="navlnk">' . $menuitem['name'] . '</a></li>' . "\n";
29
		}
30
	}
31
	return $htmltext;
32
}
33

    
34
/* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */
35
if ($_REQUEST['noticeaction'] == 'acknowledge') {
36
	$notice_id = $_REQUEST['noticeid'];
37
	close_notice($notice_id);
38
}
39
/**********************************************/
40

    
41
?>
42

    
43
<div id="wrapper">
44

    
45
	<div id="header">
46
		<div id="header-left"><a href="index.php" id="status-link"><img src="/themes/<?= $g['theme']; ?>/images/transparent.gif" border="0"></img></a></div>
47
		<div id="header-right">
48
			<div class="container">
49
				<div class="left">webConfigurator</div>
50
				<div class="right">
51
<?
52
				if (are_notices_pending()) {
53
					$notices = get_notices();
54

    
55
					$requests=array();
56

    
57
					## Get Query Arguments from URL ###
58
					foreach ($_REQUEST as $key => $value) {
59
						if ($key != "PHPSESSID")
60
							$requests[] = $key.'='.$value;
61
					}
62
					if(is_array($requests))
63
						$request_string = implode("&", $requests);
64

    
65
					if(is_array($notices)) {
66
						foreach ($notices as $key => $value) {
67
							$date = date("m-d-y H:i:s", $key);
68
							$noticemsg = str_replace("'", "", $value['notice']);
69
							$noticemsg = str_replace('"', "", $noticemsg);
70
							$noticemsg = str_replace("\n", "", $noticemsg);
71
							$noticemsg = str_replace("<p>", "", $noticemsg);
72
							$noticemsg = str_replace("<pre>", "", $noticemsg);
73
							$noticemsg = str_replace("</pre>", "", $noticemsg);
74
							$noticemsg = str_replace("</p>", "", $noticemsg);
75
							$noticemsg = str_replace("<br>", "", $noticemsg);
76
							$extra_args = "";
77
							if($_GET['xml']) 
78
								$extraargs="&xml=" . $_GET['xml'];
79
							if($_POST['xml']) 
80
								$extraargs="&xml=" . $_POST['xml'];
81
							if($_GET['id']) 
82
								$extraargs="&xml=" . $_GET['id'];
83
							if($_POST['id'])
84
								$extraargs="&xml=" . $_POST['id'];
85
							$notice_msgs = '<a href="?noticeaction=acknowledge&noticeid=all' . $extraargs . '">Acknowledge All</a> &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ';
86
							if ($value['url']) {
87
								$notice_msgs .= $date.' - <a href="'.$url.'?'.$request_string.'&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']</a>';
88
							} else {
89
								$notice_msgs .= $date.' - <a href="?'.$request_string.'&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']'.$noticemsg.'</a>';
90
							}
91
							$notice_msgs .= " &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ";
92
						}
93
					}
94
?>
95
					<div id="alerts">
96
						<script type="text/javascript">
97
							var content='<div id="marquee-text"><?= $notice_msgs; ?></div>'
98
						</script>
99
						<script type="text/javascript" src="/ticker.js"></script>
100
					</div>
101
<?
102
				} else {
103
?>
104
					<div id="hostname">
105
						<? print $config['system']['hostname'] . "." . $config['system']['domain']; ?>
106
					</div>
107
<?
108
				}
109
?>
110
				</div>
111
			</div>
112
		</div>
113
	</div> <!-- Header DIV -->
114
	<div id="content">
115
		<div id="left">
116
			<div id="navigation" style="z-index:1000">
117
				<ul id="menu">
118
					<li class="firstdrop">
119
						<div>System</div>
120
						<ul class="subdrop">
121
							<?php 
122
							output_menu_item("/system_advanced.php", "Advanced");
123
							output_menu_item("/system_firmware.php", "Firmware");
124
							output_menu_item("/system.php", "General Setup");
125
							?>					 
126
							<li><a href="/index.php?logout" class="navlnk">Logout</a></li>											
127
						<?php if($g['platform'] == "pfSense"): ?>
128
							<?=output_menu_item("/pkg_mgr.php", "Packages");?>	
129
						<?php endif; ?>
130
							<?=output_menu_item("/wizard.php?xml=setup_wizard.xml", "Setup Wizard");?>
131
							<?=output_menu_item("/system_gateways.php", "Routing");?>
132
							<?=output_menu_item("/firewall_system_tunables.php", "Tunables");?>	
133
							<?=output_menu_item("/system_usermanager.php", "User Manager");?>	
134
						</ul>
135
					</li>
136
					<li class="drop">
137
						<div>Interfaces</div>
138
						<ul class="subdrop">
139
							<?php if (!isset($config['system']['webgui']['noassigninterfaces'])): ?>
140
							<?=output_menu_item("/interfaces_assign.php", "(assign)");?>								
141
							<?php endif; ?>
142
							<?=output_menu_item("/interfaces_wan.php?if=wan", "WAN");?>	
143
							<?php
144
							if($config['interfaces']['lan']) {
145
								output_menu_item("/interfaces_lan.php", "LAN");
146
							}
147
							?>
148
							<?php $opts = get_configured_interface_with_descr(true, true); 
149
							foreach ($opts as $oif => $odescr): 
150
								if (!isset($config['interfaces'][$oif]['ovpn'])): ?>
151
							<?=output_menu_item("/interfaces_wan.php?if={$oif}", htmlspecialchars($odescr))?>
152
							<?php endif; endforeach; ?>
153
							<?php echo return_ext_menu("Interfaces"); ?>
154
						</ul>
155
					</li>
156
<?php
157
        if($config['system']['shapertype'] <> "m0n0")
158
          $shaper = "firewall_shaper.php";
159
        else
160
          $shaper = "m0n0/firewall_shaper.php";
161
?>
162
					<li class="drop">
163
						<div>Firewall</div>
164
						<ul class="subdrop">
165
							<?=output_menu_item("/firewall_aliases.php", "Aliases");?>	
166
							<?php
167
							if($config['interfaces']['lan']) {
168
								/* no use for NAT in single-interface deployments
169
								remove to reduce user confusion
170
								*/
171
								output_menu_item("/firewall_nat.php", "NAT");	
172
							}
173
							?>
174
							<?=output_menu_item("/firewall_rules.php", "Rules");?>	
175
							<?=output_menu_item("/firewall_schedule.php", "Schedules");?>	
176
							<?php
177
							if($config['interfaces']['lan']) {
178
								/* no use for traffic shaper in single-interface
179
								  deployments
180
								remove to reduce user confusion
181
								*/
182
								output_menu_item("{$shaper}", "Traffic Shaper");
183
							}
184
							?>	
185
							<?=output_menu_item("/firewall_virtual_ip.php", "Virtual IPs");?>	
186
							<?php echo return_ext_menu("Firewall"); ?>
187
						</ul>
188
					</li>
189
					<li class="drop">
190
						<div>Services</div>
191
						<ul class="subdrop">
192
							<?=output_menu_item("/services_captiveportal.php", "Captive Portal");?>	
193
							<?=output_menu_item("/services_dnsmasq.php", "DNS Forwarder");?>	
194
							<?=output_menu_item("/services_dhcp_relay.php", "DHCP Relay");?>	
195
							<?=output_menu_item("/services_dhcp.php", "DHCP Server");?>	
196
							<?=output_menu_item("/services_dyndns.php", "Dynamic DNS");?>
197
							<?=output_menu_item("/load_balancer_pool.php", "Load Balancer");?>	
198
							<?=output_menu_item("/pkg_edit.php?xml=olsrd.xml&id=0", "OLSR");?>	
199
							<?=output_menu_item("/vpn_pppoe.php", "PPPoE Server");?>	
200
							<?=output_menu_item("/pkg_edit.php?xml=routed/routed.xml&id=0", "RIP");?>	
201
							<?=output_menu_item("/services_snmp.php", "SNMP");?>	
202
							<?php
203
							if($config['interfaces']['lan']) {
204
								/* no use for UPnP in single-interface deployments
205
								remove to reduce user confusion
206
								*/
207
								output_menu_item("/pkg_edit.php?xml=miniupnpd.xml&id=0", "UPnP");	
208
							}
209
							?>
210
							<?=output_menu_item("/pkg_edit.php?xml=openntpd.xml&id=0", "OpenNTPD");?>	
211
							<?=output_menu_item("/services_wol.php", "Wake on LAN");?>	
212
							<?php echo return_ext_menu("Services"); ?>
213
						</ul>
214
					</li>
215
					<li class="drop">
216
						<div>VPN</div>
217
						<ul class="subdrop">
218
							<?=output_menu_item("/vpn_ipsec.php", "IPsec");?>
219
							<?=output_menu_item("/pkg.php?xml=openvpn.xml", "OpenVPN");?>
220
							<?=output_menu_item("/vpn_pptp.php", "PPTP");?>
221
							<?php echo return_ext_menu("VPN"); ?>
222
						</ul>
223
					</li>
224
					<li class="drop">
225
						<div>Status</div>
226
						<ul class="subdrop">
227
							<?php if (isset($config['captiveportal']['enable'])): ?>
228
							<?=output_menu_item("/status_captiveportal.php", "Captive Portal");?>
229
							<?php endif; ?>
230
							<?=output_menu_item("/carp_status.php", "CARP (failover)");?>
231
							<?=output_menu_item("/index.php", "Dashboard");?>
232
							<?=output_menu_item("/status_gateways.php", "Gateways");?>
233
							<?=output_menu_item("/diag_dhcp_leases.php", "DHCP Leases");?>
234
							<?=output_menu_item("/status_filter_reload.php", "Filter Reload");?>
235
							<?=output_menu_item("/status_interfaces.php", "Interfaces");?>
236
							<?=output_menu_item("/diag_ipsec.php", "IPsec");?>
237
							<?=output_menu_item("/status_slbd_pool.php", "Load Balancer");?>
238
							<?=output_menu_item("/status_ovpn.php", "OpenVPN");?>
239
							<?php if($g['platform'] == "pfSense"): ?>
240
							<?=output_menu_item("/diag_pkglogs.php", "Package Logs");?>
241
							<?php endif; ?>
242
							<?=output_menu_item("/status_queues.php", "Queues");?>
243
							<?=output_menu_item("/status_rrd_graph.php", "RRD Graphs");?>
244
							<?=output_menu_item("/status_services.php", "Services");?>
245
							<?=output_menu_item("/diag_logs.php", "System Logs");?>
246
							<?=output_menu_item("/status_graph.php?if=wan", "Traffic Graph");?>
247
							<?php
248
							if($config['interfaces']['lan']) {
249
								/* no use for UPnP in single-interface deployments
250
								remove to reduce user confusion
251
								*/
252
								output_menu_item("/status_upnp.php", "UPnP");	
253
							}
254
							?>
255
							<?php $ifentries = get_configured_interface_with_descr();
256
							foreach ($ifentries as $ent => $entdesc) {
257
								if (is_array($config['interfaces'][$ent]['wireless']) &&
258
									preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if']))
259
									$ifdescrs[$ent] = $entdesc;
260
							}
261
							if (count($ifdescrs) > 0): ?>
262
							<?=output_menu_item("/status_wireless.php", "Wireless");?>
263
							<?php endif; ?>
264
							<?php echo return_ext_menu("Status"); ?>
265
						</ul>
266
					</li>
267
					<li class="lastdrop">
268
						<div>Diagnostics</div>
269
						<ul id="diag" class="subdrop">
270
							<?=output_menu_item("/diag_arp.php", "ARP Tables");?>
271
							<?=output_menu_item("/diag_backup.php", "Backup/Restore");?>
272
							<?=output_menu_item("/exec.php", "Command Prompt");?>
273
							<?=output_menu_item("/edit.php", "Edit File");?>
274
							<?=output_menu_item("/diag_defaults.php", "Factory Defaults");?>
275
							<?=output_menu_item("/halt.php", "Halt System");?>
276
							<?=output_menu_item("/diag_ping.php", "Ping");?>
277
							<?=output_menu_item("/reboot.php", "Reboot");?>
278
							<?=output_menu_item("/diag_routes.php", "Routes");?>
279
							<?=output_menu_item("/diag_dump_states.php", "States");?>
280
							<?=output_menu_item("/diag_traceroute.php", "Traceroute");?>
281
							<?=output_menu_item("/diag_packet_capture.php", "Packet Capture");?>
282
							<?php echo return_ext_menu("Diagnostics"); ?>
283
							<?php if(isset($config['system']['developer'])): ?>
284
							<li><hr width="80%"/></li>
285
							<?=output_menu_item("/restart_httpd.php", "Restart HTTPD");?>							
286
							<?php endif; ?>
287
						</ul>
288
					</li>
289
				</ul>
290
			</div>
291

    
292
		</div> <!-- Left DIV -->
293

    
294
		<div id="right">
295

    
296
<?php
297

    
298
	/* display a top alert bar if need be */
299
	$need_alert_display = false;
300
	$found_notices = are_notices_pending();
301
	if($found_notices == true) {
302
		$notices = get_notices();
303
		if(!$notices) {
304
			$need_alert_display = true;
305
			$display_text = print_notices() . "<br>";
306
		}
307
	}
308
	if($need_alert_display == true) {
309
                echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
310
                echo "<table>";
311
		echo "<tr><td><font color=\"#ffffff\">";
312
		echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\">&nbsp;&nbsp;&nbsp;";
313
		echo $display_text;
314
		echo "</td>";
315
		echo "</tr>";
316
		echo "</table>";
317
		echo "</div>";
318
	}
319

    
320
function output_menu_item($url, $name) {
321
	if (isAllowedPage($url))
322
		echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
323
}
324
	
325
?>
326

    
327
<p class="pgtitle"><?=genhtmltitle($pgtitle);?></font></p>
(38-38/214)