Project

General

Profile

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

    
3
require_once("notices.inc");
4
/* $Id$ */
5
	function return_ext_menu($section) {
6
		global $config;
7
		$htmltext = "";
8
		if($config['installedpackages']['menu'] <> "") {
9
			foreach($config['installedpackages']['menu'] as $menuitem) {
10
				if($menuitem['section'] != $section) continue;
11
				if($menuitem['url'] <> "") {
12
				 	$addresswithport = getenv("HTTP_HOST");
13
					$colonpos = strpos($addresswithport, ":");	
14
					if ($colonpos !== False){
15
						//my url is actually just the IP address of the pfsense box
16
						$myurl = substr($addresswithport, 0, $colonpos);	
17
					}
18
					else
19
					{
20
						$myurl = $addresswithport;	
21
					}
22
					
23
					$description = str_replace('$myurl', $myurl, $menuitem['url']);
24
				} else {
25
					$description = '/pkg.php?xml=' . $menuitem['configfile'];
26
				}
27
				$htmltext .= '<li><a href="' . $description . ' "class="navlnk">' . $menuitem['name'] . '</a></li>' . "\n";
28
			}
29
		}
30
		return $htmltext;
31
	}
32

    
33

    
34

    
35

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

    
44
<div id="wrapper">
45

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

    
56
					$requests=array();
57

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

    
66
					if(is_array($notices)) {
67
						foreach ($notices as $key => $value) {
68
							$date = date("m-d-y H:i:s", $key);
69
							$noticemsg = str_replace("'", "", $value['notice']);
70
							$noticemsg = str_replace('"', "", $noticemsg);
71
							$noticemsg = str_replace("\n", "", $noticemsg);
72
							$noticemsg = str_replace("<p>", "", $noticemsg);
73
							$noticemsg = str_replace("<pre>", "", $noticemsg);
74
							$noticemsg = str_replace("</pre>", "", $noticemsg);
75
							$noticemsg = str_replace("</p>", "", $noticemsg);
76
							$noticemsg = str_replace("<br>", "", $noticemsg);
77
							$notice_msgs = '<a href="?noticeaction=acknowledge&noticeid=all">Acknowledge All</a> &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ';
78
							if ($value['url']) {
79
								$notice_msgs .= $date.' - <a href="'.$url.'?'.$request_string.'&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']</a>';
80
							} else {
81
								$notice_msgs .= $date.' - <a href="?'.$request_string.'&noticeaction=acknowledge&noticeid='.$key.'">['.$value['id'].']'.$noticemsg.'</a>';
82
							}
83
							$notice_msgs .= " &nbsp;&nbsp;&nbsp;&nbsp;.:.&nbsp;&nbsp;&nbsp;&nbsp; ";
84
						}
85
					}
86
?>
87
					<div id="alerts">
88
						<script type="text/javascript">
89
							var content='<div id="marquee-text"><?= $notice_msgs; ?></div>'
90
						</script>
91
						<script type="text/javascript" src="/ticker.js"></script>
92
					</div>
93
<?
94
				} else {
95
?>
96
					<div id="hostname">
97
						<? print $config['system']['hostname'] . "." . $config['system']['domain']; ?>
98
					</div>
99
<?
100
				}
101
?>
102
				</div>
103
			</div>
104
		</div>
105
	</div> <!-- Header DIV -->
106
	<div id="content">
107
		<div id="left">
108
			<div id="navigation">
109
				<ul id="menu">
110
					<li class="firstdrop">
111
						<div>System</div>
112
						<ul class="subdrop">
113
							<li><a href="/system_advanced.php" class="navlnk">Advanced</a></li>
114
							<li><a href="/system_firmware.php" class="navlnk">Firmware</a></li>
115
							<li><a href="/system.php" class="navlnk">General Setup</a></li>
116
						<?php if($g['platform'] == "pfSense"): ?>
117
							<li><a href="/pkg_mgr.php" class="navlnk">Packages</a></li>
118
						<?php endif; ?>
119
							<li><a href="/wizard.php?xml=setup_wizard.xml" class="navlnk">Setup wizard</a></li>
120
							<li><a href="/system_routes.php" class="navlnk">Static routes</a></li>
121
						</ul>
122
					</li>
123
					<li class="drop">
124
						<div>Interfaces</div>
