fbegin.inc 21.1 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
	Copyright (C) 2014 Deciso B.V.
	Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
	All rights reserved.

	Redistribution and use in source and binary forms, with or without
	modification, are permitted provided that the following conditions are met:

	1. Redistributions of source code must retain the above copyright notice,
	   this list of conditions and the following disclaimer.

	2. Redistributions in binary form must reproduce the above copyright
	   notice, this list of conditions and the following disclaimer in the
	   documentation and/or other materials provided with the distribution.

	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
Ad Schellevis's avatar
Ad Schellevis committed
28 29 30
*/

require_once("globals.inc");
31
require_once("functions.inc");
Ad Schellevis's avatar
Ad Schellevis committed
32
require_once("shortcuts.inc");
33
require_once("service-utils.inc");
Ad Schellevis's avatar
Ad Schellevis committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

/* Determine automated help URL. Should output the page name and
   parameters separately */
$uri_split = "";
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);

/* If there was no match, there were no parameters, just grab the filename
   Otherwise, use the matched filename from above. */
if (empty($uri_split[0])) {
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
} else {
	$pagename = $uri_split[1];
}
/* If the page name is still empty, the user must have requested / (index.php) */
if (empty($pagename)) {
	$pagename = "index.php";
}

/* If the filename is pkg_edit.php or wizard.php, reparse looking
	for the .xml filename */
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
	$param_split = explode('&', $uri_split[2]);
	foreach ($param_split as $param) {
		if (substr($param, 0, 4) == "xml=") {
			$xmlfile = explode('=', $param);
			$pagename = $xmlfile[1];
		}
	}
}

/* Build the full help URL. */
$helpurl .= "{$g['help_base_url']}?page={$pagename}";

function return_ext_menu($section) {
	global $config;
	$htmltext = "";
	$extarray = array();
	if($config['installedpackages']['menu'] <> "") {
		foreach($config['installedpackages']['menu'] as $menuitem) {
			if($menuitem['section'] != $section) continue;
			if($menuitem['url'] <> "") {
				$test_url=$menuitem['url'];
76
				$addresswithport = getenv("HTTP_HOST");
Ad Schellevis's avatar
Ad Schellevis committed
77 78
				$colonpos = strpos($addresswithport, ":");
				if ($colonpos !== False){
79
					//my url is actually just the IP address of the OPNsense box
Ad Schellevis's avatar
Ad Schellevis committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
					$myurl = substr($addresswithport, 0, $colonpos);
				} else {
					$myurl = $addresswithport;
				}
				$description = str_replace('$myurl', $myurl, $menuitem['url']);
			} else {
				$description = '/pkg.php?xml=' . $menuitem['configfile'];
				$test_url=$description;
			}
			 if(isAllowedPage($test_url)){
				$extarray[] = array($menuitem['name'], $description);
			 }
		}
	}
	return $extarray;
}

function output_menu($arrayitem, $target = null) {
	foreach ($arrayitem as $item) {
99
		if (isAllowedPage($item[1]) || $item[1]=="/index.php?logout") {
100 101


Ad Schellevis's avatar
Ad Schellevis committed
102 103 104 105
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
			if ($target) {
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
			}
106
			$class = "list-group-item";
107 108


Jos Schellevis's avatar
Jos Schellevis committed
109
			$check = substr($item[1],1,-3);
Ad Schellevis's avatar
Ad Schellevis committed
110
			if (stripos($_SERVER['PHP_SELF'], $check) !== false) {
111 112
				$class .= " active";
			}
113

Ad Schellevis's avatar
Ad Schellevis committed
114 115 116 117 118 119 120
			if ($item['class']) {
				$class .= " {$item['class']}";
			}
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
			if ($item['style']) {
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
			}
121
			//echo "<li>\n";
Ad Schellevis's avatar
Ad Schellevis committed
122
			printf("<a %s>%s</a>\n", $attr, $item[0]);
123
			//echo "</li>\n";
Ad Schellevis's avatar
Ad Schellevis committed
124 125 126 127
		}
	}
}

128 129

function active_menu($arrayitem, $pagename) {
Ad Schellevis's avatar
Ad Schellevis committed
130
	$pagename = "/".ltrim($pagename,"/");
131

132
	foreach ($arrayitem as $item) {
Jos Schellevis's avatar
Jos Schellevis committed
133
		$check = substr($item[1],1,-3);
134

Ad Schellevis's avatar
Ad Schellevis committed
135
		if (stripos($pagename, $check) !== false) {
136
			return true;
137
		}
138
	}
139

140 141 142
	return false;
}

