diff options
author | jim-p <jimp@pfsense.org> | 2012-08-10 15:30:20 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-08-10 15:30:20 -0400 |
commit | 6d9b107442c111b7ef164cce6e7ecabd39622ddb (patch) | |
tree | cb6b9f2d81a191bf368c477e6783b8549ff107d9 | |
parent | 7d7b5a48551381e8d29a671595a1baab8008932c (diff) | |
download | pfsense-6d9b107442c111b7ef164cce6e7ecabd39622ddb.zip pfsense-6d9b107442c111b7ef164cce6e7ecabd39622ddb.tar.gz |
Fixup openvpn shortcut bar status/control
-rw-r--r-- | etc/inc/service-utils.inc | 16 | ||||
-rwxr-xr-x | usr/local/www/fbegin.inc | 18 | ||||
-rw-r--r-- | usr/local/www/shortcuts.inc | 2 | ||||
-rw-r--r-- | usr/local/www/vpn_openvpn_client.php | 5 | ||||
-rw-r--r-- | usr/local/www/vpn_openvpn_server.php | 11 |
5 files changed, 44 insertions, 8 deletions
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 851c786..e593342 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -347,6 +347,22 @@ function find_service_by_name($name) { return array(); } +function find_service_by_openvpn_vpnid($vpnid) { + $services = get_services(); + foreach ($services as $service) + if ($service["vpnid"] == $vpnid) + return $service; + return array(); +} + +function find_service_by_cp_zone($zone) { + $services = get_services(); + foreach ($services as $service) + if ($service["zone"] == $zone) + return $service; + return array(); +} + function service_name_compare($a, $b) { if (strtolower($a['name']) == strtolower($b['name'])) return 0; diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index edd4592..d784d81 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -390,9 +390,21 @@ function add_to_menu($url, $name) { <span style="float:right; margin: 0 0 20px 20px"> <?php if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) { - $ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']); - echo get_service_status_icon($ssvc, false); - echo get_service_control_links($ssvc, true); + 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']); + + } + if (!empty($ssvc)) { + echo get_service_status_icon($ssvc, false); + echo get_service_control_links($ssvc, true); + } } ?> <?php if(!empty($shortcut_section) && !empty($shortcuts[$shortcut_section]['status'])): ?> <a href="<?php echo $shortcuts[$shortcut_section]['status']; ?>" title="<?php echo gettext("Status of items on this page."); ?>"><img style="vertical-align:middle" src="/themes/<?php echo $g['theme']; ?>/images/status.png" border="0"></a> diff --git a/usr/local/www/shortcuts.inc b/usr/local/www/shortcuts.inc index 252dab7..b061172 100644 --- a/usr/local/www/shortcuts.inc +++ b/usr/local/www/shortcuts.inc @@ -40,7 +40,7 @@ $shortcuts['ipsec']['service'] = "racoon"; $shortcuts['openvpn'] = array(); $shortcuts['openvpn']['log'] = "diag_logs_openvpn.php"; $shortcuts['openvpn']['status'] = "status_openvpn.php"; -//$shortcuts['openvpn']['service'] = "openvpn"; +$shortcuts['openvpn']['service'] = "openvpn"; $shortcuts['firewall'] = array(); $shortcuts['firewall']['log'] = "diag_logs_filter.php"; diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 866ad85..c002f79 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -68,6 +68,11 @@ $act = $_GET['act']; if (isset($_POST['act'])) $act = $_POST['act']; +if (isset($id) && $a_client[$id]) + $vpnid = $a_client[$id]['vpnid']; +else + $vpnid = 0; + if ($_GET['act'] == "del") { if (!$a_client[$id]) { diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index de56415..6f20997 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -37,9 +37,6 @@ require("guiconfig.inc"); require_once("openvpn.inc"); -$pgtitle = array(gettext("OpenVPN"), gettext("Server")); -$shortcut_section = "openvpn"; - if (!is_array($config['openvpn']['openvpn-server'])) $config['openvpn']['openvpn-server'] = array(); @@ -72,6 +69,11 @@ $act = $_GET['act']; if (isset($_POST['act'])) $act = $_POST['act']; +if (isset($id) && $a_server[$id]) + $vpnid = $a_server[$id]['vpnid']; +else + $vpnid = 0; + if ($_GET['act'] == "del") { if (!$a_server[$id]) { @@ -100,7 +102,6 @@ if($_GET['act']=="new"){ if($_GET['act']=="edit"){ if (isset($id) && $a_server[$id]) { - $pconfig['disable'] = isset($a_server[$id]['disable']); $pconfig['mode'] = $a_server[$id]['mode']; $pconfig['protocol'] = $a_server[$id]['protocol']; @@ -416,6 +417,8 @@ if ($_POST) { if (!empty($pconfig['authmode'])) $pconfig['authmode'] = implode(",", $pconfig['authmode']); } +$pgtitle = array(gettext("OpenVPN"), gettext("Server")); +$shortcut_section = "openvpn"; include("head.inc"); |