"; $opstring .= "

" . htmlspecialchars($server['name']) . "

"; $opstring .= "
"; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $rowIndex = 0; foreach ($server['conns'] as $conn): $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd"; $rowIndex++; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; endforeach; $opstring .= ""; $opstring .= "
" . gettext('Name/Time') . "" . gettext('Real/Virtual IP') . "
"; $opstring .= $conn['common_name']; $opstring .= ""; $opstring .= $conn['remote_host']; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= "
"; $opstring .= $conn['connect_time']; $opstring .= ""; $opstring .= $conn['virtual_addr']; if (!empty($conn['virtual_addr']) && !empty($conn['virtual_addr6'])) { $opstring .= "
"; } $opstring .= $conn['virtual_addr6']; $opstring .= "
"; $opstring .= "
"; $opstring .= ""; endforeach; print($opstring); $got_sk_server = false; if (!empty($sk_servers)): foreach ($sk_servers as $sk_server): if (!in_array($sk_server['vpnid'], $skipovpns)) { $got_sk_server = true; break; } endforeach; endif; if ($got_sk_server): $opstring = ""; $opstring .= "
"; $opstring .= "

" . gettext("Peer to Peer Server Instance Statistics") . "

"; $opstring .= "
"; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; foreach ($sk_servers as $sk_server): if (in_array($sk_server['vpnid'], $skipovpns)) { continue; } $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; endforeach; $opstring .= ""; $opstring .= "
" . gettext('Name/Time') . "" . gettext('Remote/Virtual IP') . "
"; $opstring .= $sk_server['name']; $opstring .= ""; $opstring .= $sk_server['remote_host']; $opstring .= ""; if ($sk_server['status'] == "up") { /* tunnel is up */ $opstring .= ""; } else { /* tunnel is down */ $opstring .= ""; } $opstring .= "
"; $opstring .= $sk_server['connect_time']; $opstring .= ""; $opstring .= $sk_server['virtual_addr']; if (!empty($sk_server['virtual_addr']) && !empty($sk_server['virtual_addr6'])) { $opstring .= "
"; } $opstring .= $sk_server['virtual_addr6']; $opstring .= "
"; $opstring .= "
"; $opstring .= "
"; print($opstring); endif; $got_ovpn_client = false; if (!empty($clients)): foreach ($clients as $client): if (!in_array($client['vpnid'], $skipovpns)) { $got_ovpn_client = true; break; } endforeach; endif; if ($got_ovpn_client): $opstring = ""; $opstring .= "
"; $opstring .= "

" . gettext("Client Instance Statistics") . "

"; $opstring .= "
"; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; foreach ($clients as $client): if (in_array($client['vpnid'], $skipovpns)) { continue; } $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; $opstring .= ""; endforeach; $opstring .= ""; $opstring .= "
" . gettext('Name/Time') . "" . gettext('Remote/Virtual IP') . "
"; $opstring .= $client['name']; $opstring .= ""; $opstring .= $client['remote_host']; $opstring .= ""; if ($client['status'] == "up") { /* tunnel is up */ $opstring .= ""; } else { /* tunnel is down */ $opstring .= ""; } $opstring .= "
"; $opstring .= $client['connect_time']; $opstring .= ""; $opstring .= $client['virtual_addr']; if (!empty($client['virtual_addr']) && !empty($client['virtual_addr6'])) { $opstring .= "
"; } $opstring .= $client['virtual_addr6']; $opstring .= "
"; $opstring .= "
"; $opstring .= "
"; print($opstring); endif; if ((empty($clients)) && (empty($servers)) && (empty($sk_servers))) { $none_to_display_text = gettext("No OpenVPN instances defined"); } else if (!$got_ovpn_server && !$got_sk_server && !$got_ovpn_client) { $none_to_display_text = gettext("All OpenVPN instances are hidden"); } else { $none_to_display_text = ""; } if (strlen($none_to_display_text) > 0) { print('
' . $none_to_display_text . '
'); } } } /* Handle AJAX */ if ($_GET['action']) { if ($_GET['action'] == "kill") { $port = $_GET['port']; $remipp = $_GET['remipp']; if (!empty($port) and !empty($remipp)) { $retval = openvpn_kill_client($port, $remipp); echo htmlentities("|{$port}|{$remipp}|{$retval}|"); } else { echo gettext("invalid input"); } exit; } } // Compose the table contents and pass it back to the ajax caller if ($_REQUEST && $_REQUEST['ajax']) { printPanel($_REQUEST['widgetkey']); exit; } else if ($_POST['widgetkey']) { $validNames = array(); $servers = openvpn_get_active_servers(); $sk_servers = openvpn_get_active_servers("p2p"); $clients = openvpn_get_active_clients(); foreach ($servers as $server) { array_push($validNames, $server['vpnid']); } foreach ($sk_servers as $sk_server) { array_push($validNames, $sk_server['vpnid']); } foreach ($clients as $client) { array_push($validNames, $client['vpnid']); } if (is_array($_POST['show'])) { $user_settings['widgets'][$_POST['widgetkey']]['filter'] = implode(',', array_diff($validNames, $_POST['show'])); } else { $user_settings['widgets'][$_POST['widgetkey']]['filter'] = implode(',', $validNames); } save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved OpenVPN Filter via Dashboard.")); header("Location: /index.php"); } $widgetperiod = isset($config['widgets']['period']) ? $config['widgets']['period'] * 1000 : 10000; $widgetkey_nodash = str_replace("-", "", $widgetkey); ?>