當前位置: 首頁>>代碼示例>>PHP>>正文


PHP return_gateways_status函數代碼示例

本文整理匯總了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}\">&nbsp;{$online}&nbsp;</td></tr></table>";
    }
    return $data;
}
開發者ID:OptimWIFI,項目名稱:pfsense,代碼行數:54,代碼來源:functions.inc.php

示例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;
}
開發者ID:mtisza,項目名稱:pfsense,代碼行數:54,代碼來源:functions.inc.php

示例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;
}
開發者ID:nuclewall,項目名稱:nuclewall,代碼行數:46,代碼來源:functions.inc.php

示例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;
}
開發者ID:rdmenezes,項目名稱:pfsense,代碼行數:44,代碼來源:functions.inc.php

示例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">
開發者ID:karawan,項目名稱:core,代碼行數:30,代碼來源:status_gateway_groups.php

示例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 
開發者ID:OptimWIFI,項目名稱:pfsense,代碼行數:31,代碼來源:gateways.widget.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;
}
開發者ID:hexaclock,項目名稱:pfsense,代碼行數:95,代碼來源:gateways.widget.php

示例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;
}
開發者ID:michaeleino,項目名稱:pfsense,代碼行數:83,代碼來源:functions.inc.php

示例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;
}
開發者ID:netceler,項目名稱:pfsense-packages,代碼行數:17,代碼來源:lcdproc_client.php


注:本文中的return_gateways_status函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。