Copyright (C) 2015 Sjon Hortensius All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Наследование: extends Form_Input
Пример #1
0
 public function __construct($submit = null)
 {
     if (!isset($submit)) {
         $submit = gettext('Save');
     }
     if (gettype($submit) == 'string') {
         $submit = new Form_Button('save', $submit, null, 'fa-save');
         $submit->addClass('btn-primary');
     }
     if (false !== $submit) {
         $this->addGlobal($submit);
     }
     if (!isset($this->_attributes['action'])) {
         $this->_attributes['action'] = $_SERVER['REQUEST_URI'];
     }
 }
Пример #2
0
$section = new Form_Section('Domain override options');
$section->addInput(new Form_Input('host', 'Host', 'text', $pconfig['host']))->setHelp('Name of the host, without the domain part' . '<br />' . 'e.g.: "myhost"');
$section->addInput(new Form_Input('domain', 'Domain', 'text', $pconfig['domain']))->setHelp('Domain of the host' . '<br />' . 'e.g.: "example.com"');
$section->addInput(new Form_IpAddress('ip', 'IP Address', $pconfig['ip']))->setHelp('IP address of the host' . '<br />' . 'e.g.: 192.168.100.100 or fd00:abcd::1');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
if (isset($id) && $a_hosts[$id]) {
    $section->addInput(new Form_Input('id', null, 'hidden', $pconfig['id']));
}
$form->add($section);
$section = new Form_Section('Additional names for this host');
if ($pconfig['aliases']['item']) {
    $counter = 0;
    $last = count($pconfig['aliases']['item']) - 1;
    foreach ($pconfig['aliases']['item'] as $item) {
        $group = new Form_Group(null);
        $group->add(new Form_Input('aliashost' . $counter, null, 'text', $item['host']))->setHelp($counter == $last ? 'Host name' : null);
        $group->add(new Form_Input('aliasdomain' . $counter, null, 'text', $item['domain']))->setHelp($counter == $last ? 'Value' : null);
        $group->add(new Form_Input('aliasdescription' . $counter, null, 'text', $item['description']))->setHelp($counter == $last ? 'Description' : null);
        $btn = new Form_Button('btn' . $counter, 'Delete', 'services_dnsmasq_edit.php?act=delopt' . '&id=' . $counter);
        $btn->removeClass('btn-primary')->addClass('btn-danger btn-sm');
        $group->add($btn);
        $section->add($group);
        $counter++;
    }
}
$btnaddopt = new Form_Button('btnaddopt', 'Add Option', 'services_dnsmasq_edit.php?act=addopt');
$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm');
$section->addInput($btnaddopt);
$form->add($section);
print $form;
include "foot.inc";
Пример #3
0
$btndyndns->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('Dynamic DNS', $btndyndns . '&nbsp;' . 'Show dynamic DNS settings'));
$section->addInput(new Form_Checkbox('ddnsupdate', 'DHCP Registration', 'Enable registration of DHCP client names in DNS.', $pconfig['ddnsupdate']));
$section->addInput(new Form_Input('ddnsdomain', 'DDNS Domain', 'text', $pconfig['ddnsdomain']))->setHelp('Leave blank to disable dynamic DNS registration. Enter the dynamic DNS domain which will be used to register client names in the DNS server.');
$section->addInput(new Form_IpAddress('ddnsdomainprimary', 'DDNS Server IP', $pconfig['ddnsdomainprimary']))->setHelp('Enter the primary domain name server IP address for the dynamic domain name.');
$section->addInput(new Form_Input('ddnsdomainkeyname', 'DDNS Domain Key name', 'text', $pconfig['ddnsdomainkeyname']))->setHelp('Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.');
$section->addInput(new Form_Input('ddnsdomainkey', 'DDNS Domain Key secret', 'text', $pconfig['ddnsdomainkey']))->setHelp('Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.');
$btnntp = new Form_Button('btnntp', 'Advanced');
$btnntp->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('NTP servers', $btnntp . '&nbsp;' . 'Show NTP Configuration'));
$group = new Form_Group('NTP Servers');
$group->add(new Form_Input('ntp1', 'NTP Server 1', 'text', $pconfig['ntp1'], ['placeholder' => 'NTP 1']));
$group->add(new Form_Input('ntp2', 'NTP Server 2', 'text', $pconfig['ntp2'], ['placeholder' => 'NTP 2']));
$group->addClass('ntpclass');
$section->add($group);
$btntftp = new Form_Button('btntftp', 'Advanced');
$btntftp->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('TFTP servers', $btntftp . '&nbsp;' . 'Show TFTP Configuration'));
$section->addInput(new Form_Input('tftp', 'TFTP Server', 'text', $pconfig['tftp']))->setHelp('Leave blank to disable. Enter a full hostname or IP for the TFTP server.');
$form->add($section);
print $form;
?>

