Project

General

Profile

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

    
262
		</div> <!-- Left DIV -->
263

    
264
		<div id="right">
265

    
266

    
267
<?php
268
	/* display a top alert bar if need be */
269
	$need_alert_display = false;
270
	$found_notices = are_notices_pending();
271
	if($found_notices == true) {
272
		$notices = get_notices();
273
		if(!$notices) {
274
			$need_alert_display = true;
275
			$display_text = print_notices() . "<br>";
276
		}
277
	}
278
	if($need_alert_display == true) {
279
                echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
280
                echo "<table>";
281
		echo "<tr><td><font color=\"#ffffff\">";
282
		echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\">&nbsp;&nbsp;&nbsp;";
283
		echo $display_text;
284
		echo "</td>";
285
		echo "</tr>";
286
		echo "</table>";
287
		echo "</div>";
288
	}
289

    
290
	$auth_user = $HTTP_SERVER_VARS['AUTH_USER'];
291

    
292
	$groupindex = index_groups();
293
	$userindex = index_users();
294

    
295
	$allowed = array();
296
	$allowed[] = '';
297
	if (!isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER']))
298
	    if (isset($config['system']['group'][$groupindex[$config['system']['user'][$userindex[$auth_user]]['groupname']]]['pages'])) 
299
			$allowed = &$config['system']['group'][$groupindex[$config['system']['user'][$userindex[$auth_user]]['groupname']]]['pages'];
300

    
301
function output_menu_item($url, $name) {
302
	global $auth_user, $groupindex, $userindex, $allowed, $HTTP_SERVER_VARS;
303
	if (!isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER'])) 
304
		if (!in_array(basename($url), $allowed))	
305
			return;
306
	echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
307
}
308
	
309
?>
310

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