Ad Schellevis's avatar
Ad Schellevis committed
143 144
function active_main_menu() {
	$options = func_get_args();
145

Ad Schellevis's avatar
Ad Schellevis committed
146 147 148 149 150
	foreach ($options as $uri) {
		if (substr($_SERVER['PHP_SELF'], 0, strlen($uri)) == $uri) {
			return true;
		}
	}
151

Ad Schellevis's avatar
Ad Schellevis committed
152 153 154
	return false;
}

155

Ad Schellevis's avatar
Ad Schellevis committed
156 157 158
// System
$system_menu = array();
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
159
$system_menu[] = array(gettext("Firmware"), "/system_firmware_check.php");
Ad Schellevis's avatar
Ad Schellevis committed
160
$system_menu[] = array(gettext("General Setup"), "/system_general.php");
Ad Schellevis's avatar
Ad Schellevis committed
161
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
162 163
//if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd")
//	$system_menu[] = array(gettext("Packages"), "/system_pkg_mgr_installed.php");
Ad Schellevis's avatar
Ad Schellevis committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
$system_menu[] = array(gettext("Cert Manager"), "/system_camanager.php");
if (!isAllowedPage("system_usermanager.php*"))
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
else
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")),0);

// Interfaces
$interfaces_menu = array();
if (!isset($config['system']['webgui']['noassigninterfaces']))
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
$opts = get_configured_interface_with_descr(false, true);
foreach ($opts as $oif => $odescr)
	if (!isset($config['interfaces'][$oif]['ovpn']))
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")),0);

// Firewall
$firewall_menu = array();
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")),0);

// Services
$services_menu = array();
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
if($g['services_dhcp_server_enable']) {
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
	$services_menu[] = array(gettext("DHCPv6 Server/RA"), "/services_dhcpv6.php");
}
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
$services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php");
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
Ad Schellevis's avatar
Ad Schellevis committed
208
$services_menu[] = array(gettext("PPPoE Server"), "/services_vpn_pppoe.php");
Ad Schellevis's avatar
Ad Schellevis committed
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
if(count($config['interfaces']) > 1) {
	/* no use for UPnP in single-interface deployments
	remove to reduce user confusion
	*/
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
}
$services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php");
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")),0);

// VPN
$vpn_menu = array();
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0);

// Status
$status_menu = array();
Jos Schellevis's avatar
Jos Schellevis committed
229
//if (count($config['captiveportal']) > 0)
Ad Schellevis's avatar
Ad Schellevis committed
230 231 232 233 234 235 236 237 238 239 240
	$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
$status_menu[] = array(gettext("CARP (failover)"), "/carp_status.php");
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
$status_menu[] = array(gettext("IPsec"), "/diag_ipsec.php");
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
241 242
//if ($g['platform'] == "pfSense")
//	$status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php"); // Remove currently unused feature
Ad Schellevis's avatar
Ad Schellevis committed
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
$status_menu[] = array(gettext("Services"), "/status_services.php");
$status_menu[] = array(gettext("System Logs"), "/diag_logs.php");
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
if(count($config['interfaces']) > 1)
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
$ifentries = get_configured_interface_with_descr();
foreach ($ifentries as $ent => $entdesc) {
	if (is_array($config['interfaces'][$ent]['wireless']) &&
		preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if']))
		$wifdescrs[$ent] = $entdesc;
}
if (count($wifdescrs) > 0)
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")),0);

// Diagnostics
$diagnostics_menu = array();
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
$diagnostics_menu[] = array(gettext("Backup/Restore"), "/diag_backup.php");
265
$diagnostics_menu[] = array(gettext("Crash Reporter"), "/crash_reporter.php");
Ad Schellevis's avatar
Ad Schellevis committed
266
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
267
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php" );
Ad Schellevis's avatar
Ad Schellevis committed
268
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
Ad Schellevis's avatar
Ad Schellevis committed
269
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php" );
Ad Schellevis's avatar
Ad Schellevis committed
270 271 272
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php" );
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
273
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
Ad Schellevis's avatar
Ad Schellevis committed
274
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
275 276
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
Ad Schellevis's avatar
Ad Schellevis committed
277
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
278 279 280 281
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php" );;
Ad Schellevis's avatar
Ad Schellevis committed
282 283
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
284 285 286 287 288 289 290
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");


if(file_exists("/var/run/gmirror_active"))
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php" );


Ad Schellevis's avatar
Ad Schellevis committed
291 292 293 294 295 296 297 298 299
if($g['platform'] == "nanobsd")
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");

if (isset($config['system']['developer'])) {
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");

}
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0);

