Project

General

Profile

Download (12.9 KB) Statistics
| Branch: | Tag: | Revision:
1 c6c150e9 Scott Ullrich
<?php
2 f0394bbb Scott Ullrich
3 b8f82cd7 Scott Ullrich
require_once("functions.inc");
4 b46bfcf5 Bill Marquette
/* $Id$ */
5 e86a8e57 Scott Ullrich
6 e93441e0 Scott Ullrich
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 90e3bbc0 Colin Smith
				}
23 e93441e0 Scott Ullrich
24
				$description = str_replace('$myurl', $myurl, $menuitem['url']);
25
			} else {
26
				$description = '/pkg.php?xml=' . $menuitem['configfile'];
27 c6c150e9 Scott Ullrich
			}
28 e93441e0 Scott Ullrich
			$htmltext .= '<li><a href="' . $description . ' "class="navlnk">' . $menuitem['name'] . '</a></li>' . "\n";
29 c6c150e9 Scott Ullrich
		}
30
	}
31 e93441e0 Scott Ullrich
	return $htmltext;
32
}
33 65384707 Erik Kristensen
34 e93441e0 Scott Ullrich
/* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */
35
if ($_REQUEST['noticeaction'] == 'acknowledge') {
36
	$notice_id = $_REQUEST['noticeid'];
37
	close_notice($notice_id);
38
}
39
/**********************************************/
40 65384707 Erik Kristensen
41 c6c150e9 Scott Ullrich
?>
42 12a00813 Erik Kristensen
43 9f53d3a8 Scott Ullrich
<div id="wrapper">
44
45
	<div id="header">
46 de115edf Scott Ullrich
		<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 9f53d3a8 Scott Ullrich
		<div id="header-right">
48 1df0159c Erik Kristensen
			<div class="container">
49
				<div class="left">webConfigurator</div>
50
				<div class="right">
51 64fcbfc8 Erik Kristensen
<?
52 b1cbbf24 Erik Kristensen
				if (are_notices_pending()) {
53
					$notices = get_notices();
54 dca32536 Scott Ullrich
55 a2046789 Scott Ullrich
					$requests=array();
56 dca32536 Scott Ullrich
57 a6fac06e Erik Kristensen
					## Get Query Arguments from URL ###
58
					foreach ($_REQUEST as $key => $value) {
59
						if ($key != "PHPSESSID")
60
							$requests[] = $key.'='.$value;
61
					}
62 a2046789 Scott Ullrich
					if(is_array($requests))
63
						$request_string = implode("&", $requests);
64 a6fac06e Erik Kristensen
65 35eef977 Scott Ullrich
					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 91d3d442 Scott Ullrich
							$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 35eef977 Scott Ullrich
							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 b1cbbf24 Erik Kristensen
						}
93
					}
94 64fcbfc8 Erik Kristensen
?>
95 b1cbbf24 Erik Kristensen
					<div id="alerts">
96
						<script type="text/javascript">
97
							var content='<div id="marquee-text"><?= $notice_msgs; ?></div>'
98
						</script>
99 dca32536 Scott Ullrich
						<script type="text/javascript" src="/ticker.js"></script>
100 b1cbbf24 Erik Kristensen
					</div>
101
<?
102
				} else {
103 612832ec Erik Kristensen
?>
104
					<div id="hostname">
105
						<? print $config['system']['hostname'] . "." . $config['system']['domain']; ?>
106
					</div>
107
<?
108 b1cbbf24 Erik Kristensen
				}
109
?>
110 1df0159c Erik Kristensen
				</div>
111
			</div>
112 9f53d3a8 Scott Ullrich
		</div>
113
	</div> <!-- Header DIV -->
114
	<div id="content">
115
		<div id="left">
116 2779b49b Scott Dale
			<div id="navigation" style="z-index:1000">
117 41058a8c Erik Kristensen
				<ul id="menu">
118 d86286ed Erik Kristensen
					<li class="firstdrop">
119 9f53d3a8 Scott Ullrich
						<div>System</div>
120 d86286ed Erik Kristensen
						<ul class="subdrop">
