当前位置: 首页>>代码示例>>PHP>>正文


PHP convert_real_interface_to_friendly_interface_name函数代码示例

本文整理汇总了PHP中convert_real_interface_to_friendly_interface_name函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_real_interface_to_friendly_interface_name函数的具体用法?PHP convert_real_interface_to_friendly_interface_name怎么用?PHP convert_real_interface_to_friendly_interface_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了convert_real_interface_to_friendly_interface_name函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: interface_assign_description

function interface_assign_description($portinfo, $portname)
{
    global $ovpn_descrs;
    if ($portinfo['isvlan']) {
        $descr = sprintf(gettext('VLAN %1$s on %2$s'), $portinfo['tag'], $portinfo['if']);
        $iface = convert_real_interface_to_friendly_interface_name($portinfo['if']);
        if (isset($iface) && strlen($iface) > 0) {
            $descr .= " - {$iface}";
        }
        if ($portinfo['descr']) {
            $descr .= " (" . $portinfo['descr'] . ")";
        }
    } elseif ($portinfo['iswlclone']) {
        $descr = $portinfo['cloneif'];
        if ($portinfo['descr']) {
            $descr .= " (" . $portinfo['descr'] . ")";
        }
    } elseif ($portinfo['isppp']) {
        $descr = $portinfo['descr'];
    } elseif ($portinfo['isbridge']) {
        $descr = strtoupper($portinfo['bridgeif']);
        if ($portinfo['descr']) {
            $descr .= " (" . $portinfo['descr'] . ")";
        }
    } elseif ($portinfo['isgre']) {
        $descr = "GRE {$portinfo['remote-addr']}";
        if ($portinfo['descr']) {
            $descr .= " (" . $portinfo['descr'] . ")";
        }
    } elseif ($portinfo['isgif']) {
        $descr = "GIF {$portinfo['remote-addr']}";
        if ($portinfo['descr']) {
            $descr .= " (" . $portinfo['descr'] . ")";
        }
    } elseif ($portinfo['islagg']) {
        $descr = strtoupper($portinfo['laggif']);
        if ($portinfo['descr']) {
            $descr .= " (" . $portinfo['descr'] . ")";
        }
    } elseif ($portinfo['isqinq']) {
        $descr = $portinfo['descr'];
    } elseif (substr($portname, 0, 4) == 'ovpn') {
        $descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")";
    } else {
        $descr = $portname . " (" . $portinfo['mac'] . ")";
    }
    return htmlspecialchars($descr);
}
开发者ID:curtiszimmerman,项目名称:pfsense,代码行数:48,代码来源:interfaces_assign.php

