本文整理汇总了PHP中return_gateways_status函数的典型用法代码示例。如果您正苦于以下问题:PHP return_gateways_status函数的具体用法?PHP return_gateways_status怎么用?PHP return_gateways_status使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了return_gateways_status函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_gatewaystats
function get_gatewaystats()
{
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
$data = "";
$isfirst = true;
foreach ($a_gateways as $gname => $gw) {
if (!$isfirst) {
$data .= ",";
}
$isfirst = false;
$data .= $gw['name'] . ",";
if ($gateways_status[$gname]) {
$data .= lookup_gateway_ip_by_name($gname) . ",";
$gws = $gateways_status[$gname];
switch (strtolower($gws['status'])) {
case "none":
$online = "Online";
$bgcolor = "#90EE90";
// lightgreen
break;
case "down":
$online = "Offline";
$bgcolor = "#F08080";
// lightcoral
break;
case "delay":
$online = "Latency";
$bgcolor = "#F0E68C";
// khaki
break;
case "loss":
$online = "Packetloss";
$bgcolor = "#F0E68C";
// khaki
break;
default:
$online = "Pending";
break;
}
} else {
$data .= "~,";
$gws['delay'] = "~";
$gws['loss'] = "~";
$online = "Unknown";
$bgcolor = "#ADD8E6";
// lightblue
}
$data .= $online == "Pending" ? "{$online},{$online}," : "{$gws['delay']},{$gws['loss']},";
$data .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" style=\"table-layout: fixed;\" summary=\"status\"><tr><td bgcolor=\"{$bgcolor}\"> {$online} </td></tr></table>";
}
return $data;
}
示例2: get_gatewaystats
function get_gatewaystats()
{
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
$data = "";
$isfirst = true;
foreach ($a_gateways as $gname => $gw) {
if (!$isfirst) {
$data .= ",";
}
$isfirst = false;
$data .= $gw['name'] . ",";
if ($gateways_status[$gname]) {
$data .= "<b>" . lookup_gateway_ip_by_name($gname) . "</b>,";
$gws = $gateways_status[$gname];
switch (strtolower($gws['status'])) {
case "none":
$online = "Online";
$bgcolor = "#90EE90";
// lightgreen
break;
case "down":
$online = "Offline";
$bgcolor = "#F08080";
// lightcoral
break;
case "delay":
$online = "Latency";
$bgcolor = "#F0E68C";
// khaki
break;
case "loss":
$online = "Packetloss";
$bgcolor = "#F0E68C";
// khaki
break;
default:
$online = "Pending";
break;
}
} else {
$data .= "~,";
$gws['delay'] = "~";
$gws['loss'] = "~";
$online = "Unknown";
$bgcolor = "#ADD8E6";
// lightblue
}
$data .= $online == "Pending" ? "{$online},{$online}," : "{$gws['delay']},{$gws['loss']},";
$data .= "{$online}^{$bgcolor}";
}
return $data;
}
示例3: get_gatewaystats
function get_gatewaystats()
{
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
$data = "";
$isfirst = true;
foreach ($a_gateways as $gname => $gw) {
if (!$isfirst) {
$data .= ",";
}
$isfirst = false;
$data .= $gw['name'] . ",";
$data .= lookup_gateway_ip_by_name($gname) . ",";
if ($gateways_status[$gname]) {
$gws = $gateways_status[$gname];
switch (strtolower($gws['status'])) {
case "none":
$online = "Bağlandı";
$class = 'label label-success';
break;
case "down":
$online = 'Bağlantı yok';
$class = 'label label-important';
break;
case "delay":
$online = 'Uyarı: Gecikme';
$class = 'label label-warning';
break;
case "loss":
$online = 'Uyarı, Paket kaybı';
$class = 'label label-warning';
break;
default:
$online = 'Veri alınıyor.';
break;
}
} else {
$online = 'Veri alınıyor.';
$class = 'label';
}
$data .= $online == 'Veri alınıyor.' ? "{$online},{$online}," : "{$gws['delay']},{$gws['loss']},";
$data .= "<span class=\"{$class}\">{$online}</span>";
}
return $data;
}
示例4: get_gatewaystats
function get_gatewaystats() {
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
$data = "";
$isfirst = true;
foreach($a_gateways as $gname => $gw) {
if(!$isfirst)
$data .= ",";
$isfirst = false;
$data .= $gw['name'] . ",";
$data .= lookup_gateway_ip_by_name($gname) . ",";
if ($gateways_status[$gname]) {
$gws = $gateways_status[$gname];
switch(strtolower($gws['status'])) {
case "none":
$online = "Online";
$bgcolor = "lightgreen";
break;
case "down":
$online = "Offline";
$bgcolor = "lightcoral";
break;
case "delay":
$online = "Warning: Latency";
$bgcolor = "khaki";
break;
case "loss":
$online = "Warning: Packetloss";
$bgcolor = "khaki";
break;
default:
$online = "Gathering data";
break;
}
} else {
$online = "Gathering data";
$bgcolor = "lightgray";
}
$data .= ($online == "Gathering data") ? "{$online},{$online}," : "{$gws['delay']},{$gws['loss']},";
$data .= "<table><tr><td bgcolor=\"$bgcolor\" > $online </td></td></tr></table>";
}
return $data;
}
示例5: array
if (!is_ipaddr($gateway['monitor'])) {
return $gateway['gateway'];
}
return $gateway['monitor'];
}
return false;
}
if (!is_array($config['gateways'])) {
$config['gateways'] = array();
}
if (!is_array($config['gateways']['gateway_group'])) {
$config['gateways']['gateway_group'] = array();
}
$a_gateway_groups =& $config['gateways']['gateway_group'];
$changedesc = gettext("Gateway Groups") . ": ";
$gateways_status = return_gateways_status();
$pgtitle = array(gettext('System'), gettext('Gateways'), gettext('Group Status'));
$shortcut_section = "gateway-groups";
include "head.inc";
?>
<body>
<?php
include "fbegin.inc";
?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
示例6: DAMAGES
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.
*/
$nocsrf = true;
require_once "guiconfig.inc";
require_once "pfsense-utils.inc";
require_once "functions.inc";
require_once "/usr/local/www/widgets/include/gateways.inc";
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
$counter = 1;
?>
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0" summary="gateway status">
<tr>
<td class="listhdrr" id="gatewayname" align="center">Name</td>
<td class="listhdrr" align="center">RTT</td>
<td class="listhdrr" align="center">Loss</td>
<td class="listhdrr" align="center">Status</td>
</tr>
<?php
foreach ($a_gateways as $gname => $gateway) {
?>
<tr>
<td class="listhdrr" id="gateway<?php
示例7: compose_table_body_contents
function compose_table_body_contents()
{
global $config;
$rtnstr = '';
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
$display_type = $config["widgets"]["gateways_widget"]["display_type"];
} else {
$display_type = "gw_ip";
}
foreach ($a_gateways as $gname => $gateway) {
$rtnstr .= "<tr>\n";
$rtnstr .= "<td>\n";
$rtnstr .= htmlspecialchars($gateway['name']) . "<br />";
$rtnstr .= '<div id="gateway' . $counter . '" style="display:inline"><b>';
$monitor_address = "";
$monitor_address_disp = "";
if ($display_type == "monitor_ip" || $display_type == "both_ip") {
$monitor_address = $gateway['monitor'];
if ($monitor_address != "" && $display_type == "both_ip") {
$monitor_address_disp = " (" . $monitor_address . ")";
} else {
$monitor_address_disp = $monitor_address;
}
}
$if_gw = '';
// If the user asked to display Gateway IP or both IPs, or asked for just monitor IP but the monitor IP is blank
// then find the gateway IP (which is also the monitor IP if the monitor IP was not explicitly set).
if ($display_type == "gw_ip" || $display_type == "both_ip" || $display_type == "monitor_ip" && $monitor_address == "") {
if (is_ipaddr($gateway['gateway'])) {
$if_gw = htmlspecialchars($gateway['gateway']);
} else {
if ($gateway['ipprotocol'] == "inet") {
$if_gw = htmlspecialchars(get_interface_gateway($gateway['friendlyiface']));
}
if ($gateway['ipprotocol'] == "inet6") {
$if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
}
}
if ($if_gw == "") {
$if_gw = "~";
}
}
if ($monitor_address == $if_gw) {
$monitor_address_disp = "";
}
$rtnstr .= $if_gw . $monitor_address_disp;
unset($if_gw);
unset($monitor_address);
unset($monitor_address_disp);
$counter++;
$rtnstr .= "</b>";
$rtnstr .= "</div>\n";
$rtnstr .= "</td>\n";
if ($gateways_status[$gname]) {
if (stristr($gateways_status[$gname]['status'], "force_down")) {
$online = gettext("Offline (forced)");
$bgcolor = "danger";
// lightcoral
} elseif (stristr($gateways_status[$gname]['status'], "down")) {
$online = gettext("Offline");
$bgcolor = "danger";
// lightcoral
} elseif (stristr($gateways_status[$gname]['status'], "loss")) {
$online = gettext("Packetloss");
$bgcolor = "warning";
// khaki
} elseif (stristr($gateways_status[$gname]['status'], "delay")) {
$online = gettext("Latency");
$bgcolor = "warning";
// khaki
} elseif ($gateways_status[$gname]['status'] == "none") {
$online = gettext("Online");
$bgcolor = "success";
// lightgreen
} elseif ($gateways_status[$gname]['status'] == "") {
$online = gettext("Pending");
$bgcolor = "info";
// lightgray
}
} else {
$online = gettext("Unknown");
$bgcolor = "info";
// lightblue
}
$rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['delay']) : gettext("Pending")) . "</td>\n";
$rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['stddev']) : gettext("Pending")) . "</td>\n";
$rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending")) . "</td>\n";
$rtnstr .= '<td class="bg-' . $bgcolor . '">' . $online . "</td>\n";
$rtnstr .= "</tr>\n";
}
return $rtnstr;
}
示例8: get_gatewaystats
function get_gatewaystats()
{
global $config;
if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
$display_type = $config["widgets"]["gateways_widget"]["display_type"];
} else {
$display_type = "gw_ip";
}
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
$data = "";
$isfirst = true;
foreach ($a_gateways as $gname => $gw) {
if (!$isfirst) {
$data .= ",";
}
$isfirst = false;
$data .= $gw['name'] . ",";
$monitor_address = "";
$monitor_address_disp = "";
if ($display_type == "monitor_ip" || $display_type == "both_ip") {
$monitor_address = $gw['monitor'];
if ($monitor_address != "" && $display_type == "both_ip") {
$monitor_address_disp = " (" . $monitor_address . ")";
} else {
$monitor_address_disp = $monitor_address;
}
}
if ($gateways_status[$gname]) {
if ($display_type == "gw_ip" || $display_type == "both_ip" || $display_type == "monitor_ip" && $monitor_address == "") {
$if_gw = lookup_gateway_ip_by_name($gname);
} else {
$if_gw = "";
}
if ($monitor_address == $if_gw) {
$monitor_address_disp = "";
}
$data .= "<b>" . $if_gw . $monitor_address_disp . "</b>,";
$gws = $gateways_status[$gname];
switch (strtolower($gws['status'])) {
case "none":
$online = "Online";
$bgcolor = "#90EE90";
// lightgreen
break;
case "down":
$online = "Offline";
$bgcolor = "#F08080";
// lightcoral
break;
case "delay":
$online = "Latency";
$bgcolor = "#F0E68C";
// khaki
break;
case "loss":
$online = "Packetloss";
$bgcolor = "#F0E68C";
// khaki
break;
default:
$online = "Pending";
break;
}
} else {
if ($display_type == "gw_ip" || $display_type == "both_ip" || $display_type == "monitor_ip" && $monitor_address == "") {
$if_gw = "~";
} else {
$if_gw = "";
}
$data .= $if_gw . $monitor_address_disp . ",";
$gws['delay'] = "~";
$gws['loss'] = "~";
$online = "Unknown";
$bgcolor = "#ADD8E6";
// lightblue
}
$data .= $online == "Pending" ? "{$online},{$online}," : "{$gws['delay']},{$gws['loss']},";
$data .= "{$online}^{$bgcolor}";
}
return $data;
}
示例9: outputled_gateway
function outputled_gateway()
{
/* Returns the status of the gateways.
-1 = No gateway defined
0 = At least 1 gateway down or with issues
1 = All gateway up */
global $g;
global $config;
$gateways_status = array();
$gateways_status = return_gateways_status(true);
foreach ($a_gateways as $gname => $gateway) {
if ($gateways_status[$gname]['status'] != "none") {
return 0;
}
}
return 1;
}