Пример #1
0
                     // rule copied to different interface
                     $ridx = ifridx($tmpif, $after + 1);
                     // get rule index within interface
                     if ($ridx == 0) {
                         // rule was placed at the top
                         $after = -1;
                         // move all separators
                     }
                 }
             } else {
                 $tmpif = $if;
             }
         }
         // Update the separators
         $a_separators =& $config['filter']['separator'][strtolower($tmpif)];
         $ridx = ifridx($tmpif, $after);
         // get rule index within interface
         $mvnrows = +1;
         move_separators($a_separators, $ridx, $mvnrows);
     } else {
         $a_filter[] = $filterent;
     }
 }
 filter_rules_sort();
 if (write_config()) {
     mark_subsystem_dirty('filter');
 }
 if (isset($_POST['floating'])) {
     header("Location: firewall_rules.php?if=FloatingRules");
 } else {
     header("Location: firewall_rules.php?if=" . htmlspecialchars($_POST['interface']));
Пример #2
0
}
// Handle save msg if defined
if ($_REQUEST['savemsg']) {
    $savemsg = htmlentities($_REQUEST['savemsg']);
}
if (isset($_POST['del_x'])) {
    /* delete selected rules */
    $deleted = false;
    if (is_array($_POST['rule']) && count($_POST['rule'])) {
        $a_separators =& $config['filter']['separator'][strtolower($if)];
        foreach ($_POST['rule'] as $rulei) {
            delete_nat_association($a_filter[$rulei]['associated-rule-id']);
            unset($a_filter[$rulei]);
            $deleted = true;
            // get rule index within interface
            $ifridx = ifridx($if, $rulei);
            // Update the separators
            for ($idx = 0; isset($a_separators['sep' . $idx]); $idx++) {
                $seprow = substr($a_separators['sep' . $idx]['row']['0'], 2);
                if ($seprow > $ifridx) {
                    $a_separators['sep' . $idx]['row']['0'] = 'fr' . ($seprow - 1);
                }
            }
        }
        if ($deleted) {
            if (write_config()) {
                mark_subsystem_dirty('filter');
            }
        }
        header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
        exit;
Пример #3
0
if ($_REQUEST['savemsg']) {
    $savemsg = htmlentities($_REQUEST['savemsg']);
}
if (isset($_POST['del_x'])) {
    /* delete selected rules */
    $deleted = false;
    if (is_array($_POST['rule']) && count($_POST['rule'])) {
        $a_separators =& $config['filter']['separator'][strtolower($if)];
        $num_deleted = 0;
        foreach ($_POST['rule'] as $rulei) {
            delete_nat_association($a_filter[$rulei]['associated-rule-id']);
            unset($a_filter[$rulei]);
            $deleted = true;
            // Update the separators
            // As rules are deleted, $ridx has to be decremented or separator position will break
            $ridx = ifridx($if, $rulei) - $num_deleted;
            // get rule index within interface
            $mvnrows = -1;
            move_separators($a_separators, $ridx, $mvnrows);
            $num_deleted++;
        }
        if ($deleted) {
            if (write_config()) {
                mark_subsystem_dirty('filter');
            }
        }
        header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
        exit;
    }
} else {
    if ($_GET['act'] == "toggle") {