示例2: sprintf

 if (substr($wancfg['if'], 0, 3) == 'gif') {
     $min_mtu = 1280;
     $max_mtu = 8192;
 } else {
     $min_mtu = 576;
     $max_mtu = 9000;
 }
 if ($_POST['mtu'] < $min_mtu || $_POST['mtu'] > $max_mtu) {
     $input_errors[] = sprintf(gettext("The MTU must be between %d and %d bytes."), $min_mtu, $max_mtu);
 }
 unset($min_mtu, $max_mtu);
 if (stristr($wancfg['if'], "_vlan")) {
     $realhwif_array = get_parent_interface($wancfg['if']);
     // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling
     $parent_realhwif = $realhwif_array[0];
     $parent_if = convert_real_interface_to_friendly_interface_name($parent_realhwif);
     if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) {
         if ($_POST['mtu'] > intval($config['interfaces'][$parent_if]['mtu'])) {
             $input_errors[] = gettext("The MTU of a VLAN cannot be greater than that of its parent interface.");
         }
     }
 } else {
     foreach ($config['interfaces'] as $idx => $ifdata) {
         if ($idx == $if || !preg_match('/_vlan[0-9]/', $ifdata['if'])) {
             continue;
         }
         $realhwif_array = get_parent_interface($ifdata['if']);
         // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling
         $parent_realhwif = $realhwif_array[0];
         if ($parent_realhwif != $wancfg['if']) {
             continue;
开发者ID:simudream,项目名称:pfsense,代码行数:31,代码来源:interfaces.php

示例3: implode

        }
        if (isset($_POST['autoptp'])) {
            $bridge['autoptp'] = implode(',', $_POST['autoptp']);
        }
        $bridge['bridgeif'] = $_POST['bridgeif'];
        interface_bridge_configure($bridge);
        if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge")) {
            $input_errors[] = gettext("Error occurred creating interface, please retry.");
        } else {
            if (isset($id) && $a_bridges[$id]) {
                $a_bridges[$id] = $bridge;
            } else {
                $a_bridges[] = $bridge;
            }
            write_config();
            $confif = convert_real_interface_to_friendly_interface_name($bridge['bridgeif']);
            if ($confif != "") {
                interface_configure($confif);
            }
            header("Location: interfaces_bridge.php");
            exit;
        }
    }
}
// port list with the exception of assigned bridge interfaces to prevent invalid configs
function build_port_list($selecton)
{
    global $config, $ifacelist;
    $portlist = array('list' => array(), 'selected' => array());
    foreach ($ifacelist as $ifn => $ifdescr) {
        if (substr($config['interfaces'][$ifn]['if'], 0, 6) != "bridge") {
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:31,代码来源:interfaces_bridge_edit.php

示例4: fixup_string

function fixup_string($string)
{
    global $config, $g, $myurl, $title;
    $newstring = $string;
    // fixup #1: $myurl -> http[s]://ip_address:port/
    switch ($config['system']['webgui']['protocol']) {
        case "http":
            $proto = "http";
            break;
        case "https":
            $proto = "https";
            break;
        default:
            $proto = "http";
            break;
    }
    $port = $config['system']['webgui']['port'];
    if ($port != "") {
        if ($port == "443" and $proto != "https" or $port == "80" and $proto != "http") {
            $urlport = ":" . $port;
        } elseif ($port != "80" and $port != "443") {
            $urlport = ":" . $port;
        } else {
            $urlport = "";
        }
    }
    $http_host = explode(":", $_SERVER['HTTP_HOST']);
    $http_host = $http_host[0];
    $urlhost = $http_host;
    // If finishing the setup wizard, check if accessing on a LAN or WAN address that changed
    if ($title == "Reload in progress") {
        if (is_ipaddr($urlhost)) {
            $host_if = find_ip_interface($urlhost);
            if ($host_if) {
                $host_if = convert_real_interface_to_friendly_interface_name($host_if);
                if ($host_if && is_ipaddr($config['interfaces'][$host_if]['ipaddr'])) {
                    $urlhost = $config['interfaces'][$host_if]['ipaddr'];
                }
            }
        } else {
            if ($urlhost == $config['system']['hostname']) {
                $urlhost = $config['wizardtemp']['system']['hostname'];
            } else {
                if ($urlhost == $config['system']['hostname'] . '.' . $config['system']['domain']) {
                    $urlhost = $config['wizardtemp']['system']['hostname'] . '.' . $config['wizardtemp']['system']['domain'];
                }
            }
        }
    }
    if ($urlhost != $http_host) {
        file_put_contents("{$g['tmp_path']}/setupwizard_lastreferrer", $proto . "://" . $http_host . $urlport . $_SERVER['REQUEST_URI']);
    }
    $myurl = $proto . "://" . $urlhost . $urlport . "/";
    if (strstr($newstring, "\$myurl")) {
        $newstring = str_replace("\$myurl", $myurl, $newstring);
    }
    // fixup #2: $wanip
    if (strstr($newstring, "\$wanip")) {
        $curwanip = get_interface_ip();
        $newstring = str_replace("\$wanip", $curwanip, $newstring);
    }
    // fixup #3: $lanip
    if (strstr($newstring, "\$lanip")) {
        $lanip = get_interface_ip("lan");
        $newstring = str_replace("\$lanip", $lanip, $newstring);
    }
    // fixup #4: fix'r'up here.
    return $newstring;
}
开发者ID:rdmenezes,项目名称:pfsense,代码行数:69,代码来源:wizard.php

示例5: sprintf

             $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."), $iface);
         }
         if ($_POST['mru'][$iface] && $_POST['mru'][$iface] < 576) {
             $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface);
         }
     }
     // Loop through fields associated with an individual link/port and make an array of the data
     $port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
     foreach ($_POST['interfaces'] as $iface) {
         foreach ($port_fields as $field_label) {
             if (isset($_POST[$field_label . $iface]) && strlen($_POST[$field_label . $iface]) > 0) {
                 $port_data[$field_label][] = $_POST[$field_label . $iface];
                 $pconfig[$field_label][$iface] = $_POST[$field_label . $iface];
                 $parent_array = get_parent_interface($iface);
                 $parent = $parent_array[0];
                 $friendly = convert_real_interface_to_friendly_interface_name($parent);
                 if ($field_label == "mtu" && isset($config['interfaces'][$friendly]['mtu']) && $_POST[$field_label . $iface] > $config['interfaces'][$friendly]['mtu'] - 8) {
                     $input_errors[] = sprintf(gettext("The MTU (%d) is too big for %s (maximum allowed with current settings: %d)."), $_POST[$field_label . $iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8);
                 }
             }
         }
     }
 }
 if (!$input_errors) {
     $ppp = array();
     if (!isset($id)) {
         $ppp['ptpid'] = interfaces_ptpid_next();
     } else {
         $ppp['ptpid'] = $a_ppps[$id]['ptpid'];
     }
     $ppp['type'] = $_POST['type'];
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:31,代码来源:interfaces_ppps_edit.php

示例6: gettext

							<th><?php 
echo gettext('Actions');
?>
</th>
						</tr>
					</thead>
					<tbody>
<?php 
$i = 0;
foreach ($a_vlans as $vlan) {
    ?>
						<tr>
							<td>
<?php 
    printf("%s", htmlspecialchars($vlan['if']));
    $iface = convert_real_interface_to_friendly_interface_name($vlan['if']);
    if (isset($iface) && strlen($iface) > 0) {
        printf(" (%s)", htmlspecialchars($iface));
    }
    ?>
							</td>
							<td><?php 
    echo htmlspecialchars($vlan['tag']);
    ?>
</td>
							<td><?php 
    echo htmlspecialchars($vlan['pcp']);
    ?>
</td>
							<td><?php 
    echo htmlspecialchars($vlan['descr']);
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:31,代码来源:interfaces_vlan.php

示例7: isset

        $gif['remote-addr'] = $_POST['remote-addr'];
        $gif['descr'] = $_POST['descr'];
        $gif['link1'] = isset($_POST['link1']);
        $gif['link0'] = isset($_POST['link0']);
        $gif['gifif'] = $_POST['gifif'];
        $gif['gifif'] = interface_gif_configure($gif);
        if ($gif['gifif'] == "" || !stristr($gif['gifif'], "gif")) {
            $input_errors[] = gettext("Error occurred creating interface, please retry.");
        } else {
            if (isset($id) && $a_gifs[$id]) {
                $a_gifs[$id] = $gif;
            } else {
                $a_gifs[] = $gif;
            }
            write_config();
            $confif = convert_real_interface_to_friendly_interface_name($gif['gifif']);
            if ($confif != "") {
                interface_configure($confif);
            }
            header("Location: interfaces_gif.php");
            exit;
        }
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("GIF"), gettext("Edit"));
$shortcut_section = "interfaces";
include "head.inc";
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
开发者ID:OptimWIFI,项目名称:pfsense,代码行数:31,代码来源:interfaces_gif_edit.php

示例8: write_config

            if (isset($id) && $a_laggs[$id]) {
                $a_laggs[$id] = $lagg;
            } else {
                $a_laggs[] = $lagg;
            }
            write_config();
            $confif = convert_real_interface_to_friendly_interface_name($lagg['laggif']);
            if ($confif != "") {
                interface_configure($confif);
            }
            // reconfigure any VLANs with this lagg as their parent
            if (is_array($config['vlans']['vlan'])) {
                foreach ($config['vlans']['vlan'] as $vlan) {
                    if ($vlan['if'] == $lagg['laggif']) {
                        interface_vlan_configure($vlan);
                        $confif = convert_real_interface_to_friendly_interface_name($vlan['vlanif']);
                        if ($confif != "") {
                            interface_configure($confif);
                        }
                    }
                }
            }
            header("Location: interfaces_lagg.php");
            exit;
        }
    }
}
function build_member_list()
{
    global $pconfig, $portlist, $realifchecklist;
    $memberlist = array('list' => array(), 'selected' => array());
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:31,代码来源:interfaces_lagg_edit.php

示例9: interface_lagg_configure

        $lagg['laggif'] = $_POST['laggif'];
        $lagg['proto'] = $_POST['proto'];
        if (isset($id) && $a_laggs[$id]) {
            $lagg['laggif'] = $a_laggs[$id]['laggif'];
        }
        $lagg['laggif'] = interface_lagg_configure($lagg);
        if ($lagg['laggif'] == "" || !stristr($lagg['laggif'], "lagg")) {
            $input_errors[] = gettext("Error occurred creating interface, please retry.");
        } else {
            if (isset($id) && $a_laggs[$id]) {
                $a_laggs[$id] = $lagg;
            } else {
                $a_laggs[] = $lagg;
            }
            write_config();
            $confif = convert_real_interface_to_friendly_interface_name($lagg['laggif']);
            if ($confif != "") {
                interface_configure($confif);
            }
            header("Location: interfaces_lagg.php");
            exit;
        }
    }
}
include "head.inc";
?>