<script type="text/javascript">
//<![CDATA[
events.push(function() {

	function hideDDNS(hide) {
		hideCheckbox('ddnsupdate', hide);
		hideInput('ddnsdomain', hide);
		hideInput('ddnsdomainprimary', hide);
Пример #4
0
if (isset($config['system']['lb_use_sticky'])) {
    $tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
}
$tab_array[] = array(gettext("Reset States"), false, "diag_resetstate.php");
display_top_tabs($tab_array);
// Start of tab content
$current_statecount = `pfctl -si | grep "current entries" | awk '{ print \$3 }'`;
require_once 'classes/Form.class.php';
$form = new Form(false);
$section = new Form_Section('State filter');
$section->addInput(new Form_Input('filter', 'Filter expression', 'text', $_POST['filter'], ['placeholder' => 'Simple filter such as 192.168, v6, icmp or ESTABLISHED']));
$filterbtn = new Form_Button('filterbtn', 'Filter', null);
$filterbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('', $filterbtn));
if (isset($_POST['filter']) && (is_ipaddr($_POST['filter']) || is_subnet($_POST['filter']))) {
    $killbtn = new Form_Button('killfilter', 'Kill States');
    $killbtn->removeClass('btn-primary')->addClass('btn-danger btn-sm');
    $section->addInput(new Form_StaticText('Kill filtered states', $killbtn))->setHelp('Remove all states to and from the filtered address');
}
$form->add($section);
print $form;
?>
<table class="table table-striped">
	<thead>
		<tr>
			<th><?php 
echo gettext("Int");
?>
</th>
			<th><?php 
echo gettext("Proto");
    }
    return $portlist;
}
$pgtitle = array(gettext("Interfaces"), gettext("Bridges"), gettext("Edit"));
$shortcut_section = "interfaces";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section('Bridge Configuration');
$memberslist = build_port_list($pconfig['members']);
$section->addInput(new Form_Select('members', 'Member Interfaces', $memberslist['selected'], $memberslist['list'], true))->setHelp('Interfaces participating in the bridge.');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']));
// Advanced Additional options
$btnadv = new Form_Button('btnadvopts', 'Display Advanced', null, 'fa-cog');
$btnadv->setAttribute('type', 'button')->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText('Advanced Options', $btnadv));
$form->add($section);
$section = new Form_Section('Advanced Configuration');
$section->addClass('adnlopts');
$section->addInput(new Form_Input('maxaddr', 'Cache Size', 'text', $pconfig['maxaddr']))->setHelp('Set the size of the bridge address cache. The default is 2000 entries.');
$section->addInput(new Form_Input('timeout', 'Cache expire time', 'text', $pconfig['timeout']))->setHelp('Set the timeout of address cache entries to this number of seconds. If seconds is zero, then address cache entries will not be expired. The default is 1200 seconds.');
$spanlist = build_port_list($pconfig['span']);
$section->addInput(new Form_Select('span', 'Span Port', $spanlist['selected'], $spanlist['list'], true))->setHelp('Add the interface named by interface as a span port on the bridge. Span ports transmit a copy of every frame received by the bridge. ' . 'This is most useful for snooping a bridged network passively on another host connected to one of the span ports of the bridge. <br />' . '%sThe span interface cannot be part of the bridge member interfaces.%s', ['<strong>', '</strong>']);
$edgelist = build_port_list($pconfig['edge']);
$section->addInput(new Form_Select('edge', 'Edge Ports', $edgelist['selected'], $edgelist['list'], true))->setHelp('Set interface as an edge port. An edge port connects directly to end stations and cannot create bridging loops in the network; this allows it to transition straight to forwarding.');
$edgelist = build_port_list($pconfig['autoedge']);
$section->addInput(new Form_Select('autoedge', 'Auto Edge Ports', $edgelist['selected'], $edgelist['list'], true))->setHelp('Allow interface to automatically detect edge status. This is the default for all interfaces added to a bridge.' . '%sThis will disable the autoedge status of interfaces. %s', ['<strong>', '</strong>']);
$edgelist = build_port_list($pconfig['ptp']);
$section->addInput(new Form_Select('ptp', 'PTP Ports', $edgelist['selected'], $edgelist['list'], true))->setHelp('Set the interface as a point-to-point link. This is required for straight transitions to forwarding and should be enabled on a direct link to another RSTP-capable switch.');
Пример #6
0
}
if ($savemsg) {
    print_info_box($savemsg, 'success');
}
$cols = 0;
$savevalue = gettext("Save");
if ($pkg['savetext'] != "") {
    $savevalue = $pkg['savetext'];
}
$savehelp = "";
if ($pkg['savehelp'] != "") {
    $savehelp = $pkg['savehelp'];
}
$grouping = false;
// Indicates the elements we are composing are part of a combined group
$savebutton = new Form_Button('submit', $savevalue);
if ($savehelp) {
    $savebutton->setHelp($savehelp);
}
$form = new Form($savebutton);
$form->addGlobal(new Form_Input('xml', null, 'hidden', $xml));
/* If a package's XML has <advanced_options/> configured, then setup
 * the section for the fields that have <advancedfield/> set.
 * These fields will be placed below other fields in a separate area titled 'Advanced Features'.
 * These advanced fields are not normally configured and generally left to default to 'default settings'.
 */
if ($pkg['advanced_options'] == "enabled") {
    $advfield_count = 0;
    $advanced = new Form_Section("Advanced Features");
    $advanced->addClass('advancedoptions');
}
        exit;
    }
}
// Get the MAC address
$ip = $_SERVER['REMOTE_ADDR'];
$mymac = `/usr/sbin/arp -an | grep '('{$ip}')' | head -n 1 | cut -d" " -f4`;
$mymac = str_replace("\n", "", $mymac);
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section('Edit MAC Address Rules');
$section->addInput(new Form_Select('action', 'Action', strtolower($pconfig['action']), array('pass' => gettext('Pass'), 'block' => gettext('Block'))))->setHelp('Choose what to do with packets coming from this MAC address.');
$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', null, 'fa-clone');
$btnmymac->setAttribute('type', 'button')->removeClass('btn-primary')->addClass('btn-success btn-sm');
$group = new Form_Group('MAC Address');
$group->add($macaddress);
$group->add($btnmymac);
$group->setHelp('6 hex octets separated by colons');
$section->add($group);
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('A description may be entered here for administrative reference (not parsed)');
$section->addInput(new Form_Input('bw_up', 'Bandwidth up', 'text', $pconfig['bw_up']))->setHelp('Enter an upload limit to be enforced on this MAC in Kbit/s');
$section->addInput(new Form_Input('bw_down', 'Bandwidth down', 'text', $pconfig['bw_down']))->setHelp('Enter a download limit to be enforced on this MAC in Kbit/s');
$section->addInput(new Form_Input('zone', null, 'hidden', $cpzone));
if (isset($id) && $a_passthrumacs[$id]) {
    $section->addInput(new Form_Input('id', null, 'hidden', $id));
}
if (isset($pconfig['username']) && $pconfig['username']) {
    $section->addInput(new Form_Input('username', null, 'hidden', $pconfig['username']));
Пример #8
0
    foreach ($item as $ww) {
        $wws = explode(":", $ww);
        $user = $wws[0];
        $passwd = base64_decode($wws[1]);
        $ip = $wws[2];
        $group = new Form_Group($counter == 0 ? 'User table' : null);
        $group->addClass('repeatable');
        $group->add(new Form_Input('username' . $counter, null, 'text', $user))->setHelp($numrows == $counter ? 'Username' : null);
        $group->add(new Form_Input('password' . $counter, null, 'password', $passwd))->setHelp($numrows == $counter ? 'Password' : null);
        $group->add(new Form_IpAddress('ip' . $counter, null, $ip))->setHelp($numrows == $counter ? 'IP Address' : null);
        $group->add(new Form_Button('deleterow' . $counter, 'Delete', null, 'fa-trash'))->addClass('btn-warning');
        $section->add($group);
        $counter++;
    }
}
$btnaddrow = new Form_Button('addrow', 'Add user', null, 'fa-plus');
$btnaddrow->addClass('btn-success');
$section->addInput(new Form_StaticText(null, '&nbsp;' . $btnaddrow));
// Hidden fields
if (isset($id)) {
    $section->addInput(new Form_Input('id', null, 'hidden', htmlspecialchars($id, ENT_QUOTES | ENT_HTML401)));
}
if (isset($pconfig['pppoeid'])) {
    $section->addInput(new Form_Input('pppoeid', null, 'hidden', $pconfig['pppoeid']));
}
$form->add($section);
print $form;
print_info_box(gettext('Don\'t forget to add a firewall rule to permit traffic from PPPoE clients.'));
?>
<script type="text/javascript">
//<![CDATA[
Пример #9
0
$section = new Form_Section('State Filter', 'secfilter', COLLAPSIBLE | SEC_OPEN);
$iflist = get_configured_interface_with_descr();
$iflist['lo0'] = "lo0";
$iflist['all'] = "all";
if (isset($_POST['interface'])) {
    $ifselect = $_POST['interface'];
} else {
    $ifselect = "all";
}
$section->addInput(new Form_Select('interface', 'Interface', $ifselect, $iflist));
$section->addInput(new Form_Input('filter', 'Filter expression', 'text', $_POST['filter'], ['placeholder' => 'Simple filter such as 192.168, v6, icmp or ESTABLISHED']));
$filterbtn = new Form_Button('filterbtn', 'Filter', null, 'fa-filter');
$filterbtn->addClass('btn-primary btn-sm');
$section->addInput(new Form_StaticText('', $filterbtn));
if (isset($_POST['filter']) && (is_ipaddr($_POST['filter']) || is_subnet($_POST['filter']))) {
    $killbtn = new Form_Button('killfilter', 'Kill States', null, 'fa-trash');
    $killbtn->addClass('btn-danger btn-sm');
    $section->addInput(new Form_StaticText('Kill filtered states', $killbtn))->setHelp('Remove all states to and from the filtered address');
}
$form->add($section);
print $form;
?>
<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?php 
echo gettext("States");
?>
</h2></div>
	<div class="panel-body">
		<div class="table-responsive">
			<table class="table table-striped table-condensed table-hover sortable-theme-bootstrap" data-sortable>
				<thead>