121 b8f82cd7 Scott Ullrich
							<?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 65bad23b Scott Ullrich
						<?php if($g['platform'] == "pfSense"): ?>
128 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/pkg_mgr.php", "Packages");?>	
129 0831bc86 Scott Ullrich
						<?php endif; ?>
130 b8f82cd7 Scott Ullrich
							<?=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 9f53d3a8 Scott Ullrich
						</ul>
135
					</li>
136 d86286ed Erik Kristensen
					<li class="drop">
137
						<div>Interfaces</div>
138
						<ul class="subdrop">
139 b8f82cd7 Scott Ullrich
							<?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 cfa78e39 Chris Buechler
							<?php
144
							if($config['interfaces']['lan']) {
145
								output_menu_item("/interfaces_lan.php", "LAN");
146
							}
147
							?>
148 9f53d3a8 Scott Ullrich
							<?php for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): if (!isset($config['interfaces']['opt' . $i]['ovpn'])): ?>
149 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/interfaces_opt.php?index={$i}", htmlspecialchars($config['interfaces']['opt' . $i]['descr']))?>
150 9f53d3a8 Scott Ullrich
							<?php endif; endfor; ?>
151 dca32536 Scott Ullrich
							<?php echo return_ext_menu("Interfaces"); ?>
152 9f53d3a8 Scott Ullrich
						</ul>
153
					</li>
154 81a6f5ea Scott Ullrich
<?php
155
        if($config['system']['shapertype'] <> "m0n0")
156
          $shaper = "firewall_shaper.php";
157
        else
158
          $shaper = "m0n0/firewall_shaper.php";
159
?>
160 d86286ed Erik Kristensen
					<li class="drop">
161 9f53d3a8 Scott Ullrich
						<div>Firewall</div>
162 d86286ed Erik Kristensen
						<ul class="subdrop">
163 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/firewall_aliases.php", "Aliases");?>	
164 74e44a2e Chris Buechler
							<?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 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/firewall_rules.php", "Rules");?>	
173
							<?=output_menu_item("/firewall_schedule.php", "Schedules");?>	
174 f97e2dab Chris Buechler
							<?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 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/firewall_virtual_ip.php", "Virtual IPs");?>	
185 9f53d3a8 Scott Ullrich
							<?php echo return_ext_menu("Firewall"); ?>
186
						</ul>
187
					</li>
188 d86286ed Erik Kristensen
					<li class="drop">
189 9f53d3a8 Scott Ullrich
						<div>Services</div>
190 d86286ed Erik Kristensen
						<ul class="subdrop">
191 b8f82cd7 Scott Ullrich
							<?=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 f97e2dab Chris Buechler
							<?=output_menu_item("/services_dyndns.php", "Dynamic DNS");?>
196 b8f82cd7 Scott Ullrich
							<?=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 f97e2dab Chris Buechler
							<?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 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/pkg_edit.php?xml=openntpd.xml&id=0", "OpenNTPD");?>	
210
							<?=output_menu_item("/services_wol.php", "Wake on LAN");?>	
211 9f53d3a8 Scott Ullrich
							<?php echo return_ext_menu("Services"); ?>
212
						</ul>
213
					</li>
214 d86286ed Erik Kristensen
					<li class="drop">
215 9f53d3a8 Scott Ullrich
						<div>VPN</div>
216 d86286ed Erik Kristensen
						<ul class="subdrop">
217 348327b7 Chris Buechler
							<?=output_menu_item("/vpn_ipsec.php", "IPsec");?>
218 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/pkg.php?xml=openvpn.xml", "OpenVPN");?>
219
							<?=output_menu_item("/vpn_pptp.php", "PPTP");?>
220 9f53d3a8 Scott Ullrich
							<?php echo return_ext_menu("VPN"); ?>
221
						</ul>
222
					</li>
223 d86286ed Erik Kristensen
					<li class="drop">
224 9f53d3a8 Scott Ullrich
						<div>Status</div>
225 d86286ed Erik Kristensen
						<ul class="subdrop">
