Project

General

Profile

Download (12.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", "WAN");?>	
143
							<?php
144
							if($config['interfaces']['lan']) {
145
								output_menu_item("/interfaces_lan.php", "LAN");
146
							}
147
							?>
148
							<?php for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): if (!isset($config['interfaces']['opt' . $i]['ovpn'])): ?>
149
							<?=output_menu_item("/interfaces_opt.php?index={$i}", htmlspecialchars($config['interfaces']['opt' . $i]['descr']))?>
150
							<?php endif; endfor; ?>
151
							<?php echo return_ext_menu("Interfaces"); ?>
152
						</ul>
153
					</li>
154
<?php
155
        if($config['system']['shapertype'] <> "m0n0")
156
          $shaper = "firewall_shaper.php";
157
        else
158
          $shaper = "m0n0/firewall_shaper.php";
159
?>
160
					<li class="drop">
161
						<div>Firewall</div>
162
						<ul class="subdrop">
163
							<?=output_menu_item("/firewall_aliases.php", "Aliases");?>	
164
							<?php
165
							if($config['interfaces']['lan']) {
166
								/* no use for NAT in single-interface deployments
167
								remove to reduce user confusion
168
								*/
169
								output_menu_item("/firewall_nat.php", "NAT");	
170
							}
171
							?>
172
							<?=output_menu_item("/firewall_rules.php", "Rules");?>	
173
							<?=output_menu_item("/firewall_schedule.php", "Schedules");?>	
174
							<?php
175
							if($config['interfaces']['lan']) {
176
								/* no use for traffic shaper in single-interface
177
								  deployments
178
								remove to reduce user confusion
179
								*/
180
								output_menu_item("{$shaper}", "Traffic Shaper");
181
							}
182
							?>
183
														<?=?>	
184
							<?=output_menu_item("/firewall_virtual_ip.php", "Virtual IPs");?>	
185
							<?php echo return_ext_menu("Firewall"); ?>
186
						</ul>
187
					</li>
188
					<li class="drop">
189
						<div>Services</div>
190
						<ul class="subdrop">
191
							<?=output_menu_item("/services_captiveportal.php", "Captive Portal");?>	
192
							<?=output_menu_item("/services_dnsmasq.php", "DNS Forwarder");?>	
193
							<?=output_menu_item("/services_dhcp_relay.php", "DHCP Relay");?>	
194
							<?=output_menu_item("/services_dhcp.php", "DHCP Server");?>	
195
							<?=output_menu_item("/services_dyndns.php", "Dynamic DNS");?>
196
							<?=output_menu_item("/load_balancer_pool.php", "Load Balancer");?>	
197
							<?=output_menu_item("/pkg_edit.php?xml=olsrd.xml&id=0", "OLSR");?>	
198
							<?=output_menu_item("/vpn_pppoe.php", "PPPoE Server");?>	
199
							<?=output_menu_item("/pkg_edit.php?xml=routed/routed.xml&id=0", "RIP");?>	
200
							<?=output_menu_item("/services_snmp.php", "SNMP");?>	
201
							<?php
202
							if($config['interfaces']['lan']) {
203
								/* no use for UPnP in single-interface deployments
204
								remove to reduce user confusion
205
								*/
206
								output_menu_item("/pkg_edit.php?xml=miniupnpd.xml&id=0", "UPnP");	
207
							}
208
							?>
209
							<?=output_menu_item("/pkg_edit.php?xml=openntpd.xml&id=0", "OpenNTPD");?>	
210
							<?=output_menu_item("/services_wol.php", "Wake on LAN");?>	
211
							<?php echo return_ext_menu("Services"); ?>
212
						</ul>
213
					</li>
214
					<li class="drop">
215
						<div>VPN</div>
216
						<ul class="subdrop">
217
							<?=output_menu_item("/vpn_ipsec.php", "IPsec");?>
218
							<?=output_menu_item("/pkg.php?xml=openvpn.xml", "OpenVPN");?>
219
							<?=output_menu_item("/vpn_pptp.php", "PPTP");?>
220
							<?php echo return_ext_menu("VPN"); ?>
221
						</ul>
222
					</li>
223
					<li class="drop">
224
						<div>Status</div>
225
						<ul class="subdrop">
226
							<?php if (isset($config['captiveportal']['enable'])): ?>
227
							<?=output_menu_item("/status_captiveportal.php", "Captive Portal");?>
228
							<?php endif; ?>
229
							<?=output_menu_item("/carp_status.php", "CARP (failover)");?>
230
							<?=output_menu_item("/index.php", "Dashboard");?>
231
							<?=output_menu_item("/diag_dhcp_leases.php", "DHCP Leases");?>
232
							<?=output_menu_item("/status_filter_reload.php", "Filter Reload");?>