<body>
<?php 
include "fbegin.inc";
?>
开发者ID:siloportem,项目名称:core,代码行数:31,代码来源:interfaces_lagg_edit.php

示例10: foreach

     foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
         if (is_array($dhcpifconf['staticmap'])) {
             foreach ($dhcpifconf['staticmap'] as $staticent) {
                 if ($data['ip'] == $staticent['ipaddr']) {
                     $data['if'] = $dhcpif;
                     break;
                 }
             }
         }
         /* exit as soon as we have an interface */
         if ($data['if'] != "") {
             break;
         }
     }
 } else {
     $data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
 }
 echo "<tr>\n";
 if ($mappings[$data['iaid'] . $data['duid']]) {
     $dip = "<br />Routed To: {$mappings[$data['iaid'] . $data['duid']]}";
 }
 echo "<td class=\"listlr\">{$fspans}{$data['prefix']}{$dip}{$fspane}</td>\n";
 echo "<td class=\"listr\">{$fspans}{$data['iaid']}{$fspane}</td>\n";
 echo "<td class=\"listr\">{$fspans}{$data['duid']}{$fspane}</td>\n";
 if ($data['type'] != "static") {
     echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n";
     echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n";
 } else {
     echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
     echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
 }
开发者ID:nmccurdy,项目名称:pfsense,代码行数:31,代码来源:status_dhcpv6_leases.php