125
						<ul class="subdrop">
126
							<?php if (!isset($config['system']['webgui']['noassigninterfaces'])): ?><li><a href="/interfaces_assign.php" class="navlnks">(assign)</a></li><?php endif; ?>
127
							<li><a href="/interfaces_wan.php" class="navlnk">WAN</a></li>
128
							<li><a href="/interfaces_lan.php" class="navlnk">LAN</a></li>
129
							<?php for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): if (!isset($config['interfaces']['opt' . $i]['ovpn'])): ?>
130
							<li><a href="/interfaces_opt.php?index=<?=$i;?>" class="navlnk"><?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?></a></li>
131
							<?php endif; endfor; ?>
132
							<?php echo return_ext_menu("Interfaces"); ?>
133
						</ul>
134
					</li>
135
					<li class="drop">
136
						<div>Firewall</div>
137
						<ul class="subdrop">
138
							<li><a href="/firewall_aliases.php" class="navlnk">Aliases</a></li>
139
							<li><a href="/firewall_nat.php" class="navlnk">NAT</a></li>
140
							<li><a href="/firewall_rules.php" class="navlnk">Rules</a></li>
141
							<li><a href="/firewall_shaper.php" class="navlnk">Traffic Shaper</a></li>
142
							<li><a href="/firewall_virtual_ip.php" class="navlnk">Virtual IPs</a></li>
143
							<?php echo return_ext_menu("Firewall"); ?>
144
						</ul>
145
					</li>
146
					<li class="drop">
147
						<div>Services</div>
148
						<ul class="subdrop">
149
							<li><a href="/services_captiveportal.php" class="navlnk">Captive portal</a></li>
150
							<li><a href="/services_dnsmasq.php" class="navlnk">DNS forwarder</a></li>
151
							<li><a href="/services_dhcp_relay.php" class="navlnk">DHCP relay</a></li>
152
							<li><a href="/services_dhcp.php" class="navlnk">DHCP server</a></li>
153
							<li><a href="/services_dyndns.php" class="navlnk">Dynamic DNS</a></li>
154
							<li><a href="/load_balancer_pool.php" class="navlnk">Load Balancer</a></li>
155
							<li><a href="/pkg_edit.php?xml=olsrd.xml&id=0" class="navlnk">OLSR</a></li>
156
							<li><a href="/services_snmp.php" class="navlnk">SNMP</a></li>
157
							<li><a href="/status_upnp.php" class="navlnk">MiniUPnPd</a></li>
158
							<li><a href="/services_wol.php" class="navlnk">Wake on LAN</a></li>
159
							<?php echo return_ext_menu("Services"); ?>
160
						</ul>
161
					</li>
162
					<li class="drop">
163
						<div>VPN</div>
164
						<ul class="subdrop">
165
							<li><a href="/vpn_ipsec.php" class="navlnk">IPsec</a></li>
166
							<li><a href="/pkg.php?xml=openvpn.xml" class="navlnk">OpenVPN</a></li>
167
							<li><a href="/vpn_pppoe.php" class="navlnk">PPPoE</a></li>
168
							<li><a href="/vpn_pptp.php" class="navlnk">PPTP</a></li>
169
							<?php echo return_ext_menu("VPN"); ?>
170
						</ul>
171
					</li>
172
					<li class="drop">
173
						<div>Status</div>
174
						<ul class="subdrop">
175
							<?php if (isset($config['captiveportal']['enable'])): ?>
176
							<li><a href="/status_captiveportal.php" class="navlnk">Captive portal</a></li>
177
							<?php endif; ?>
178
							<li><a href="/carp_status.php" class="navlnk">CARP (failover)</a></li>
179
							<li><a href="/diag_dhcp_leases.php" class="navlnk">DHCP leases</a></li>
180
							<li><a href="/status_filter_reload.php" class="navlnk">Filter Reload Status</a></li>
181
							<li><a href="/status_interfaces.php" class="navlnk">Interfaces</a></li>
182
							<li><a href="/diag_ipsec_sad.php" class="navlnk">IPsec</a></li>
183
							<li><a href="/status_slbd_pool.php" class="navlnk">Load Balancer</a></li>
184
							<?php if($g['platform'] == "pfSense"): ?>
185
							<li><a href="/diag_pkglogs.php" class="navlnk">Package logs</a></li>