233
							<?=output_menu_item("/status_interfaces.php", "Interfaces");?>
234
							<?=output_menu_item("/diag_ipsec.php", "IPsec");?>
235
							<?=output_menu_item("/status_slbd_pool.php", "Load Balancer");?>
236
							<?php if($g['platform'] == "pfSense"): ?>
237
							<?=output_menu_item("/diag_pkglogs.php", "Package Logs");?>
238
							<?php endif; ?>
239
							<?=output_menu_item("/status_queues.php", "Queues");?>
240
							<?=output_menu_item("/status_rrd_graph.php", "RRD Graphs");?>
241
							<?=output_menu_item("/status_services.php", "Services");?>
242
							<?=output_menu_item("/diag_logs.php", "System Logs");?>
243
							<?=output_menu_item("/status_graph.php?if=wan", "Traffic Graph");?>
244
							<?php
245
							if($config['interfaces']['lan']) {
246
								/* no use for UPnP in single-interface deployments
247
								remove to reduce user confusion
248
								*/
249
								output_menu_item("/status_upnp.php", "UPnP");	
250
							}
251
							?>
252
							<?php $i = 0; $ifdescrs = array();
253
							if (is_array($config['interfaces']['wan']['wireless']) &&
254
								preg_match($g['wireless_regex'], $config['interfaces']['wan']['if']))
255
									$ifdescrs['wan'] = 'WAN';
256
							if (is_array($config['interfaces']['lan']['wireless']) &&
257
								preg_match($g['wireless_regex'], $config['interfaces']['lan']['if']))
258
									$ifdescrs['lan'] = 'LAN';
259
							for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
260
								if (is_array($config['interfaces']['opt' . $j]['wireless']) &&
261
									isset($config['interfaces']['opt' . $j]['enable']) &&
262
									 preg_match($g['wireless_regex'], $config['interfaces']['opt' . $j]['if']))
263
										$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
264
							}
265
							if (count($ifdescrs) > 0): ?>
266
							<?=output_menu_item("/status_wireless.php", "Wireless");?>
267
							<?php endif; ?>
268
							<?php echo return_ext_menu("Status"); ?>
269
						</ul>
270
					</li>
271
					<li class="lastdrop">
272
						<div>Diagnostics</div>
273
						<ul id="diag" class="subdrop">
274
							<?=output_menu_item("/diag_arp.php", "ARP Tables");?>
275
							<?=output_menu_item("/diag_backup.php", "Backup/Restore");?>
276
							<?=output_menu_item("/exec.php", "Command Prompt");?>
277
							<?=output_menu_item("/edit.php", "Edit File");?>
278
							<?=output_menu_item("/diag_defaults.php", "Factory Defaults");?>
279
							<?=output_menu_item("/halt.php", "Halt System");?>
280
							<?=output_menu_item("/diag_ping.php", "Ping");?>
281
							<?=output_menu_item("/reboot.php", "Reboot");?>
282
							<?=output_menu_item("/diag_routes.php", "Routes");?>
283
							<?=output_menu_item("/diag_dump_states.php", "States");?>
284
							<?=output_menu_item("/diag_traceroute.php", "Traceroute");?>
285
							<?=output_menu_item("/diag_packet_capture.php", "Packet Capture");?>
286
							<?php echo return_ext_menu("Diagnostics"); ?>
287
							<?php if(isset($config['system']['developer'])): ?>
288
							<li><hr width="80%"/></li>
289
							<?=output_menu_item("/restart_httpd.php", "Restart HTTPD");?>							
290
							<?php endif; ?>
291
						</ul>
292
					</li>
293
				</ul>
294
			</div>
295

    
296
		</div> <!-- Left DIV -->
297

    
298
		<div id="right">
299

    
300

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

    
324
	$auth_user = $HTTP_SERVER_VARS['AUTH_USER'];
325

    
326
	$groupindex = index_groups();
327
	$userindex = index_users();
328

    
329
	$allowed = array();
330
	$allowed[] = '';
331
	if (!isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER']))
332
	    if (isset($config['system']['group'][$groupindex[$config['system']['user'][$userindex[$auth_user]]['groupname']]]['pages'])) 
333
			$allowed = &$config['system']['group'][$groupindex[$config['system']['user'][$userindex[$auth_user]]['groupname']]]['pages'];
334

    
335
function output_menu_item($url, $name) {
336
	global $auth_user, $groupindex, $userindex, $allowed, $HTTP_SERVER_VARS, $allowed;
337
	if(!$allowed)
338
		$allowed = $_SESSION['privs'];	
339
	if (!isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER'])) 
340
		if (!in_array(basename($url), $allowed))	
341
			return;
342
	echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
343
}
344
	
345
?>
346

    
347
<p class="pgtitle"><?=genhtmltitle($pgtitle);?></font></p>
(37-37/187)