• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_staticroutes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: gettext

                 $input_errors[] = gettext("You specified an IPv6 prefix ID that is out of range.") . " ({$_POST['track6-interface']}) - (0) - (" . sprintf('%x', $_POST['ipv6-num-prefix-ids-' . $_POST['track6-interface']]) . ")";
             } else {
                 foreach ($ifdescrs as $ifent => $ifdescr) {
                     if ($if == $ifent) {
                         continue;
                     }
                     if ($config['interfaces'][$ifent]['ipaddrv6'] == 'track6' && $config['interfaces'][$ifent]['track6-interface'] == $_POST['track6-interface'] && $config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id) {
                         $input_errors[] = sprintf(gettext("This track6 prefix ID is already being used in %s."), $ifdescr);
                     }
                 }
             }
         }
         break;
 }
 /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
 $staticroutes = get_staticroutes(true);
 $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
 if ($_POST['ipaddr']) {
     if (!is_ipaddrv4($_POST['ipaddr'])) {
         $input_errors[] = gettext("A valid IPv4 address must be specified.");
     } else {
         $where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddr'], $if, true, true, $_POST['subnet']);
         if (count($where_ipaddr_configured)) {
             $subnet_conflict_text = sprintf(gettext("IPv4 address %s is being used by or overlaps with:"), $_POST['ipaddr'] . "/" . $_POST['subnet']);
             foreach ($where_ipaddr_configured as $subnet_conflict) {
                 $subnet_conflict_text .= " " . convert_friendly_interface_to_friendly_descr($subnet_conflict['if']) . " (" . $subnet_conflict['ip_or_subnet'] . ")";
             }
             $input_errors[] = $subnet_conflict_text;
         }
         /* Do not accept network or broadcast address, except if subnet is 31 or 32 */
         if ($_POST['subnet'] < 31) {
开发者ID:simudream,项目名称:pfsense,代码行数:31,代码来源:interfaces.php


示例2: gettext

 if ($_POST['network'] && !is_ipaddr($_POST['network']) && !is_alias($_POST['network'])) {
     $input_errors[] = gettext("A valid IPv4 or IPv6 destination network must be specified.");
 }
 if ($_POST['network_subnet'] && !is_numeric($_POST['network_subnet'])) {
     $input_errors[] = gettext("A valid destination network bit count must be specified.");
 }
 if ($_POST['gateway'] && is_ipaddr($_POST['network'])) {
     if (!isset($a_gateways[$_POST['gateway']])) {
         $input_errors[] = gettext("A valid gateway must be specified.");
     }
     if (!validate_address_family($_POST['network'], lookup_gateway_ip_by_name($_POST['gateway']))) {
         $input_errors[] = gettext("The gateway '{$a_gateways[$_POST['gateway']]['gateway']}' is a different Address Family as network '{$_POST['network']}'.");
     }
 }
 /* check for overlaps */
 $current_targets = get_staticroutes(true);
 $new_targets = array();
 if (is_ipaddrv6($_POST['network'])) {
     $osn = Net_IPv6::compress(gen_subnetv6($_POST['network'], $_POST['network_subnet'])) . "/" . $_POST['network_subnet'];
     $new_targets[] = $osn;
 }
 if (is_ipaddr($_POST['network'])) {
     if ($_POST['network_subnet'] > 32) {
         $input_errors[] = gettext("A IPv4 subnet can not be over 32 bits.");
     } else {
         $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
         $new_targets[] = $osn;
     }
 } elseif (is_alias($_POST['network'])) {
     $osn = $_POST['network'];
     foreach (filter_expand_alias_array($_POST['network']) as $tgt) {
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:system_routes_edit.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_stats函数代码示例发布时间:2022-05-15
下一篇:
PHP get_ssba_settings函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap