Exemple #1
0
    $sourcesVals = array();
    foreach ($zones as $zone) {
        $sources[] = sprintf("%s (%s)", $zone[0], $zone[1]);
        $sourcesVals[] = $zone[0];
    }
    $sourcesTpl = new SelectItem("source");
    $sourcesTpl->setElements($sources);
    $sourcesTpl->setElementsVal($sourcesVals);
    $f->add(new TrFormElement(_T("Source zone"), $sourcesTpl));
} else {
    $tr = new TrFormElement(_T("Source zone"), new HiddenTpl("source"));
    $tr->setStyle("display: none");
    $f->add($tr, array("value" => $zones[0][0]));
}
$f->add(new TrFormElement(_T("Source IP(s)"), new InputTpl("src_ip"), array("tooltip" => _T("Allow connection from IP(s) address(es) (separate IPs with ',')."))), array("value" => ""));
$zones = getZonesInterfaces($dst);
if (count($zones) > 1) {
    $destinations = array();
    $destinationsVals = array();
    foreach ($zones as $zone) {
        $destinations[] = sprintf("%s (%s)", $zone[0], $zone[1]);
        $destinationsVals[] = $zone[0];
    }
    $destinationsTpl = new SelectItem("destination");
    $destinationsTpl->setElements($destinations);
    $destinationsTpl->setElementsVal($destinationsVals);
    $f->add(new TrFormElement(_T("Destination zone"), $destinationsTpl));
} else {
    $tr = new TrFormElement(_T("Destination zone"), new HiddenTpl("destination"));
    $tr->setStyle("display: none");
    $f->add($tr, array("value" => $zones[0][0]));
Exemple #2
0
$f = new ValidatingForm();
$f->push(new Table());
$zones_types = getZonesTypes();
$external = array();
$externalVals = array();
foreach (getZonesInterfaces($zones_types["external"]) as $zone) {
    $external[] = sprintf("%s (%s)", $zone[0], $zone[1]);
    $externalVals[] = $zone[1];
}
$externalTpl = new SelectItem("external_if");
$externalTpl->setElements($external);
$externalTpl->setElementsVal($externalVals);
$f->add(new TrFormElement(_T("External network (Internet)"), $externalTpl));
$internal = array();
$internalVals = array();
foreach (getZonesInterfaces($zones_types["internal"]) as $zone) {
    $internal[] = sprintf("%s (%s)", $zone[0], $zone[1]);
    $internalVals[] = $zone[1];
}
$internalTpl = new SelectItem("internal_if");
$internalTpl->setElements($internal);
$internalTpl->setElementsVal($internalVals);
$f->add(new TrFormElement(_T("Internal network"), $internalTpl));
$f->pop();
$f->addButton("badd", _T("Add NAT rule"));
$f->display();
if (!servicesModuleEnabled()) {
    echo '<br/>';
    $f = new ValidatingForm(array("id" => "service"));
    $f->addButton("brestart", _T("Restart service"));
    $f->display();
Exemple #3
0
 * This file is part of Mandriva Management Console (MMC).
 *
 * MMC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
$zones = getZonesInterfaces();
$rules = getMasqueradeRules();
$deleteAction = new ActionPopupItem(_T("Delete NAT rule"), "delete_masquerade_rule", "delete", "");
$ids = array();
$label = array();
$actionsDelete = array();
foreach ($rules as $index => $rule) {
    foreach ($zones as $zone_info) {
        if ($zone_info[1] == $rule[0]) {
            $src_zone = $zone_info[0];
        }
        if ($zone_info[1] == $rule[1]) {
            $dst_zone = $zone_info[0];
        }
    }
    $label[] = sprintf("%s (%s) ←→ %s (%s)", $src_zone, $rule[0], $dst_zone, $rule[1]);
Exemple #4
0
 * MMC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
$filter = $_GET["filter"];
$list = getRules("", $src, $dst, $filter);
$zones = getZonesInterfaces($src);
$deleteAction = new ActionPopupItem(_T("Delete rule"), "delete_" . $page . "_rule", "delete", "");
$ids = array();
$decision = array();
$service = array();
$source = array();
$proto = array();
$port = array();
$actionsDelete = array();
foreach ($list as $index => $rule) {
    include 'rule_list.inc.php';
}
$n = new ListInfos($decision, _T("Decision"));
$n->first_elt_padding = 1;
$n->disableFirstColumnActionLink();
$n->addExtraInfo($service, _T("Service"));
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
$filter = $_GET["filter"];
$list = getRules("DNAT", $src, $dst, $filter);
$zones_wan = getZonesInterfaces($src);
$zones_lan = getZonesInterfaces($dst);
$deleteAction = new ActionPopupItem(_T("Delete rule"), "delete_" . $page . "_rule", "delete", "");
$ids = array();
$service = array();
$proto = array();
$port = array();
$src_ip = array();
$dest_ip = array();
$actionsDelete = array();
foreach ($list as $index => $rule) {
    include 'dnat_rule_list.inc.php';
}
$n = new ListInfos($service, _T("Service"));
$n->first_elt_padding = 1;
$n->disableFirstColumnActionLink();
$n->addExtraInfo($proto, _T("Protocol"));