示例11: build_interfaces_list

function build_interfaces_list()
{
    global $portlist;
    $list = array();
    foreach ($portlist as $ifn => $ifinfo) {
        if (is_jumbo_capable($ifn)) {
            $list[$ifn] = $ifn . " (" . $ifinfo['mac'] . ")";
            $iface = convert_real_interface_to_friendly_interface_name($ifn);
            if (isset($iface) && strlen($iface) > 0) {
                $list[$ifn] .= " - {$iface}";
            }
        }
    }
    return $list;
}
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:15,代码来源:interfaces_vlan_edit.php

示例12: htmlspecialchars

            $img = "/themes/{$g['theme']}/images/icons/icon_reject.gif";
        } else {
            $img = "/themes/{$g['theme']}/images/icons/icon_block.gif";
        }
    }
    ?>
				<img border="0" src="<?php 
    echo $img;
    ?>
" width="11" height="11" align="absmiddle"></a></span>
				<span class="log-time" ><?php 
    echo htmlspecialchars($filterent['time']);
    ?>
</span>
				<span class="log-interface" ><?php 
    echo htmlspecialchars(convert_real_interface_to_friendly_interface_name($filterent['interface']));
    ?>
</span>
				<span class="log-source" ><?php 
    echo htmlspecialchars($filterent['src']);
    ?>
</span>
				<span class="log-destination" ><?php 
    echo htmlspecialchars($filterent['dst']);
    ?>
</span>
				  <?php 
    if ($filterent['proto'] == "TCP") {
        $filterent['proto'] .= ":" . $filterent['tcpflags'];
    }
    ?>
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:diag_logs_filter_dynamic.php

示例13: array

?>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php 
$tab_array = array();
$mode = "";
foreach ($config['interfaces'] as $interface) {
    if ($interface['wireless'] != "") {
        if ($if == $interface['if']) {
            $enabled = true;
            $mode = $interface['wireless']['mode'];
        } else {
            $enabled = false;
        }
        $friendly = convert_real_interface_to_friendly_interface_name($interface['if']);
        if ($interface['descr'] != "") {
            $friendly = $interface['descr'];
        }
        $tab_array[] = array("Durum ({$friendly})", $enabled, "status_wireless.php?if={$interface['if']}");
    }
}
/* XXX: add other wireless interfaces here */
display_top_tabs($tab_array);
?>
</td></tr>
<tr><td>
<div id="mainarea">
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
<?php 
/* table header */
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:status_wireless.php


注:本文中的convert_real_interface_to_friendly_interface_name函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。