本文整理匯總了PHP中return_gateways_array函數的典型用法代碼示例。如果您正苦於以下問題:PHP return_gateways_array函數的具體用法?PHP return_gateways_array怎麽用?PHP return_gateways_array使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了return_gateways_array函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 .= "<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;
}
示例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 .= 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;
}
示例3: lookup_gateway_monitor_ip_by_name
function lookup_gateway_monitor_ip_by_name($name)
{
$gateways_arr = return_gateways_array(false, true);
if (!empty($gateways_arr[$name])) {
$gateway = $gateways_arr[$name];
if (!is_ipaddr($gateway['monitor'])) {
return $gateway['gateway'];
}
return $gateway['monitor'];
}
return false;
}
示例4: gateway_exists
function gateway_exists($gwname)
{
$gateways = return_gateways_array();
if (is_array($gateways)) {
foreach ($gateways as $gw) {
if ($gw['name'] == $gwname) {
return true;
}
}
}
return false;
}
示例5: 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;
}
示例6: 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;
}
示例7: gettext
?>
</div>
<div id="showgatewayadv" <?php
if (empty($pconfig['gateway'])) {
echo "style='display:none'";
}
?>
>
<select name='gateway'>
<option value="" ><?php
echo gettext("default");
?>
</option>
<?php
/* build a list of gateways */
$gateways = return_gateways_array();
// add statically configured gateways to list
foreach ($gateways as $gwname => $gw) {
if ($pconfig['ipprotocol'] == "inet46") {
continue;
}
if ($pconfig['ipprotocol'] == "inet6" && !($gw['ipprotocol'] == "inet6" || is_ipaddrv6($gw['gateway']))) {
continue;
}
if ($pconfig['ipprotocol'] == "inet" && !($gw['ipprotocol'] == "inet" || is_ipaddrv4($gw['gateway']))) {
continue;
}
if ($gw == "") {
continue;
}
if ($gwname == $pconfig['gateway']) {
示例8: Form_Checkbox
$section->addInput(new Form_Checkbox('nopfsync', 'No pfSync', 'Prevent states created by this rule to be sync\'ed over pfsync.', $pconfig['nopfsync']));
$section->addInput(new Form_Select('statetype', 'State type', $pconfig['statetype'], array('keep state' => 'Keep', 'sloppy state' => 'Sloppy', 'synproxy state' => 'Synproxy', 'none' => 'None')))->setHelp('Select which type of state tracking mechanism you would like to use. If in doubt, use keep state' . '<br />' . '<span></span>');
$section->addInput(new Form_Checkbox('nosync', 'No XMLRPC Sync', 'Prevent the rule on Master from automatically syncing to other CARP members', $pconfig['nosync']))->setHelp('This does NOT prevent the rule from being overwritten on Slave.');
$vlanprio = array("none", "be", "bk", "ee", "ca", "vi", "vo", "ic", "nc");
$section->addInput(new Form_Select('vlanprio', 'VLAN Prio', $pconfig['vlanprio'], $vlanprio))->setHelp('Choose 802.1p priority to match on');
$section->addInput(new Form_Select('vlanprioset', 'VLAN Prio Set', $pconfig['vlanprioset'], $vlanprio))->setHelp('Choose 802.1p priority to apply');
$schedules = array('none');
//leave none to leave rule enabled all the time
foreach ((array) $config['schedules']['schedule'] as $schedule) {
if ($schedule['name'] != "") {
$schedules[] = $schedule['name'];
}
}
$section->addInput(new Form_Select('sched', 'Schedule', $pconfig['sched'], $schedules))->setHelp('Leave as \'none\' to leave the rule enabled all the time');
$gateways = array("" => 'default');
foreach (return_gateways_array() as $gwname => $gw) {
if ($pconfig['ipprotocol'] == "inet46") {
continue;
}
if ($pconfig['ipprotocol'] == "inet6" && !($gw['ipprotocol'] == "inet6" || is_ipaddrv6($gw['gateway']))) {
continue;
}
if ($pconfig['ipprotocol'] == "inet" && !($gw['ipprotocol'] == "inet" || is_ipaddrv4($gw['gateway']))) {
continue;
}
if ($gw == "") {
continue;
}
$gateways[$gwname] = $gw['name'] . (empty($gw['gateway']) ? '' : ' - ' . $gateway_addr_str);
}
foreach ((array) $a_gatewaygroups as $gwg_name => $gwg_data) {
示例9: array
*/
##|+PRIV
##|*IDENT=page-system-staticroutes
##|*NAME=System: Static Routes page
##|*DESCR=Allow access to the 'System: Static Routes' page.
##|*MATCH=system_routes.php*
##|-PRIV
require "guiconfig.inc";
require_once "functions.inc";
require_once "filter.inc";
require_once "shaper.inc";
if (!is_array($config['staticroutes']['route'])) {
$config['staticroutes']['route'] = array();
}
$a_routes =& $config['staticroutes']['route'];
$a_gateways = return_gateways_array(true, true, true);
$changedesc_prefix = gettext("Static Routes") . ": ";
unset($input_errors);
if ($_POST) {
$pconfig = $_POST;
if ($_POST['apply']) {
$retval = 0;
if (file_exists("{$g['tmp_path']}/.system_routes.apply")) {
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply"));
foreach ($toapplylist as $toapply) {
mwexec("{$toapply}");
}
@unlink("{$g['tmp_path']}/.system_routes.apply");
}
$retval = system_routing_configure();
$retval |= filter_configure();
示例10: 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;
}
示例11: 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;
}
示例12: 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;
$a_gateways = return_gateways_array();
$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;
}
示例13: get_gw_family
function get_gw_family($gwname)
{
$gateways = return_gateways_array();
if (is_array($gateways)) {
foreach ($gateways as $gw) {
if ($gw['name'] == $gwname) {
return $gw['ipprotocol'];
}
}
}
return "none";
}