Esempio n. 1
0
$pgtitle = array(gettext("Services"), gettext("DHCP"), gettext("Edit static mapping"));
$shortcut_section = "dhcp";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section(sprintf("Static DHCP Mapping on %s", $ifcfgdescr));
$macaddress = new Form_Input('mac', 'MAC Address', 'text', $pconfig['mac'], ['placeholder' => 'xx:xx:xx:xx:xx:xx']);
$btnmymac = new Form_Button('btnmymac', 'Copy My MAC');
$btnmymac->removeClass('btn-primary')->addClass('btn-success btn-sm');
$group = new Form_Group('MAC controls');
$group->add($macaddress);
$group->add($btnmymac);
$group->setHelp('MAC address (6 hex octets separated by colons)');
$section->add($group);
$section->addInput(new Form_Input('cid', 'Client Identifier', 'text', $pconfig['cid']));
$section->addInput(new Form_IpAddress('ipaddr', 'IP Address', $pconfig['ipaddr']))->setHelp('If an IPv4 address is entered, the address must be outside of the pool.' . '<br />' . 'If no IPv4 address is given, one will be dynamically allocated from the pool.');
$section->addInput(new Form_Input('hostname', 'Hostname', 'text', $pconfig['hostname']))->setHelp('Name of the host, without domain part.');
if ($netboot_enabled) {
    $section->addInput(new Form_Input('filename', 'Netboot filename', 'text', $pconfig['filename']))->setHelp('Name of the file that should be loaded when this host boots off of the network, overrides setting on main page.');
    $section->addInput(new Form_Input('rootpath', 'Root Path', 'text', $pconfig['rootpath']))->setHelp('Enter the root-path-string, overrides setting on main page.');
}
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
$section->addInput(new Form_Checkbox('arp_table_static_entry', 'ARP Table Static Entry', 'Create an ARP Table Static Entry for this MAC & IP Address pair.', $pconfig['arp_table_static_entry']));
$group = new Form_Group('WINS Servers');
$group->add(new Form_Input('wins1', null, 'text', $pconfig['wins1'], ['placeholder' => 'WINS 1']));
$group->add(new Form_Input('wins2', null, 'text', $pconfig['wins2'], ['placeholder' => 'WINS 2']));
$section->add($group);
$group = new Form_Group('DNS Servers');
$group->add(new Form_Input('dns1', null, 'text', $pconfig['dns1'], ['placeholder' => 'DNS 1']));
    exit;
}
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'success');
}
$form = new Form();
$section = new Form_Section('DHCPv6 Relay configuration');
$section->addInput(new Form_Checkbox('enable', 'Enable', 'Enable DHCPv6 relay on interface', $pconfig['enable']))->toggles('.form-group:not(:first-child)');
$section->addInput(new Form_Select('interface', 'Interface(s)', $pconfig['interface'], $iflist, true))->setHelp('Interfaces without an IPv6 address will not be shown.');
$section->addInput(new Form_Checkbox('agentoption', '', 'Append circuit ID and agent ID to requests', $pconfig['agentoption']))->setHelp('If this is checked, the DHCPv6 relay will append the circuit ID (%s interface number) and the agent ID to the DHCPv6 request.', [$g['product_name']]);
function createDestinationServerInputGroup($value = null)
{
    $group = new Form_Group('Destination server');
    $group->add(new Form_IpAddress('server', 'Destination server', $value))->setWidth(4)->setHelp('This is the IPv6 address of the server to which DHCPv6 requests are relayed.')->setIsRepeated();
    $group->enableDuplication(null, true);
    // Buttons are in-line with the input
    return $group;
}
if (!isset($pconfig['server'])) {
    $section->add(createDestinationServerInputGroup());
} else {
    foreach (explode(',', $pconfig['server']) as $server) {
        $section->add(createDestinationServerInputGroup($server));
    }
}
$form->add($section);
print $form;
include "foot.inc";
Esempio n. 3
0
    }
    if ($gw == "") {
        continue;
    }
    $gateways[$gwname] = $gw['name'] . (empty($gw['gateway']) ? '' : ' - ' . $gateway_addr_str);
}
foreach ((array) $a_gatewaygroups as $gwg_name => $gwg_data) {
    if (empty($pconfig['ipprotocol']) || $pconfig['ipprotocol'] == $gwg_data['ipprotocol']) {
        $gateways[$gwg_name] = $gwg_name;
    }
}
$section->addInput(new Form_Select('gateway', 'Gateway', $pconfig['gateway'], $gateways))->setHelp('Leave as \'default\' to use the system routing table. Or choose a ' . 'gateway to utilize policy based routing.');
$group = new Form_Group('In / Out pipe');
$group->add(new Form_Select('dnpipe', 'DNpipe', $pconfig['dnpipe'], array('' => 'none') + array_keys($dnqlist)));
$group->add(new Form_Select('pdnpipe', 'PDNpipe', $pconfig['pdnpipe'], array('' => 'none') + array_keys($dnqlist)));
$section->add($group)->setHelp('Choose the Out queue/Virtual interface only if ' . 'you have also selected In. The Out selection is applied to traffic leaving ' . 'the interface where the rule is created, In is applied to traffic coming ' . 'into the chosen interface.<br />If you are creating a floating rule, if the ' . 'direction is In then the same rules apply, if the direction is out the ' . 'selections are reverted Out is for incoming and In is for outgoing.');
$group = new Form_Group('Ackqueue / Queue');
$list = array('' => 'none');
if (!is_array($qlist)) {
    $qlist = array();
}
foreach ($qlist as $q => $qkey) {
    if (isset($ifdisp[$q])) {
        $list[$q] = $ifdisp[$q];
    } else {
        $list[$q] = $q;
    }
}
$group->add(new Form_Select('ackqueue', 'Ackqueue', $pconfig['ackqueue'], $list));
$group->add(new Form_Select('defaultqueue', 'Default Queue', $pconfig['defaultqueue'], $list));
$section->add($group)->setHelp('Choose the Acknowledge Queue only if you have ' . 'selected Queue.');
Esempio n. 4
0
                    $text = "";
                    $trc++;
                }
                // Delete row button
                $group->add(new Form_Button('deleterow' . $rowcounter, 'Delete', null, 'fa-trash'))->removeClass('btn-primary')->addClass('btn-warning btn-sm');
                $rowcounter++;
                $section->add($group);
            }
            // Add row button
            $section->addInput(new Form_Button('addrow', 'Add'))->removeClass('btn-primary')->addClass('btn-success');
            break;
    }
    if ($pkga['combinefields'] == "end") {
        $group->add(new Form_StaticText(null, null));
        if ($advanced) {
            $advanced->add($group);
        } else {
            $section->add($group);
        }
        $grouping = false;
    }
    #increment counter
    $i++;
}
// e-o-foreach field described in the XML
$form->add($section);
$form->addGlobal(new Form_Input('id', null, 'hidden', $id));
// If we created an advanced section, add it (and a button) to the form here
if (!empty($advanced)) {
    $form->addGlobal(new Form_Button('showadv', 'Show advanced options'))->removeClass('btn-primary')->addClass('btn-default');
    $form->add($advanced);
Esempio n. 5
0
function filter_form_vpn()
{
    global $filter_active, $rawfilter, $filterfieldsarray, $filtertext, $filterlogentries_qty, $nentries, $Include_Act, $interfacefilter;
    global $logfile;
    global $system_logs_filter_form_hidden;
    if ($filter_active) {
        $panel_state = 'in';
        $panel_body_state = SEC_OPEN;
    } else {
        if ($system_logs_filter_form_hidden) {
            $panel_state = 'out';
            $panel_body_state = SEC_OPEN;
        } else {
            $panel_state = 'in';
            $panel_body_state = SEC_CLOSED;
        }
    }
    if (!$rawfilter) {
        // Advanced log filter form
        $form = new Form(false);
        $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
        $section = new Form_Section('Advanced Log Filter', 'filter-panel', COLLAPSIBLE | $panel_body_state);
        if ($logfile == "vpn") {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_action', null, 'text', $filterfieldsarray['action']))->setWidth(3)->setHelp('Action');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_user', null, 'text', $filterfieldsarray['user']))->setWidth(3)->setHelp('User');
            $group->add(new Form_Input('filterlogentries_ip_address', null, 'text', $filterfieldsarray['ip_address']))->setWidth(4)->setHelp('IP Address');
        } else {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_type', null, 'text', $filterfieldsarray['type']))->setWidth(2)->setHelp('Type');
            $group->add(new Form_Input('filterlogentries_pid', null, 'text', $filterfieldsarray['pid']))->setWidth(2)->setHelp('PID');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_message', null, 'text', $filterfieldsarray['message']))->setWidth(7)->setHelp('Log Message');
        }
        $btnsubmit = new Form_Button('filterlogentries_submit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
    } else {
        // Simple log filter form
        $form = new Form(false);
        $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
        $section = new Form_Section('Log Filter', 'filter-panel', COLLAPSIBLE | $panel_body_state);
        $group = new Form_Group('');
        $group->add(new Form_Input('filtertext', null, 'text', $filtertext))->setWidth(6)->setHelp('Filter Expression');
        $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
        $btnsubmit = new Form_Button('filtersubmit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
    }
    $btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
    $group->add(new Form_StaticText('', $btnsubmit));
    $group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . gettext('Regular expression reference') . '</a> ' . gettext('Precede with exclamation (!) to exclude match.'));
    $section->add($group);
    $form->add($section);
    print $form;
}