Пример #10
0
        $section->add($group);
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)));
        $section->addInput(new Form_StaticText('', $btntest));
        $form->add($section);
        print $form;
        // Logs
        $form = new Form(false);
        $btnview = new Form_Button('submit', 'View');
        $section = new Form_Section('View Logs');
        $section->addInput(new Form_Input('action', null, 'hidden', 'logs'));
        $group = new Form_Group('Log type');
        $group->add(new Form_Checkbox('type', null, 'Error', true, 'error'))->displayAsRadio();
        $group->add(new Form_Checkbox('type', null, 'Self-test', false, 'selftest'))->displayAsRadio();
        $section->add($group);
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)));
        $section->addInput(new Form_StaticText('', $btnview));
        $form->add($section);
        print $form;
        // Abort
        $btnabort = new Form_Button('submit', 'Abort');
        $btnabort->removeClass('btn-primary')->addClass('btn-danger');
        $form = new Form(false);
        $section = new Form_Section('Abort');
        $section->addInput(new Form_Input('action', null, 'hidden', 'abort'));
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)));
        $section->addInput(new Form_StaticText('', $btnabort));
        $form->add($section);
        print $form;
        break;
}
include "foot.inc";
display_top_tabs($tab_array);
$form = new Form();
if (isset($groupid)) {
    $form->addGlobal(new Form_Input('groupid', null, 'hidden', $groupid));
}
$section = new Form_Section('Add privileges for ' . $a_group['name']);
$priv_list = array_map(function ($p) {
    return $p['name'];
}, $priv_list);
asort($priv_list, SORT_STRING | SORT_FLAG_CASE);
$section->addInput(new Form_Select('sysprivs', 'Assigned privileges', $a_group['priv'], build_priv_list(), true))->addClass('multiselect')->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.')->setAttribute('style', 'height:400px;');
$section->addInput(new Form_Input('filtertxt', 'Filter', 'text', null))->setHelp('Show only the choices containing this term');
$btnfilter = new Form_Button('btnfilter', 'Filter', null, 'fa-filter');
$btnfilter->addClass('btn btn-info');
$form->addGlobal($btnfilter);
$btnclear = new Form_Button('btnclear', 'Clear', null, 'fa-times');
$btnclear->addClass('btn btn-warning');
$form->addGlobal($btnclear);
$form->add($section);
print $form;
?>
<div class="panel panel-body alert-info col-sm-10 col-sm-offset-2" id="pdesc">Select a privilege from the list above for a description</div>

<script type="text/javascript">
//<![CDATA[
events.push(function() {

<?php 
// Build a list of privilege descriptions
if (is_array($priv_list)) {
    $id = 0;
Пример #12
0
}
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
    $interfaces['pppoe'] = "PPPoE Server";
}
/* add ipsec interfaces */
if (ipsec_enabled() && have_ruleint_access("enc0")) {
    $interfaces["enc0"] = "IPsec";
}
/* add openvpn/tun interfaces */
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
    $interfaces["openvpn"] = "OpenVPN";
}
$section->addInput(new Form_Select('interface', 'Interface', $pconfig['interface'], $interfaces))->setHelp('Choose which interface this rule applies to. In most cases "WAN" is specified.');
$protocols = "TCP UDP TCP/UDP ICMP ESP AH GRE IPV6 IGMP PIM OSPF";
$section->addInput(new Form_Select('proto', 'Protocol', $pconfig['proto'], array_combine(explode(" ", strtolower($protocols)), explode(" ", $protocols))))->setHelp('Choose which protocol this rule should match. In most cases "TCP" is specified.');
$btnsrcadv = new Form_Button('srcadv', 'Advanced');
$btnsrcadv->removeClass('btn-primary')->addClass('btn-default');
$section->addInput(new Form_StaticText('Source', $btnsrcadv));
$group = new Form_Group('Source');
$group->addClass('srcadv');
$group->add(new Form_Checkbox('srcnot', 'Source not', 'Invert match.', $pconfig['srcnot']))->setWidth(2);
$group->add(new Form_Select('srctype', null, srctype_selected(), build_srctype_list()))->setHelp('Type');
$group->add(new Form_IpAddress('src', null, is_specialnet($pconfig['src']) ? '' : $pconfig['src']))->setPattern('[.a-zA-Z0-9_]+')->addMask('srcmask', $pconfig['srcmask'])->setHelp('Address/mask');
$section->add($group);
$portlist = array("" => 'Other', 'any' => 'Any');
foreach ($wkports as $wkport => $wkportdesc) {
    $portlist[$wkport] = $wkportdesc;
}
$group = new Form_Group('Source port range');
$group->addClass('srcportrange');
$group->add(new Form_Select('srcbeginport', null, $pconfig['srcbeginport'], $portlist))->setHelp('From port');
Пример #13
0
        $section->addInput(new Form_StaticText('', $btntest));
        $form->add($section);
        print $form;
        // Logs
        $form = new Form(false);
        $btnview = new Form_Button('submit', 'View', null, 'fa-file-text-o');
        $btnview->addClass('btn-primary');
        $btnview->setAttribute('id');
        $section = new Form_Section('View Logs');
        $section->addInput(new Form_Input('action', null, 'hidden', 'logs'))->setAttribute('id');
        $group = new Form_Group('Log type');
        $group->add(new Form_Checkbox('type', null, 'Error', true, 'error'))->displayAsRadio();
        $group->add(new Form_Checkbox('type', null, 'Self-test', false, 'selftest'))->displayAsRadio();
        $section->add($group);
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)))->setAttribute('id');
        $section->addInput(new Form_StaticText('', $btnview));
        $form->add($section);
        print $form;
        // Abort
        $btnabort = new Form_Button('submit', 'Abort', null, 'fa-times');
        $btnabort->addClass('btn-danger')->setAttribute('id');
        $form = new Form(false);
        $section = new Form_Section('Abort');
        $section->addInput(new Form_Input('action', null, 'hidden', 'abort'))->setAttribute('id');
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)))->setAttribute('id');
        $section->addInput(new Form_StaticText('', $btnabort));
        $form->add($section);
        print $form;
        break;
}
include "foot.inc";
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Authentication Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
$form = new Form();
if (isset($groupid)) {
    $form->addGlobal(new Form_Input('groupid', null, 'hidden', $groupid));
}
$section = new Form_Section('Add Privileges for ' . $a_group['name']);
$section->addInput(new Form_Select('sysprivs', 'Assigned privileges', $a_group['priv'], build_priv_list(), true))->addClass('multiselect')->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.');
$section->addInput(new Form_Select('shadow', 'Shadow', null, build_priv_list(), true))->addClass('shadowselect')->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.');
$section->addInput(new Form_Input('filtertxt', 'Filter', 'text', null))->setHelp('Show only the choices containing this term');
$btnfilter = new Form_Button('btnfilter', 'Filter', null, 'fa-filter');
$btnfilter->setAttribute('type', 'button')->addClass('btn btn-info');
$form->addGlobal($btnfilter);
$btnclear = new Form_Button('btnclear', 'Clear', null, 'fa-times');
$btnclear->setAttribute('type', 'button')->addClass('btn btn-warning');
$form->addGlobal($btnclear);
$form->add($section);
print $form;
?>
<div class="panel panel-body alert-info col-sm-10 col-sm-offset-2" id="pdesc"><?php 
echo gettext("Select a privilege from the list above for a description");
?>
</div>

