Exemplo n.º 1
0
    }
} else {
    if ($_GET['act'] == "toggle") {
        if ($a_routes[$_GET['id']]) {
            $do_update_config = true;
            if (isset($a_routes[$_GET['id']]['disabled'])) {
                // Do not enable a route whose gateway is disabled
                if (isset($a_gateways[$a_routes[$_GET['id']]['gateway']]['disabled'])) {
                    $do_update_config = false;
                    $input_errors[] = $changedesc_prefix . gettext("gateway is disabled, cannot enable route to") . " " . $a_routes[$_GET['id']]['network'];
                } else {
                    unset($a_routes[$_GET['id']]['disabled']);
                    $changedesc = $changedesc_prefix . gettext("enabled route to") . " " . $a_routes[$_GET['id']]['network'];
                }
            } else {
                delete_static_route($_GET['id']);
                $a_routes[$_GET['id']]['disabled'] = true;
                $changedesc = $changedesc_prefix . gettext("disabled route to") . " " . $a_routes[$_GET['id']]['network'];
            }
            if ($do_update_config) {
                if (write_config($changedesc)) {
                    mark_subsystem_dirty('staticroutes');
                }
                header("Location: system_routes.php");
                exit;
            }
        }
    } else {
        /* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
        unset($movebtn);
        foreach ($_POST as $pn => $pd) {
Exemplo n.º 2
0
     unset($a_routes[$id]);
     write_config();
 } elseif ($act == 'del_x' && isset($pconfig['route'])) {
     /* delete selected routes */
     if (is_array($pconfig['route'])) {
         foreach ($_POST['route'] as $routei) {
             delete_static_route($routei);
             unset($a_routes[$routei]);
         }
         write_config();
     }
 } elseif (isset($id) && $act == "toggle") {
     if (isset($a_routes[$id]['disabled'])) {
         unset($a_routes[$id]['disabled']);
     } else {
         delete_static_route($id);
         $a_routes[$id]['disabled'] = true;
     }
     write_config();
     mark_subsystem_dirty('staticroutes');
 } elseif ($act == 'move' && isset($pconfig['route']) && count($pconfig['route']) > 0) {
     // move selected rules
     if (!isset($id)) {
         // if rule not set/found, move to end
         $id = count($a_routes);
     }
     $a_routes = legacy_move_config_list_items($a_routes, $id, $pconfig['route']);
     if (write_config()) {
         mark_subsystem_dirty('staticroutes');
     }
 }