300 301 302 303 304 305 306 307 308
$help_menu = array();
$help_menu[] = array(gettext("About this Page"), $helpurl);
$help_menu[] = array(gettext("Bug Database"), "https://github.com/opnsense/core/issues");
$help_menu[] = array(gettext("User Forum"), "https://forum.opnsense.org/");
$help_menu[] = array(gettext("Documentation"), "https://wiki.opnsense.org/");
$help_menu[] = array(gettext("Developers Wiki"), "https://wiki.opnsense.org/index.php/Develop:Info");
$help_menu[] = array(gettext("Paid Support"), "https://opnsense.org/support-overview/commercial-support/");
$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.freebsd.org/doc/handbook/");
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")),0);
Ad Schellevis's avatar
Ad Schellevis committed
309

310 311 312 313
function add_to_menu($url, $name) {
	if (isAllowedPage($url))
		echo "<a href=\"{$url}\" class=\"list-group-item\">{$name}</a>\n";
}
Ad Schellevis's avatar
Ad Schellevis committed
314 315


316 317 318 319 320 321 322 323
/* display a top alert bar if need be */
$need_alert_display = false;
$found_notices = are_notices_pending();
if($found_notices == true) {
	$notices = get_notices();
	if(!$notices) {
		$need_alert_display = true;
		$display_text = print_notices($notices) . "<br />";
Ad Schellevis's avatar
Ad Schellevis committed
324 325
	}
}
326
if($need_alert_display == true) {
Ad Schellevis's avatar
Ad Schellevis committed
327
    echo "<div class=\"col-xs-12\"><div class=\"alert alert-info\"><p>".$display_text."</p></div></div>";
Ad Schellevis's avatar
Ad Schellevis committed
328 329 330 331 332 333 334 335 336
}

/* if upgrade in progress, alert user */
if(is_subsystem_dirty('packagelock')) {
	$pgtitle = array(gettext("System"),gettext("Package Manager"));
	print_info_box(gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.") . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='firmware update' />");
}
	$pgtitle_output = true;
?>
337 338 339


<header class="page-head">
340

341
	<nav class="navbar navbar-default" role="navigation">
342

343 344
		<div class="container-fluid">
			<div class="navbar-header">
Ad Schellevis's avatar
Ad Schellevis committed
345
				<a class="navbar-brand" href="/">
346 347
				<img class="brand-logo" src="/themes/<?=$g['theme'];?>/assets/images/default-logo.png" height="30" width="150"/>
				<img class="brand-icon" src="/themes/<?=$g['theme'];?>/assets/images/icon-logo.png" height="30" width="29"/>
Ad Schellevis's avatar
Ad Schellevis committed
348
				</a>
349 350 351 352 353 354 355
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navigation">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
			</div>
356 357 358

			<div class="collapse navbar-collapse">
				<ul class="nav navbar-nav navbar-right">
Ad Schellevis's avatar
Ad Schellevis committed
359 360 361 362 363
					<li id="menu_messages">
					<?php
						echo get_menu_messages();
					?>
					</li>
364
					<?php
365 366


367 368 369
						echo '<li>'.get_shortcut_main_link($shortcut_section, false).'</li>';
						echo '<li>'.get_shortcut_status_link($shortcut_section, false).'</li>';
						echo '<li>'.get_shortcut_log_link($shortcut_section, false).'</li>';
370

371
					?>
Ad Schellevis's avatar
Ad Schellevis committed
372
					<li><a href="<?php echo $helpurl; ?>" target="_blank" title="<?php echo gettext("Help for items on this page"); ?>">Help</a></li>
Ad Schellevis's avatar
Ad Schellevis committed
373
					<li class="active"><a href="/index.php?logout">Logout</a></li>
374
				</ul>
375

376 377 378
			</div>
		</div>
	</nav>
379

380 381 382 383 384
</header>

<main class="page-content col-sm-10 col-sm-push-2 ">

	<aside id="navigation" class="page-side col-xs-12 col-sm-2 hidden-xs">
385

386 387
		<div class="row">
				<nav class="page-side-nav" role="navigation">
388

389
					<div class="list-group" id="mainmenu">
390

Ad Schellevis's avatar
Ad Schellevis committed
391
						<?php $active = active_main_menu("/system"); ?>
392
						<a href="#system" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-dashboard __iconspacer"></span><?php echo gettext("System"); ?></a>
393

394 395 396 397 398
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="system">
							<?php
								output_menu($system_menu);
							?>
						</div>
399

Ad Schellevis's avatar
Ad Schellevis committed
400
						<?php $active = active_main_menu("/interface"); ?>