<script type="text/javascript">
//<![CDATA[
events.push(function() {

<?php 
Пример #15
0
    ?>
 " />
		<input name="sig_no" type="submit" class="btn btn-default" id="sig_no" value=" <?php 
    echo gettext("No");
    ?>
 " />
	</form>
<?php 
} else {
    // This is where the work gets done so Forms.classes will be used from this point
    if (!is_subsystem_dirty('firmwarelock')) {
        require_once 'classes/Form.class.php';
        if (!is_subsystem_dirty('rebootreq')) {
            // Provide a button to enable firmware upgrades. Upgrades should be disabled on initial page load
            if (!is_subsystem_dirty('firmware') || !$_POST || $_POST['save']) {
                $enablebtn = new Form_Button('Submit', 'Enable firmware upload');
                $enablebtn->addClass('btn-warning');
                $form = new Form($enablebtn);
                $section = new Form_Section('Invoke ' . $g['product_name'] . ' Manual Upgrade');
                $section->addInput(new Form_StaticText('Enable', 'Click the "Enable firmware upload" button below to begin.'));
            } else {
                // Upgrades are now enabled
                $form = new Form('Disable firmware upload');
                $form->setMultipartEncoding();
                $section = new Form_Section('Perform ' . $g['product_name'] . ' Manual Upgrade');
                if (!session_id()) {
                    $upload_id = uniqid();
                } else {
                    $upload_id = session_id();
                }
                $section->addInput(new Form_Input('UPLOAD_IDENTIFIER', '', 'hidden', $upload_id));
Пример #16
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;
}
Пример #17
0
    $group->add(new Form_Select($type . 'endport', $name . ' port end', $pconfig[$type . 'endport'], $portValues))->setHelp('To');
    $group->add(new Form_Input($type . 'endport_cust', null, 'text', isset($portValues[$pconfig[$type . 'endport']]) ? null : $pconfig[$type . 'endport']))->setHelp('Custom');
    if ($type == 'src') {
        $group->setHelp('Specify the source port or port range for this rule. This is ' . 'usually random and almost never equal to the destination port range (and ' . 'should usually be <b>any</b>). You can leave the "To" field ' . 'empty if you only want to filter a single port.');
    } else {
        $group->setHelp('Specify the destination port or port range for this rule. ' . 'You can leave the "To" field empty if you only want to filter a ' . 'single port.');
    }
    $group->addClass($type == 'src' ? 'srcprtr' : 'dstprtr');
    $section->add($group);
    $form->add($section);
}
$section = new Form_Section('Extra options');
$section->addInput(new Form_Checkbox('log', 'Log', 'Log packets that are handled by this rule', $pconfig['log']))->setHelp('Hint: the firewall has limited local log space. Don\'t turn on logging ' . 'for everything. If you want to do a lot of logging, consider using a remote ' . 'syslog server (see the <a href="status_logs_settings.php">Status: System logs: ' . 'Settings</a> page).');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference.');
$adv_open = is_aoadv_used($pconfig);
$btnadvanced = new Form_Button('toggle-advanced', 'Advanced options');
$btnadvanced->removeClass('btn-primary')->addClass('btn-default');
if (!$adv_open) {
    $section->addInput(new Form_StaticText(null, $btnadvanced));
}
$form->add($section);
$section = new Form_Section('Advanced options');
$section->addClass('advanced-options');
$section->addInput(new Form_Select('os', 'Source OS', empty($pconfig['os']) ? '' : $pconfig['os'], ['' => gettext('Any')] + array_combine($ostypes, $ostypes)))->setHelp('Note: this only works for TCP rules. General OS choice matches all subtypes.');
$section->addInput(new Form_Select('dscp', 'Diffserv Code Point', $pconfig['dscp'], ["" => ''] + array_combine($firewall_rules_dscp_types, $firewall_rules_dscp_types)));
$section->addInput(new Form_Checkbox('allowopts', 'Allow IP options', 'Allow packets with IP options to pass. Otherwise they are blocked by ' . 'default. This is usually only seen with multicast traffic.', $pconfig['allowopts']));
$section->addInput(new Form_Checkbox('disablereplyto', 'Disable reply-to', 'Disable auto generated reply-to for this rule.', $pconfig['disablereplyto']));
$section->addInput(new Form_Input('tag', 'Tag', 'text', $pconfig['tag']))->setHelp('You can mark a packet matching this rule and use this mark to match ' . 'on other NAT/filter rules. It is called <b>Policy filtering</b>.');
$section->addInput(new Form_Input('tagged', 'Tagged', 'text', $pconfig['tagged']))->setHelp('You can match packet on a mark placed before on another rule.');
$section->addInput(new Form_Input('max', 'Max. states', 'number', $pconfig['max']))->setHelp('Maximum state entries this rule can create.');
$section->addInput(new Form_Input('max-src-nodes', 'Max. src nodes', 'number', $pconfig['max-src-nodes']))->setHelp('Maximum number of unique source hosts.');
Пример #18
0
$section->addInput($egw);
$section->addInput(new Form_Checkbox('defaultgw', 'Default Gateway', 'This will select the above gateway as the default gateway', $pconfig['defaultgw']));
$section->addInput(new Form_Checkbox('monitor_disable', 'Gateway Monitoring', 'Disable Gateway Monitoring', $pconfig['monitor_disable']))->toggles('.toggle-monitor-ip')->setHelp('This will consider this gateway as always being up');
$group = new Form_Group('Monitor IP');
$group->addClass('toggle-monitor-ip', 'collapse');
if (!$pconfig['monitor_disable']) {
    $group->addClass('in');
}
$group->add(new Form_Input('monitor', null, 'text', $pconfig['gateway'] == $pconfig['monitor'] ? '' : $pconfig['monitor']))->setHelp('Enter an alternative address here to be ' . 'used to monitor the link. This is used for the quality RRD graphs as well as the ' . 'load balancer entries. Use this if the gateway does not respond to ICMP echo ' . 'requests (pings).');
$section->add($group);
$section->addInput(new Form_Checkbox('force_down', 'Force state', 'Mark Gateway as Down', $pconfig['force_down']))->setHelp('This will force this gateway to be considered Down');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
// If any of the advanced options are non-default, we will not show the "Advanced" button
// and will display the advanced section
if (!(!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || !empty($pconfig['data_payload']) || isset($pconfig['weight']) && $pconfig['weight'] > 1 || isset($pconfig['interval']) && !($pconfig['interval'] == $dpinger_default['interval']) || isset($pconfig['loss_interval']) && !($pconfig['loss_interval'] == $dpinger_default['loss_interval']) || isset($pconfig['time_period']) && !($pconfig['time_period'] == $dpinger_default['time_period']) || isset($pconfig['alert_interval']) && !($pconfig['alert_interval'] == $dpinger_default['alert_interval']) || isset($pconfig['nonlocalgateway']) && $pconfig['nonlocalgateway'])) {
    $btnadvanced = new Form_Button('toggle-advanced', 'Advanced options');
    $advdflt = true;
    $btnadvanced->toggles('.advanced-options')->setAttribute('type', 'button');
    $btnadvanced->removeClass('btn-primary')->addClass('btn-default');
    $section->addInput(new Form_StaticText(null, $btnadvanced));
}
$form->add($section);
$section = new Form_Section('Advanced');
if (isset($advdflt)) {
    $section->addClass('collapse');
}
$section->addClass('advanced-options');
$section->addInput(new Form_Select('weight', 'Weight', $pconfig['weight'], array_combine(range(1, 30), range(1, 30))))->setHelp('Weight for this gateway when used in a Gateway Group.');
$section->addInput(new Form_Input('data_payload', 'Data Payload', 'number', $pconfig['data_payload'], ['placeholder' => $dpinger_default['data_payload']]))->setHelp('Define data payload to send on ICMP packets to gateway monitor IP.');
$group = new Form_Group('Latency thresholds');
$group->add(new Form_Input('latencylow', 'From', 'number', $pconfig['latencylow'], ['placeholder' => $dpinger_default['latencylow']]));
Пример #19
0
    foreach ($item as $ww) {
        $wws = explode(":", $ww);
        $user = $wws[0];
        $passwd = base64_decode($wws[1]);
        $ip = $wws[2];
        $group = new Form_Group($counter == 0 ? 'User table' : null);
        $group->addClass('repeatable');
        $group->add(new Form_Input('username' . $counter, null, 'text', $user))->setHelp($numrows == $counter ? 'User name' : null);
        $group->add(new Form_Input('password' . $counter, null, 'password', $passwd))->setHelp($numrows == $counter ? 'Password' : null);
        $group->add(new Form_IpAddress('ip' . $counter, null, $ip))->setHelp($numrows == $counter ? 'IP Address' : null);
        $group->add(new Form_Button('deleterow' . $counter, 'Delete'))->removeClass('btn-primary')->addClass('btn-warning');
        $section->add($group);
        $counter++;
    }
}
$btnaddrow = new Form_Button('addrow', 'Add user');
$btnaddrow->removeClass('btn-primary')->addClass('btn-success');
$section->addInput(new Form_StaticText(null, '&nbsp;' . $btnaddrow));
// Hidden fields
if (isset($id)) {
    $section->addInput(new Form_Input('id', null, 'hidden', htmlspecialchars($id, ENT_QUOTES | ENT_HTML401)));
}
if (isset($pconfig['pppoeid'])) {
    $section->addInput(new Form_Input('pppoeid', null, 'hidden', $pconfig['pppoeid']));
}
$form->add($section);
print $form;
print_info_box(gettext('Don\'t forget to add a firewall rule to permit traffic from PPPoE clients'));
?>
<script type="text/javascript">
//<![CDATA[
Пример #20
0
    $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);
print $form;
include "foot.inc";
Пример #21
0
    $group->add(new Form_Input($type . 'beginport_cust', null, 'text', isset($portValues[$pconfig[$type . 'beginport']]) ? null : $pconfig[$type . 'beginport']))->setHelp('Custom');
    $group->add(new Form_Select($type . 'endport', $name . ' port end', $pconfig[$type . 'endport'], $portValues))->setHelp('To');
    $group->add(new Form_Input($type . 'endport_cust', null, 'text', isset($portValues[$pconfig[$type . 'endport']]) ? null : $pconfig[$type . 'endport']))->setHelp('Custom');
    if ($type == 'src') {
        $group->setHelp('Specify the source port or port range for this rule. This is ' . 'usually random and almost never equal to the destination port range (and ' . 'should usually be <b>any</b>). You can leave the "To" field ' . 'empty if you only want to filter a single port.');
    } else {
        $group->setHelp('Specify the destination port or port range for this rule. ' . 'You can leave the "To" field empty if you only want to filter a ' . 'single port.');
    }
    $group->addClass($type == 'src' ? 'srcprtr' : 'dstprtr');
    $section->add($group);
    $form->add($section);
}
$section = new Form_Section('Extra options');
$section->addInput(new Form_Checkbox('log', 'Log', 'Log packets that are handled by this rule', $pconfig['log']))->setHelp('Hint: the firewall has limited local log space. Don\'t turn on logging ' . 'for everything. If you want to do a lot of logging, consider using a remote ' . 'syslog server (see the <a href="diag_logs_settings.php">Diagnostics: System logs: ' . 'Settings</a> page).');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference.');
$btnadvanced = new Form_Button('toggle-advanced', 'Advanced options');
$btnadvanced->removeClass('btn-primary')->addClass('btn-info');
$section->addInput(new Form_StaticText(null, $btnadvanced));
$form->add($section);
$section = new Form_Section('Advanced options');
$section->addClass('advanced-options');
$section->addInput(new Form_Select('os', 'Source OS', empty($pconfig['os']) ? '' : $pconfig['os'], ['' => 'Any'] + array_combine($ostypes, $ostypes)))->setHelp('Note: this only works for TCP rules. General OS choice matches all subtypes.');
$section->addInput(new Form_Select('dscp', 'Diffserv Code Point', $pconfig['dscp'], ["" => ''] + array_combine($firewall_rules_dscp_types, $firewall_rules_dscp_types)));
$section->addInput(new Form_Checkbox('allowopts', 'Allow IP options', 'Allow packets with IP options to pass. Otherwise they are blocked by ' . 'default. This is usually only seen with multicast traffic.', $pconfig['allowopts']));
$section->addInput(new Form_Checkbox('disablereplyto', 'Disable reply-to', 'Disable auto generated reply-to for this rule.', $pconfig['disablereplyto']));
$section->addInput(new Form_Input('tag', 'Tag', 'text', $pconfig['tag']))->setHelp('You can mark a packet matching this rule and use this mark to match ' . 'on other NAT/filter rules. It is called <b>Policy filtering</b>.');
$section->addInput(new Form_Input('tagged', 'Tagged', 'text', $pconfig['tagged']))->setHelp('You can match packet on a mark placed before on another rule.');
$section->addInput(new Form_Input('max', 'Max. states', 'number', $pconfig['max']))->setHelp('Maximum state entries this rule can create.');
$section->addInput(new Form_Input('max-src-nodes', 'Max. src nodes', 'number', $pconfig['max-src-nodes']))->setHelp('Maximum number of unique source hosts.');
$section->addInput(new Form_Input('max-src-conn', 'Max. connections', 'number', $pconfig['max-src-conn']))->setHelp('Maximum number of established connections per host (TCP only).');
$section->addInput(new Form_Input('max-src-states', 'Max. src. states', 'number', $pconfig['max-src-states']))->setHelp('Maximum state entries per host.');
Пример #22
0
$pgtitle = array(gettext("Diagnostics"), gettext("Reset state"));
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'alert-success');
}
$statetablehelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' . 'will be broken and will have to be re-established. This may be necessary after making substantial changes to the ' . 'firewall and/or NAT rules, especially if there are IP protocol mappings (e.g. for PPTP or IPv6) with open connections.' . '<br /><br />' . 'The firewall will normally leave the state tables intact when changing rules.' . '<br /><br />' . '<strong>NOTE:</strong> If you reset the firewall state table, the browser session may appear to be hung after clicking &quot;Reset&quot;. ' . 'Simply refresh the page to continue.';
$sourcetablehelp = 'Resetting the source tracking table will remove all source/destination associations. ' . 'This means that the \\"sticky\\" source/destination association ' . 'will be cleared for all clients.' . ' <br /><br />' . 'This does not clear active connection states, only source tracking.';
$tab_array = array();
$tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
if (isset($config['system']['lb_use_sticky'])) {
    $tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
}
$tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php");
display_top_tabs($tab_array);
$resetbtn = new Form_Button('Submit', 'Reset');
$resetbtn->removeClass('btn-primary')->addClass('btn-danger');
$form = new Form($resetbtn);
$section = new Form_Section('Select states to reset');
$section->addInput(new Form_Checkbox('statetable', 'State Table', 'Reset the firewall state table', true))->setHelp($statetablehelp);
if (isset($config['system']['lb_use_sticky'])) {
    $section->addInput(new Form_Checkbox('sourcetracking', 'Source Tracking', 'Reset firewall source tracking', true))->setHelp($sourcetablehelp);
}
$form->add($section);
print $form;
?>

