foreach ($iflist as $if) {
        if ($config['interfaces'][$if]['if'] == $a_vlans[$num]['vlanif']) {
            return true;
        }
    }
    return false;
}
if ($_POST['act'] == "del") {
    if (!isset($_POST['id'])) {
        $input_errors[] = gettext("Wrong parameters supplied");
    } else {
        if (empty($a_vlans[$_POST['id']])) {
            $input_errors[] = gettext("Wrong index supplied");
            /* check if still in use */
        } else {
            if (vlan_inuse($_POST['id'])) {
                $input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
            } else {
                if (does_interface_exist($a_vlans[$_POST['id']]['vlanif'])) {
                    pfSense_interface_destroy($a_vlans[$_POST['id']]['vlanif']);
                }
                unset($a_vlans[$_POST['id']]);
                write_config();
                header("Location: interfaces_vlan.php");
                exit;
            }
        }
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("VLANs"));
$shortcut_section = "interfaces";
Exemple #2
0
    foreach ($iflist as $if) {
        if ($config['interfaces'][$if]['if'] == $a_vlans[$num]['vlanif']) {
            return true;
        }
    }
    return false;
}
if ($_GET['act'] == "del") {
    if (!isset($_GET['id'])) {
        $input_errors[] = gettext("Wrong parameters supplied");
    } else {
        if (empty($a_vlans[$_GET['id']])) {
            $input_errors[] = gettext("Wrong index supplied");
            /* check if still in use */
        } else {
            if (vlan_inuse($_GET['id'])) {
                $input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
            } else {
                if (does_interface_exist($a_vlans[$_GET['id']]['vlanif'])) {
                    pfSense_interface_destroy($a_vlans[$_GET['id']]['vlanif']);
                }
                unset($a_vlans[$_GET['id']]);
                write_config();
                header("Location: interfaces_vlan.php");
                exit;
            }
        }
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("VLAN"));
$shortcut_section = "interfaces";
    }
    for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
        if ($config['interfaces']['opt' . $i]['if'] === $ifn) {
            return true;
        }
    }
    return false;
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    if (FALSE === ($cnid = array_search_ex($_GET['uuid'], $config['vinterfaces']['vlan'], "uuid"))) {
        header("Location: interfaces_vlan.php");
        exit;
    }
    $vlan = $a_vlan[$cnid];
    // Check if still in use.
    if (vlan_inuse($vlan['if'])) {
        $input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
    } else {
        mwexec("/usr/local/sbin/rconf attribute remove 'ifconfig_{$vlan['if']}'");
        unset($a_vlan[$cnid]);
        write_config();
        touch($d_sysrebootreqd_path);
        header("Location: interfaces_vlan.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabnavtbl">
            return true;
        }
    }
    return false;
}
if (!isset($config['vlans']['vlan']) || !is_array($config['vlans']['vlan'])) {
    $a_vlans = array();
} else {
    $a_vlans =& $config['vlans']['vlan'];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!empty($a_vlans[$_POST['id']])) {
        $id = $_POST['id'];
    }
    if (!empty($_POST['action']) && $_POST['action'] == "del" && isset($id)) {
        if (vlan_inuse($a_vlans[$id])) {
            $input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
        } else {
            if (does_interface_exist($a_vlans[$id]['vlanif'])) {
                legacy_interface_destroy($a_vlans[$id]['vlanif']);
            }
            unset($a_vlans[$id]);
            write_config();
            header("Location: interfaces_vlan.php");
            exit;
        }
    }
}
include "head.inc";
legacy_html_escape_form_data($a_vlans);
$main_buttons = array(array('href' => 'interfaces_vlan_edit.php', 'label' => gettext('Add')));