226 9f53d3a8 Scott Ullrich
							<?php if (isset($config['captiveportal']['enable'])): ?>
227 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/status_captiveportal.php", "Captive Portal");?>
228 9f53d3a8 Scott Ullrich
							<?php endif; ?>
229 b8f82cd7 Scott Ullrich
							<?=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 348327b7 Chris Buechler
							<?=output_menu_item("/diag_ipsec.php", "IPsec");?>
235 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/status_slbd_pool.php", "Load Balancer");?>
236 50ff5462 Scott Ullrich
							<?php if($g['platform'] == "pfSense"): ?>
237 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/diag_pkglogs.php", "Package Logs");?>
238 0831bc86 Scott Ullrich
							<?php endif; ?>
239 b8f82cd7 Scott Ullrich
							<?=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 cc908f39 Chris Buechler
							<?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 9f53d3a8 Scott Ullrich
							<?php $i = 0; $ifdescrs = array();
253
							if (is_array($config['interfaces']['wan']['wireless']) &&
254 187be289 Scott Ullrich
								preg_match($g['wireless_regex'], $config['interfaces']['wan']['if']))
255 dca32536 Scott Ullrich
									$ifdescrs['wan'] = 'WAN';
256 9f53d3a8 Scott Ullrich
							if (is_array($config['interfaces']['lan']['wireless']) &&
257 4776ee17 Scott Ullrich
								preg_match($g['wireless_regex'], $config['interfaces']['lan']['if']))
258 9f53d3a8 Scott Ullrich
									$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 4776ee17 Scott Ullrich
									 preg_match($g['wireless_regex'], $config['interfaces']['opt' . $j]['if']))
263
										$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
264 9f53d3a8 Scott Ullrich
							}
265 dca32536 Scott Ullrich
							if (count($ifdescrs) > 0): ?>
266 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/status_wireless.php", "Wireless");?>
267 9f53d3a8 Scott Ullrich
							<?php endif; ?>
268 dca32536 Scott Ullrich
							<?php echo return_ext_menu("Status"); ?>
269 9f53d3a8 Scott Ullrich
						</ul>
270
					</li>
271 d86286ed Erik Kristensen
					<li class="lastdrop">
272 9f53d3a8 Scott Ullrich
						<div>Diagnostics</div>
273 d86286ed Erik Kristensen
						<ul id="diag" class="subdrop">
274 b8f82cd7 Scott Ullrich
							<?=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 9f53d3a8 Scott Ullrich
							<?php echo return_ext_menu("Diagnostics"); ?>
287 3a078222 Erik Kristensen
							<?php if(isset($config['system']['developer'])): ?>
288
							<li><hr width="80%"/></li>
289 b8f82cd7 Scott Ullrich
							<?=output_menu_item("/restart_httpd.php", "Restart HTTPD");?>							
290 0831bc86 Scott Ullrich
							<?php endif; ?>
291 9f53d3a8 Scott Ullrich
						</ul>
292
					</li>
293
				</ul>
294
			</div>
295 dca32536 Scott Ullrich
296 9f53d3a8 Scott Ullrich
		</div> <!-- Left DIV -->
297 dca32536 Scott Ullrich
298 9f53d3a8 Scott Ullrich
		<div id="right">
299 dca32536 Scott Ullrich
300 5c9cc1de Scott Ullrich
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 e444cd01 Scott Ullrich
			$display_text = print_notices() . "<br>";
310 dca32536 Scott Ullrich
		}
311 5c9cc1de Scott Ullrich
	}
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 b8f82cd7 Scott Ullrich
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 c8823c18 Scott Ullrich
	global $auth_user, $groupindex, $userindex, $allowed, $HTTP_SERVER_VARS, $allowed;
337
	if(!$allowed)
338
		$allowed = $_SESSION['privs'];	
339 b8f82cd7 Scott Ullrich
	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 19b331c1 Scott Ullrich
	
345
?>
346 dca32536 Scott Ullrich
347 19b331c1 Scott Ullrich
<p class="pgtitle"><?=genhtmltitle($pgtitle);?></font></p>