<?php 
include "foot.inc";
Пример #23
0
$section->addInput(new Form_StaticText('NTP', $btnadv));
$section->addInput(new Form_IpAddress('ntp1', 'NTP Server 1', $pconfig['ntp1']));
$section->addInput(new Form_IpAddress('ntp2', 'NTP Server 2', $pconfig['ntp2']));
// Advanced TFTP
$btnadv = new Form_Button('btnadvtftp', 'Advanced');
$btnadv->removeClass('btn-primary')->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText('TFTP', $btnadv));
$section->addInput(new Form_IpAddress('tftp', 'TFTP Server', $pconfig['tftp']))->setHelp('Leave blank to disable.  Enter a full hostname or IP for the TFTP server')->setPattern('[.a-zA-Z0-9_]+');
// Advanced LDAP
$btnadv = new Form_Button('btnadvldap', 'Advanced');
$btnadv->removeClass('btn-primary')->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText('LDAP', $btnadv));
$section->addInput(new Form_Input('ldap', 'LDAP Server URI', 'text', $pconfig['ldap']))->setHelp('Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com ');
$form->add($section);
// Advanced Additional options
$btnadv = new Form_Button('btnadvopts', 'Advanced');
$btnadv->removeClass('btn-primary')->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText('Additional BOOTP/DHCP Options', $btnadv));
$section = new Form_Section('Additional BOOTP/DHCP Options');
$section->addClass('adnlopts');
$section->addInput(new Form_StaticText(null, '<div class="alert alert-info"> ' . gettext('Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information.') . ' ' . sprintf(gettext('For a list of available options please visit this %1$s URL%2$s'), '<a href="http://www.iana.org/assignments/bootp-dhcp-parameters/" target="_blank">', '</a></div>')));
if (!$pconfig['numberoptions']) {
    $pconfig['numberoptions']['item'] = array(array('number' => '', 'type' => 'text', 'value' => ''));
}
$customitemtypes = array('text' => gettext('Text'), 'string' => gettext('String'), 'boolean' => gettext('Boolean'), 'unsigned integer 8' => gettext('Unsigned 8-bit integer'), 'unsigned integer 16' => gettext('Unsigned 16-bit integer'), 'unsigned integer 32' => gettext('Unsigned 32-bit integer'), 'signed integer 8' => gettext('Signed 8-bit integer'), 'signed integer 16' => gettext('Signed 16-bit integer'), 'signed integer 32' => gettext('Signed 32-bit integer'), 'ip-address' => gettext('IP address or host'));
$numrows = count($item) - 1;
$counter = 0;
$numrows = count($pconfig['numberoptions']['item']) - 1;
foreach ($pconfig['numberoptions']['item'] as $item) {
    $number = $item['number'];
    $itemtype = $item['type'];
        exit;
    }
}
// Get the MAC address
$ip = $_SERVER['REMOTE_ADDR'];
$mymac = `/usr/sbin/arp -an | grep '('{$ip}')' | head -n 1 | cut -d" " -f4`;
$mymac = str_replace("\n", "", $mymac);
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section('Edit MAC Address Rules');
$section->addInput(new Form_Select('action', 'Action', strtolower($pconfig['action']), array('pass' => gettext('Pass'), 'block' => gettext('Block'))))->setHelp('Choose what to do with packets coming from this MAC address.');
$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 Address');
$group->add($macaddress);
$group->add($btnmymac);
$group->setHelp('6 hex octets separated by colons');
$section->add($group);
$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_Input('bw_up', 'Bandwidth up', 'text', $pconfig['bw_up']))->setHelp('Enter an upload limit to be enforced on this MAC in Kbit/s');
$section->addInput(new Form_Input('bw_down', 'Bandwidth down', 'text', $pconfig['bw_down']))->setHelp('Enter a download limit to be enforced on this MAC in Kbit/s');
$section->addInput(new Form_Input('zone', null, 'hidden', $cpzone));
if (isset($id) && $a_passthrumacs[$id]) {
    $section->addInput(new Form_Input('id', null, 'hidden', $id));
}
if (isset($pconfig['username']) && $pconfig['username']) {
    $section->addInput(new Form_Input('username', null, 'hidden', $pconfig['username']));
Пример #25
0
    $robtn = new Form_Button('changero', $btnlbl);
    $robtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
    $lbl .= ' ' . $robtn;
}
$section->addInput(new Form_StaticText('Read/Write status', $lbl))->setHelp('This setting is only temporary, and can be switched dynamically in the background.');
$section->addInput(new Form_Checkbox('nanobsd_force_rw', 'Permanent Read/Write', 'Keep media mounted read/write at all times. ', isset($config['system']['nanobsd_force_rw'])));
$permbtn = new Form_Button('setrw', 'Save');
$permbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText(null, $permbtn));
$section->addInput(new Form_Input('destslice', null, 'hidden', $COMPLETE_PATH));
$dupbtn = new Form_Button('duplicateslice', 'Duplicate ' . $COMPLETE_BOOT_PATH . ' -> ' . $TOFLASH);
$dupbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('Duplicate boot slice', $dupbtn))->setHelp('This will duplicate the bootup slice to the alternate slice.  Use this if you would like to duplicate the known good working boot partition to the alternate.');
$section->addInput(new Form_StaticText('RRD/DHCP Backup', 'These options have been relocated to the ' . '<a href="system_advanced_misc.php">' . 'System > Advanced, Miscellaneous</a> tab.'));
if (file_exists("/conf/upgrade_log.txt")) {
    $viewbtn = new Form_Button('viewupgradelog', 'View log');
    $viewbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
    $section->addInput(new Form_StaticText('View previous upgrade log', $viewbtn));
}
$form->add($section);
print $form;
if (file_exists("/conf/upgrade_log.txt") && $_POST['viewupgradelog']) {
    ?>
	<div class="panel panel-default">
		<div class="panel-heading"><h2 class="panel-title"><?php 
    echo gettext("Previous upgrade log");
    ?>
</h2></div>
			<!-- No white space between the <pre> and the first output or it will appear on the page! -->
			<pre><?php 
    echo str_ireplace("pfsense", $g['product_name'], file_get_contents("/conf/upgrade_log.txt"));
Пример #26
0
    $ous = ldap_get_user_ous(true, $authcfg);
    if (empty($ous)) {
        print '<span class="text-danger">Could not connect to the LDAP server. Please check the LDAP configuration.</span>';
    } else {
        $modal = new Modal("Select LDAP containers for authentication", "containers", true);
        $group = new Form_MultiCheckboxGroup('Containers');
        if (is_array($ous)) {
            $idx = 0;
            foreach ($ous as $ou) {
                $group->add(new Form_MultiCheckbox('ou' . $idx, '', $ou, in_array($ou, $authcfg['ldap_authcn']), $ou));
                $idx++;
            }
        }
        $modal->add($group);
        // Create a "Save button"
        $btnsv = new Form_Button('svcontbtn', 'Save', null, 'fa-save');
        $btnsv->removeClass("btn-default)")->addClass("btn-primary");
        $modal->addInput(new Form_StaticText('', $btnsv));
        print $modal;
    }
    exit;
}
if (is_numericint($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
    $id = $_POST['id'];
}
if (!is_array($config['system']['authserver'])) {
    $config['system']['authserver'] = array();
}
Пример #27
0
$section->addInput(new Form_IpAddress('ipaddrv6', 'IPv6 address', $pconfig['ipaddrv6']))->addMask('subnetv6', $pconfig['subnetv6'], 128);
$group = new Form_Group('IPv6 Upstream gateway');
$group->add(new Form_Select('gatewayv6', 'IPv4 Upstream Gateway', $pconfig['gatewayv6'], build_gatewayv6_list()));
$group->add(new Form_Button('addgw6', 'Add a new gateway'))->removeClass('btn-primary')->setAttribute('data-target', '#newgateway6')->setAttribute('data-toggle', 'modal');
$group->setHelp('If this interface is an Internet connection, select an existing Gateway from the list or add a new one using the "Add" button.' . '<br />' . 'On local LANs the upstream gateway should be "none". ');
$section->add($group);
$form->add($section);
// Add new gateway modal pop-up for IPv6
$modal = new Modal('New IPv6 gateway', 'newgateway6', 'large');
$modal->addInput(new Form_Checkbox('defaultgw6', 'Default', 'Default gateway', $if == "wan" || $if == "WAN"));
$modal->addInput(new Form_Input('name6', 'Gateway name', 'text', $wancfg['descr'] . "GWv6"));
$modal->addInput(new Form_IpAddress('gatewayip6', 'Gateway IPv6', null));
$modal->addInput(new Form_Input('gatewaydescr6', 'Description', 'text'));
$btnaddgw6 = new Form_Button('add6', 'Add');
$btnaddgw6->removeClass('btn-primary')->addClass('btn-success');
$btncnxgw6 = new Form_Button('cnx6', 'Cancel');
$btncnxgw6->removeClass('btn-primary')->addClass('btn-default');
$modal->addInput(new Form_StaticText(null, $btnaddgw6 . $btncnxgw6));
$form->add($modal);
// ==== DHCP client configuration =============================
$section = new Form_Section('DHCP client configuration');
$section->addClass('dhcp');
$group = new Form_Group('Options');
$group->add(new Form_Checkbox('dhcpadv', null, 'Show DHCP advanced options', false));
$group->add(new Form_Checkbox('dhcpovr', null, 'Config file override', false));
$section->add($group);
$section->addInput(new Form_Input('dhcphostname', 'Hostname', 'text', $pconfig['dhcphostname']))->setHelp('The value in this field is sent as the DHCP client identifier and hostname when requesting a DHCP lease. Some ISPs may require this (for client identification).');
$section->addInput(new Form_IpAddress('alias-address', 'Alias IPv4 address', $pconfig['alias-address']))->addMask('alias-subnet', $pconfig['alias-subnet'], 32)->setHelp('The value in this field is used as a fixed alias IPv4 address by the DHCP client.');
$section->addInput(new Form_Input('dhcprejectfrom', 'Reject leases from', 'text', $pconfig['dhcprejectfrom']))->setHelp('If there is a certain upstream DHCP server that should be ignored, place the IP address or subnet of the DHCP server to be ignored here. ' . 'This is useful for rejecting leases from cable modems that offer private IPs when they lose upstream sync.');
$group = new Form_Group('Protocol timing');
$group->addClass('dhcpadvanced');
Пример #28
0
display_top_tabs($tab_array);
$tab_array = array();
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) {
    $tab_array[] = array(gettext("General"), $logfile == 'system', "/diag_logs.php");
    $tab_array[] = array(gettext("Gateways"), $logfile == 'gateways', "/diag_logs.php?logfile=gateways");
    $tab_array[] = array(gettext("Routing"), $logfile == 'routing', "/diag_logs.php?logfile=routing");
    $tab_array[] = array(gettext("Resolver"), $logfile == 'resolver', "/diag_logs.php?logfile=resolver");
    $tab_array[] = array(gettext("Wireless"), $logfile == 'wireless', "/diag_logs.php?logfile=wireless");
    display_top_tabs($tab_array, false, 'nav nav-tabs');
}
$form = new Form(false);
$section = new Form_Section('Log file filter');
$section->addInput(new Form_Input('filtertext', 'Filter', 'text', $filtertext, ['placeholder' => 'Filter text']));
$btnsubmit = new Form_Button('filtersubmit', 'Filter', null, 'fa-filter');
$btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
$btnclear = new Form_Button('clear', 'Clear log', null, 'fa-trash');
$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
$section->addInput(new Form_StaticText('', $btnsubmit . $btnclear));
$form->add($section);
print $form;
if ($logfile == 'dhcpd') {
    print_info_box('Warning: Clearing the log file will restart the DHCP daemon.');
}
?>