186
							<?php endif; ?>
187
							<li><a href="/status_queues.php" class="navlnk">Queues</a></li>
188
							<li><a href="/status_rrd_graph.php?if=wan" class="navlnk">RRD Graphs</a></li>
189
							<li><a href="/status_services.php" class="navlnk">Services</a></li>
190
							<li><a href="/index.php" class="navlnk">System</a></li>
191
							<li><a href="/diag_logs.php" class="navlnk">System logs</a></li>
192
							<li><a href="/status_graph.php?if=wan" class="navlnk">Traffic graph</a></li>
193
							<?php $i = 0; $ifdescrs = array();
194
							if (is_array($config['interfaces']['wan']['wireless']) &&
195
								preg_match($g['wireless_regex'], $config['interfaces']['wan']['if']))
196
									$ifdescrs['wan'] = 'WAN';
197
							if (is_array($config['interfaces']['lan']['wireless']) &&
198
								preg_match($g['wireless_regex'], $config['interfaces']['lan']['if']))
199
									$ifdescrs['lan'] = 'LAN';
200
							for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
201
								if (is_array($config['interfaces']['opt' . $j]['wireless']) &&
202
									isset($config['interfaces']['opt' . $j]['enable']) &&
203
									 preg_match($g['wireless_regex'], $config['interfaces']['opt' . $j]['if']))
204
										$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
205
							}
206
							if (count($ifdescrs) > 0): ?>
207
							<li><a href="/status_wireless.php" class="navlnk">Wireless</a></li>
208
							<?php endif; ?>
209
							<?php echo return_ext_menu("Status"); ?>
210
						</ul>
211
					</li>
212
					<li class="lastdrop">
213
						<div>Diagnostics</div>
214
						<ul id="diag" class="subdrop">
215
							<li><a href="/diag_arp.php" class="navlnk">ARP Tables</a></li>
216
							<li><a href="/diag_backup.php" class="navlnk">Backup/Restore</a></li>
217
							<li><a href="/exec.php" class="navlnk">Command Prompt</a></li>
218
							<li><a href="/edit.php" class="navlnk">Edit File</a></li>
219
							<li><a href="/diag_defaults.php" class="navlnk">Factory defaults </a></li>
220
							<li><a href="/halt.php" class="navlnk">Halt system</a></li>
221
							<li><a href="/diag_ping.php" class="navlnk">Ping</a></li>
222
							<li><a href="/reboot.php" class="navlnk">Reboot system</a></li>
223
							<li><a href="/diag_routes.php" class="navlnk">Routes</a></li>
224
							<li><a href="/diag_dump_states.php" class="navlnk">States</a></li>
225
							<li><a href="/diag_traceroute.php" class="navlnk">Traceroute</a></li>
226
							<li><a href="/diag_packet_capture.php" class="navlnk">Packet Capture</a></li>
227
							<?php echo return_ext_menu("Diagnostics"); ?>
228
							<?php if(isset($config['system']['developer'])): ?>
229
							<li><hr width="80%"/></li>
230
							<li><a href="/restart_httpd.php" class="navlnk">Restart HTTPD</a></li>
231
							<?php endif; ?>
232
						</ul>
233
					</li>
234
				</ul>
235
			</div>
236

    
237
		</div> <!-- Left DIV -->
238

    
239
		<div id="right">
240

    
241

    
242
<?php
243
	/* display a top alert bar if need be */
244
	$need_alert_display = false;
245
	$found_notices = are_notices_pending();
246
	if($found_notices == true) {
247
		$notices = get_notices();
248
		if(!$notices) {
249
			$need_alert_display = true;
250
			$display_text = print_notices() . "<br>";
251
		}
252
	}
253
	if($need_alert_display == true) {
254
                echo "<div style=\"background-color:#000000\" id=\"roundalert\">";
255
                echo "<table>";
256
		echo "<tr><td><font color=\"#ffffff\">";
257
		echo "&nbsp;&nbsp;<img align=\"middle\" src=\"/top_notification.gif\">&nbsp;&nbsp;&nbsp;";
258
		echo $display_text;
259
		echo "</td>";
260
		echo "</tr>";
261
		echo "</table>";
262
		echo "</div>";
263
	}
264

    
265
?>
(36-36/167)