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


PHP clone_inuse函数代码示例

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


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

示例1: clone_inuse

}
$a_clones =& $config['wireless']['clone'];
function clone_inuse($num)
{
    global $config, $a_clones;
    $iflist = get_configured_interface_list(false, true);
    foreach ($iflist as $if) {
        if ($config['interfaces'][$if]['if'] == $a_clones[$num]['cloneif']) {
            return true;
        }
    }
    return false;
}
if ($_GET['act'] == "del") {
    /* check if still in use */
    if (clone_inuse($_GET['id'])) {
        $input_errors[] = gettext("This wireless clone cannot be deleted because it is assigned as an interface.");
    } else {
        mwexec("/sbin/ifconfig " . $a_clones[$_GET['id']]['cloneif'] . " destroy");
        unset($a_clones[$_GET['id']]);
        write_config();
        header("Location: interfaces_wireless.php");
        exit;
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("Wireless"));
$shortcut_section = "wireless";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
开发者ID:michaeleino,项目名称:pfsense,代码行数:31,代码来源:interfaces_wireless.php

示例2: get_configured_interface_list

    $iflist = get_configured_interface_list(false, true);
    foreach ($iflist as $if) {
        if ($config['interfaces'][$if]['if'] == $cloneif) {
            return true;
        }
    }
    return false;
}
if (!isset($config['wireless']['clone']) || !is_array($config['wireless']['clone'])) {
    $a_clones = array();
} else {
    $a_clones =& $config['wireless']['clone'];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!empty($_POST['action']) && $_POST['action'] == "del" && !empty($a_clones[$_POST['id']])) {
        if (clone_inuse($a_clones[$_POST['id']]['cloneif'])) {
            /* check if still in use */
            $input_errors[] = gettext("This wireless clone cannot be deleted because it is assigned as an interface.");
        } else {
            mwexec("/sbin/ifconfig " . escapeshellarg($a_clones[$_POST['id']]['cloneif']) . " destroy");
            unset($a_clones[$_POST['id']]);
            write_config();
            header("Location: interfaces_wireless.php");
            exit;
        }
    }
}
include "head.inc";
legacy_html_escape_form_data($a_clones);
$main_buttons = array(array('href' => 'interfaces_wireless_edit.php', 'label' => gettext('Add')));
?>
开发者ID:8191,项目名称:opnsense-core,代码行数:31,代码来源:interfaces_wireless.php

示例3: foreach

 if (!$clone['cloneif']) {
     $clone_id = 1;
     do {
         $clone_exists = false;
         $clone['cloneif'] = "{$_POST['if']}_wlan{$clone_id}";
         foreach ($a_clones as $existing) {
             if ($clone['cloneif'] == $existing['cloneif']) {
                 $clone_exists = true;
                 $clone_id++;
                 break;
             }
         }
     } while ($clone_exists);
 }
 if (isset($id) && $a_clones[$id]) {
     if (clone_inuse($id)) {
         if ($clone['if'] != $a_clones[$id]['if']) {
             $input_errors[] = gettext("This wireless clone cannot be modified because it is still assigned as an interface.");
         } else {
             if ($clone['mode'] != $a_clones[$id]['mode']) {
                 $input_errors[] = gettext("Use the configuration page for the assigned interface to change the mode.");
             }
         }
     }
 }
 if (!$input_errors) {
     if (!interface_wireless_clone($clone['cloneif'], $clone)) {
         $input_errors[] = sprintf(gettext('Error creating interface with mode %1$s.	 The %2$s interface may not support creating more clones with the selected mode.'), $wlan_modes[$clone['mode']], $clone['if']);
     } else {
         if (isset($id) && $a_clones[$id]) {
             if ($clone['if'] != $a_clones[$id]['if']) {
开发者ID:hexaclock,项目名称:pfsense,代码行数:31,代码来源:interfaces_wireless_edit.php

示例4: foreach

 }
 if (empty($clone['cloneif'])) {
     $clone_id = 1;
     do {
         $clone_exists = false;
         $clone['cloneif'] = "{$pconfig['if']}_wlan{$clone_id}";
         foreach ($a_clones as $existing) {
             if ($clone['cloneif'] == $existing['cloneif']) {
                 $clone_exists = true;
                 $clone_id++;
                 break;
             }
         }
     } while ($clone_exists);
 }
 if (isset($id) && clone_inuse($a_clones[$id]['cloneif'])) {
     if ($clone['if'] != $a_clones[$id]['if']) {
         $input_errors[] = gettext("This wireless clone cannot be modified because it is still assigned as an interface.");
     } elseif ($clone['mode'] != $a_clones[$id]['mode']) {
         $input_errors[] = gettext("Use the configuration page for the assigned interface to change the mode.");
     }
 }
 if (count($input_errors) == 0) {
     if (!interface_wireless_clone($clone['cloneif'], $clone)) {
         $input_errors[] = sprintf(gettext('Error creating interface with mode %s. The %s interface may not support creating more clones with the selected mode.'), $wlan_modes[$clone['mode']], $clone['if']);
     } else {
         if (isset($id)) {
             if ($clone['if'] != $a_clones[$id]['if']) {
                 mwexec("/sbin/ifconfig " . escapeshellarg($a_clones[$id]['cloneif']) . " destroy");
             }
             $a_clones[$id] = $clone;
开发者ID:8191,项目名称:opnsense-core,代码行数:31,代码来源:interfaces_wireless_edit.php


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