<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?php 
echo gettext("Last ");
echo $nentries;
?>
 <?php 
Пример #29
0
display_top_tabs($tab_array, true);
$form = new Form();
$section = new Form_Section('General DNS Resolver Options');
$section->addInput(new Form_Checkbox('enable', 'Enable', 'Enable DNS resolver', $pconfig['enable']));
$section->addInput(new Form_Input('port', 'Listen Port', 'number', $pconfig['port'], ['placeholder' => '53']))->setHelp('The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53.');
$activeiflist = build_if_list($pconfig['active_interface']);
$section->addInput(new Form_Select('active_interface', 'Network Interfaces', $activeiflist['selected'], $activeiflist['options'], true))->addClass('general')->setHelp('Interface IPs used by the DNS Resolver for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. ' . 'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
$outiflist = build_if_list($pconfig['outgoing_interface']);
$section->addInput(new Form_Select('outgoing_interface', 'Outgoing Network Interfaces', $outiflist['selected'], $outiflist['options'], true))->addClass('general')->setHelp('Utilize different network interface(s) that the DNS Resolver will use to send queries to authoritative servers and receive their replies. By default all interfaces are used.');
$unbound_local_zone_types = array("deny" => gettext("Deny"), "refuse" => gettext("Refuse"), "static" => gettext("Static"), "transparent" => gettext("Transparent"), "typetransparent" => gettext("Type Transparent"), "redirect" => gettext("Redirect"), "inform" => gettext("Inform"), "inform_deny" => gettext("Inform Deny"), "nodefault" => gettext("No Default"));
$section->addInput(new Form_Select('system_domain_local_zone_type', 'System Domain Local Zone Type', $pconfig['system_domain_local_zone_type'], $unbound_local_zone_types))->setHelp('The local-zone type used for the pfSense system domain (System | General Setup | Domain).  Transparent is the default.  Local-Zone type descriptions are available in the unbound.conf(5) manual pages.');
$section->addInput(new Form_Checkbox('dnssec', 'DNSSEC', 'Enable DNSSEC Support', $pconfig['dnssec']));
$section->addInput(new Form_Checkbox('forwarding', 'DNS Query Forwarding', 'Enable Forwarding Mode', $pconfig['forwarding']));
$section->addInput(new Form_Checkbox('regdhcp', 'DHCP Registration', 'Register DHCP leases in the DNS Resolver', $pconfig['regdhcp']))->setHelp(sprintf('If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered' . ' in the DNS Resolver, so that their name can be resolved.' . ' You should also set the domain in %sSystem: General setup%s to the proper value.', '<a href="system.php">', '</a>'));
$section->addInput(new Form_Checkbox('regdhcpstatic', 'Static DHCP', 'Register DHCP static mappings in the DNS Resolver', $pconfig['regdhcpstatic']))->setHelp(sprintf('If this option is set, then DHCP static mappings will be registered in the DNS Resolver, so that their name can be ' . 'resolved. You should also set the domain in %s' . 'System: General setup%s to the proper value.', '<a href="system.php">', '</a>'));
$btnadvdns = new Form_Button('btnadvdns', 'Custom options');
$btnadvdns->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('Custom options', $btnadvdns . '&nbsp;' . 'Show custom options'));
$section->addInput(new Form_Textarea('custom_options', 'Custom options', $pconfig['custom_options']))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline');
$form->add($section);
print $form;
?>

