Exemple #1
0
    $iflist = get_configured_interface_list(false, true);
    foreach ($iflist as $if) {
        if ($config['interfaces'][$if]['if'] == $a_gres[$num]['greif']) {
            return true;
        }
    }
    return false;
}
if ($_GET['act'] == "del") {
    if (!isset($_GET['id'])) {
        $input_errors[] = gettext("Wrong parameters supplied");
    } else {
        if (empty($a_gres[$_GET['id']])) {
            $input_errors[] = gettext("Wrong index supplied");
        } else {
            if (gre_inuse($_GET['id'])) {
                $input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
            } else {
                mwexec("/sbin/ifconfig " . $a_gres[$_GET['id']]['greif'] . " destroy");
                unset($a_gres[$_GET['id']]);
                write_config();
                header("Location: interfaces_gre.php");
                exit;
            }
        }
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("GRE"));
$shortcut_section = "interfaces";
include "head.inc";
?>
            return true;
        }
    }
    return false;
}
if (!isset($config['gres']['gre']) || !is_array($config['gres']['gre'])) {
    $a_gres = array();
} else {
    $a_gres =& $config['gres']['gre'];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!empty($a_gres[$_POST['id']])) {
        $id = $_POST['id'];
    }
    if (!empty($_POST['action']) && $_POST['action'] == "del" && isset($id)) {
        if (gre_inuse($a_gres[$id]['greif'])) {
            $input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
        } else {
            mwexec("/sbin/ifconfig " . escapeshellarg($a_gres[$id]['greif']) . " destroy");
            unset($a_gres[$id]);
            write_config();
            header("Location: interfaces_gre.php");
            exit;
        }
    }
}
include "head.inc";
legacy_html_escape_form_data($a_gres);
$main_buttons = array(array('href' => 'interfaces_gre_edit.php', 'label' => gettext('Add')));
?>