$counter = 0;
$address = $pconfig['address'];
//if ($address == "") {
//	$address = "/";
//}
$item = explode(" ", $address);
$rows = count($item) - 1;
foreach ($item as $ww) {
    $address = $item[$counter];
    $address_subnet = "";
    $item2 = explode("/", $address);
    foreach ($item2 as $current) {
        if ($item2[1] != "") {
            $address = $item2[0];
            $address_subnet = $item2[1];
        }
    }
    $item4 = $item3[$counter];
    $tracker = $counter;
    $group = new Form_group($tracker == 0 ? 'Networks' : null);
    $group->addClass("repeatable");
    $group->add(new Form_IpAddress('address' . $tracker, null, $address, ['placeholder' => 'Address']))->sethelp($tracker == $rows ? 'Network/CIDR' : null)->addMask('address_subnet' . $tracker, $address_subnet)->setWidth(4)->setPattern('[a-zA-Z0-9_.:]+');
    $group->add(new Form_Button('deleterow' . $counter, 'Delete', null, 'fa-trash'))->removeClass('btn-primary')->addClass('btn-warning');
    $counter++;
    $section->add($group);
}
// end foreach
$section->addInput(new Form_Button('addrow', 'Add network', null, 'fa-plus'))->removeClass('btn-primary')->addClass('btn-success addbtn');
$form->add($section);
print $form;
include "foot.inc";
Ejemplo n.º 2
0
if ($address != "") {
    $item = explode(" ", $address);
    $rows = count($item) - 1;
    foreach ($item as $ww) {
        $address = $item[$counter];
        $address_subnet = "";
        $item2 = explode("/", $address);
        foreach ($item2 as $current) {
            if ($item2[1] != "") {
                $address = $item2[0];
                $address_subnet = $item2[1];
            }
        }
        $item4 = $item3[$counter];
        $tracker = $counter;
        $group = new Form_group($tracker == 0 ? 'Network' : null);
        $group->add(new Form_Input('address' . $tracker, null, 'text', $address, ['placeholder' => 'Address']))->sethelp($tracker == $rows ? 'Network' : null);
        $group->add(new Form_Select('ifname', 'Interface', $address_subnet, array_combine(range(32, 1, -1), range(32, 1, -1))))->sethelp($tracker == $rows ? 'CIDR' : null);
        $btndel = new Form_Button('removerow', 'Remove', 'services_igmpproxy_edit.php?act=delrow&row=' . $tracker);
        $btndel->removeClass('btn-primary')->addClass('btn-danger btn-sm');
        $group->add($btndel);
        $counter++;
        $section->add($group);
    }
    // end foreach
}
// end if
$btnadd = new Form_Button('addrow', 'Add Network', 'services_igmpproxy_edit.php?act=addrow');
$btnadd->removeClass('btn-primary')->addClass('btn-success btn-sm');
$section->addInput(new Form_StaticText(null, $btnadd . ' (Save after each Add or Delete)'));
$form->add($section);