Example #1
0
                    interface_configure($ifapply, true);
                } else {
                    interface_bring_down($ifapply, true, $ifcfgo);
                    if (isset($config['dhcpd'][$ifapply]['enable']) || isset($config['dhcpdv6'][$ifapply]['enable'])) {
                        services_dhcpd_configure();
                    }
                }
            }
        }
        /* restart snmp so that it binds to correct address */
        services_snmpd_configure();
        /* sync filter configuration */
        setup_gateways_monitor();
        clear_subsystem_dirty('interfaces');
        filter_configure();
        enable_rrd_graphing();
        if (is_subsystem_dirty('staticroutes') && system_routing_configure() == 0) {
            clear_subsystem_dirty('staticroutes');
        }
    }
    @unlink("{$g['tmp_path']}/.interfaces.apply");
    header("Location: interfaces.php?if={$if}");
    exit;
} else {
    if ($_POST && $_POST['enable'] != "yes") {
        unset($wancfg['enable']);
        if (isset($wancfg['wireless'])) {
            interface_sync_wireless_clones($wancfg, false);
        }
        write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
        mark_subsystem_dirty('interfaces');
    enable_rrd_graphing();
    setup_gateways_monitor();
    $savemsg = "RRD data has been cleared. New RRD files have been generated.";
} elseif ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    /* input validation */
    /* none */
    if (!$input_errors) {
        $config['rrd']['enable'] = $_POST['enable'] ? true : false;
        $config['rrd']['category'] = $_POST['category'];
        $config['rrd']['style'] = $_POST['style'];
        $config['rrd']['period'] = $_POST['period'];
        write_config();
        $retval = 0;
        $retval = enable_rrd_graphing();
        $savemsg = get_std_save_message();
    }
}
$rrddbpath = "/var/db/rrd/";
chdir($rrddbpath);
$databases = glob("*.rrd");
foreach ($databases as $database) {
    if (stristr($database, "wireless")) {
        $wireless = true;
    }
    if (stristr($database, "-cellular") && !empty($config['ppps'])) {
        $cellular = true;
    }
    if (stristr($database, "-vpnusers")) {
        $vpnusers = true;