401
						<a href="#interfaces" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-wrench __iconspacer"></span><?php echo gettext("Interfaces"); ?></a>
402

403 404 405 406 407
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="interfaces">
							<?php
								output_menu($interfaces_menu);
							?>
						</div>
408

Ad Schellevis's avatar
Ad Schellevis committed
409
						<?php $active = active_main_menu("/firewall"); ?>
410
						<a href="#firewall" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-fire __iconspacer"></span><?php echo gettext("Firewall"); ?></a>
411

412 413 414 415 416
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="firewall">
							<?php
								output_menu($firewall_menu);
							?>
						</div>
417

418
						<?php $active = active_main_menu("/service", "/load_balancer", "/pkg_edit"); ?>
419
						<a href="#services" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-cog __iconspacer"></span><?php echo gettext("Services"); ?></a>
420

421 422 423 424 425
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="services">
							<?php
								output_menu($services_menu);
							?>
						</div>
426

Ad Schellevis's avatar
Ad Schellevis committed
427
						<?php $active = active_main_menu("/vpn"); ?>
428
						<a href="#vpn" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-lock __iconspacer"></span><?php echo gettext("VPN"); ?></a>
429

430 431 432 433 434
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="vpn">
							<?php
								output_menu($vpn_menu);
							?>
						</div>
435

436
						<?php $active = active_main_menu("/status", "/carp_status", "/diag_ipsec", "/diag_logs"); ?>
437
						<a href="#statusmenu" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-tasks __iconspacer"></span><?php echo gettext("Status"); ?></a>
438

439
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="statusmenu">
440 441 442 443
							<?php
								output_menu($status_menu);
							?>
						</div>
444

445
						<?php $active = active_main_menu("/diag", "/crash_reporter"); ?>
446
						<a href="#diagnostics" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-stats __iconspacer"></span><?php echo gettext("Diagnostics"); ?></a>
447

448 449 450 451 452
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="diagnostics">
							<?php
								output_menu($diagnostics_menu);
							?>
						</div>
453

Ad Schellevis's avatar
Ad Schellevis committed
454
						<?php $active = active_main_menu("/help"); ?>
455
						<a href="#help" class="list-group-item <?php if ($active):?>active-menu-title<? endif; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="glyphicon glyphicon-question-sign __iconspacer"></span><?php echo gettext("Help"); ?></a>
456

457 458 459 460 461 462
						<div class="collapse <?php if ($active):?>active-menu in<? endif; ?>" id="help">
							<?php
								output_menu($help_menu, "_blank");
							?>
						</div>
					</div>
463

464
			</nav>
465

466
		</div>
467

468
	</aside>
469

470
	<div class="row">
471

472 473
		<header class="page-content-head">
			<div class="container-fluid">
Ad Schellevis's avatar
Ad Schellevis committed
474
			    <form action="<?=$_SERVER['REQUEST_URI'];?>" method="post">
475 476
				<ul class="list-inline">
					<li class="__mb"><h1><?=genhtmltitle($pgtitle);?></h1></li>
477

478
					<li class="btn-group-container">
479

480
						<?php
481

482 483 484 485 486 487 488 489 490 491 492
						if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
							$ssvc = array();
							switch ($shortcut_section) {
								case "openvpn":
									$ssvc = find_service_by_openvpn_vpnid($vpnid);
									break;
								case "captiveportal":
									$ssvc = find_service_by_cp_zone($cpzone);
									break;
								default:
									$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
493

494 495 496 497 498 499
							}
							if (!empty($ssvc)) {
								echo get_service_status_icon($ssvc, false);
								echo get_service_control_links($ssvc, false);
							}
						}
500

501
						?>
502 503 504

						<? if (!empty($main_buttons)): foreach ($main_buttons as $button): ?>
							<a href="<?=$button['href'];?>" class="btn btn-primary"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?=$button['label'];?></a>
505
						<? endforeach; endif; ?>
506

Ad Schellevis's avatar
Ad Schellevis committed
507
						<? if (isset($widgetfiles)): ?>
508 509


Ad Schellevis's avatar
Ad Schellevis committed
510
							<a href="#" id="updatepref" style="display:none" onclick="return updatePref();" class="btn btn-primary"><?=gettext("Save Settings");?></a>
511

Ad Schellevis's avatar
Ad Schellevis committed
512 513
							<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal_widgets"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span>Add widget</button>
						<? endif; ?>
514

515 516 517
						<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_widgets"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span>Add widget</button> -->
					</li>
				</ul>
518
			    </form>
519
			</div>
520
		</header>