<script type="text/javascript">
//<![CDATA[
events.push(function() {

	// If the enable checkbox is not checked, hide all inputs
	function hideGeneral() {
		var hide = ! $('#enable').prop('checked');
Пример #30
0
             $section->addInput(new Form_Checkbox($pkga['fieldname'], $pkga['fielddescr'], fixup_string($pkga['description']), $value == "on", 'on'))->displayAsRadio();
         }
     }
     break;
     // Create form button
 // Create form button
 case "button":
     $newbtnicon = "fa-save";
     if ($pkga['buttonicon'] != "") {
         $newbtnicon = $pkga['buttonicon'];
     }
     $newbtnclass = "btn-primary";
     if ($pkga['buttonclass'] != "") {
         $newbtnclass = $pkga['buttonclass'];
     }
     $newbtn = new Form_Button($pkga['fieldname'], $pkga['fieldname'], null, $newbtnicon);
     $newbtn->addClass($newbtnclass);
     if (grouping) {
         $group->add(new Form_StaticText(null, $newbtn . '<br />' . '<div class="help-block">' . fixup_string($pkga['description']) . '</div>'));
     } else {
         if (isset($pkga['advancedfield']) && isset($advfield_count)) {
             $advanced->addInput(new Form_StaticText(null, $newbtn . '<br />' . '<div class="help-block">' . fixup_string($pkga['description']) . '</div>'));
         } else {
             $section->addInput(new Form_StaticText(null, $newbtn . '<br />' . '<div class="help-block">' . fixup_string($pkga['description']) . '</div>'));
         }
     }
     break;
 case "schedule_selection":
     $input = "<select id='{$pkga['fieldname']}' name='{$pkga['fieldname']}'>\n";
     $schedules = array();
     $schedules[] = "none";