if ($monthcounter == 12) {
            $monthcounter = 1;
            $yearcounter++;
        } else {
            $monthcounter++;
        }
    }
    return $list;
}
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section('Schedule Information');
$input = new Form_Input('name', 'Schedule Name', 'text', $pconfig['name']);
$input->setHelp(is_schedule_inuse($pconfig['name']) != true ? 'The name of the schedule may only consist of the characters "a-z, A-Z, 0-9 and _".' : 'This schedule is in use so the name may not be modified!');
if (is_schedule_inuse($pconfig['name']) == true) {
    $input->setReadonly();
}
$section->addInput($input);
$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_Select('monthsel', 'Month', null, build_month_list()));
$section->addInput(new Form_StaticText('Date', build_date_table()));
$group = new Form_Group('Time');
$group->add(new Form_Select('starttimehour', null, null, array_combine(range(0, 23, 1), range(0, 23, 1))))->setHelp('Start Hrs');
$group->add(new Form_Select('starttimemin', null, null, array('00' => '00', '15' => '15', '30' => '30', '45' => '45', '59' => '59')))->setHelp('Start Mins');
$group->add(new Form_Select('stoptimehour', null, '23', array_combine(range(0, 23, 1), range(0, 23, 1))))->setHelp('Stop Hrs');
$group->add(new Form_Select('stoptimemin', null, '59', array('00' => '00', '15' => '15', '30' => '30', '45' => '45', '59' => '59')))->setHelp('Stop Mins');
$group->setHelp('Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59.');
$section->add($group);
$section->addInput(new Form_Input('timerangedescr', 'Time range description', 'text', $pconfig['timerangedescr']))->setHelp('A description may be entered here for administrative reference (not parsed). ');
Beispiel #2
0
function display_row($trc, $value, $fieldname, $type, $rowhelper, $description, $ewidth = null)
{
    global $text, $group;
    switch ($type) {
        case "input":
            $inpt = new Form_Input($fieldname . $trc, null, 'text', $value);
            $inpt->setHelp($description);
            if ($ewidth) {
                $inpt->setWidth($ewidth);
            }
            $group->add($inpt);
            break;
        case "checkbox":
            $group->add(new Form_Checkbox($fieldname . $trc, null, null, $value, 'ON'))->setHelp($description);
            break;
        case "password":
            $group->add(new Form_Input($fieldname . $trc, null, 'password', $value))->setHelp($description);
            break;
        case "textarea":
            $group->add(new Form_Textarea($fieldname . $trc, null, $value))->setHelp($description);
            break;
        case "select":
            $options = array();
            foreach ($rowhelper['options']['option'] as $rowopt) {
                $options[$rowopt['value']] = $rowopt['name'];
            }
            $grp = new Form_Select($fieldname . $trc, null, $value, $options);
            $grp->setHelp($description);
            if ($ewidth) {
                $grp->setWidth($ewidth);
            }
            $group->add($grp);
            break;
        case "interfaces_selection":
            $size = $size ? "size=\"{$size}\"" : '';
            $multiple = '';
            if (isset($rowhelper['multiple'])) {
                $multiple = "multiple";
            }
            echo "<select style='height:22px;' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' {$size} {$multiple}>\n";
            $ifaces = get_configured_interface_with_descr();
            $additional_ifaces = $rowhelper['add_to_interfaces_selection'];
            if (!empty($additional_ifaces)) {
                $ifaces = array_merge($ifaces, explode(',', $additional_ifaces));
            }
            if (is_array($value)) {
                $values = $value;
            } else {
                $values = explode(',', $value);
            }
            $ifaces["lo0"] = "loopback";
            $options = array();
            $selected = array();
            foreach ($ifaces as $ifname => $iface) {
                $options[$ifname] = $iface;
                if (in_array($ifname, $values)) {
                    array_push($selected, $ifname);
                }
            }
            $group->add(new Form_Select($fieldname . $trc, null, $multiple ? $selected : $selected[0], $options, $multiple))->setHelp($description);
            //echo "</select>\n";
            break;
        case "select_source":
            $options = array();
            $selected = array();
            if (isset($rowhelper['show_disable_value'])) {
                $options[$rowhelper['show_disable_value']] = $rowhelper['show_disable_value'];
            }
            $source_url = $rowhelper['source'];
            eval("\$pkg_source_txt = &{$source_url};");
            foreach ($pkg_source_txt as $opt) {
                $source_name = $rowhelper['source_name'] ? $opt[$rowhelper['source_name']] : $opt[$rowhelper['name']];
                $source_value = $rowhelper['source_value'] ? $opt[$rowhelper['source_value']] : $opt[$rowhelper['value']];
                $options[$source_value] = $source_name;
                if ($source_value == $value) {
                    array_push($selected, $value);
                }
            }
            $group->add(new Form_Select($fieldname . $trc, null, $multiple ? $selected : $selected[0], $options, $multiple))->setHelp($description);
            break;
    }
}
$form = new Form();
/* If this is a system gateway we need this var */
if ($pconfig['attribute'] == "system" || is_numeric($pconfig['attribute'])) {
    $form->addGlobal(new Form_Input('attribute', null, 'hidden', $pconfig['attribute']));
}
if (isset($id) && $a_gateways[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$form->addGlobal(new Form_Input('friendlyiface', null, 'hidden', $pconfig['friendlyiface']));
$section = new Form_Section('Edit Gateway');
$section->addInput(new Form_Checkbox('disabled', 'Disabled', 'Disable this gateway', $pconfig['disabled']))->setHelp('Set this option to disable this gateway without removing it from the ' . 'list.');
$section->addInput(new Form_Select('interface', 'Interface', $pconfig['friendlyiface'], get_configured_interface_with_descr(false, true)))->setHelp('Choose which interface this gateway applies to.');
$section->addInput(new Form_Select('ipprotocol', 'Address Family', $pconfig['ipprotocol'], array("inet" => "IPv4", "inet6" => "IPv6")))->setHelp('Choose the Internet Protocol this gateway uses.');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']))->setHelp('Gateway name');
$egw = new Form_Input('gateway', 'Gateway', 'text', $pconfig['dynamic'] ? 'dynamic' : $pconfig['gateway']);
$egw->setHelp('Gateway IP address');
if ($pconfig['dynamic']) {
    $egw->setReadonly();
}
$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).');
Beispiel #4
0
}
if ($is_olsr_enabled) {
    $section->addInput(new Form_Select('netmask', 'Subnetmask', $pconfig['netmask'], array_combine(range(128, 1, -1), range(128, 1, -1))));
}
$f1 = new Form_Input('range_from', null, 'text', $pconfig['range_from']);
$f1->setHelp('To');
$f2 = new Form_Input('range_to', null, 'text', $pconfig['range_to']);
$f2->setHelp('From');
$group = new Form_Group('Range');
$group->add($f1);
$group->add($f2);
$section->add($group);
$f1 = new Form_Input('prefix_from', null, 'text', $pconfig['prefix_from']);
$f1->setHelp('To');
$f2 = new Form_Input('prefix_to', null, 'text', $pconfig['prefix_to']);
$f2->setHelp('From');
$group = new Form_Group('Prefix Delegation Range');
$group->add($f1);
$group->add($f2);
$section->add($group);
$section->addInput(new Form_Select('prefixrange_length', 'Prefix Delegation Size', $pconfig['prefixrange_length'], array('48' => '48', '52' => '52', '56' => '56', '60' => '60', '62' => '62', '63' => '63', '64' => '64')))->setHelp('You can define a Prefix range here for DHCP Prefix Delegation. This allows for assigning networks to subrouters. The start and end of the range must end on boundaries of the prefix delegation size.');
$group = new Form_Group('DNS Servers');
for ($i = 1; $i <= 4; $i++) {
    $group->add(new Form_input('dns' . $i, null, 'text', $pconfig['dns' . $i]))->setHelp('DNS ' . $i);
}
$group->setHelp('Leave blank to use the system default DNS servers,this interface\'s IP if DNS forwarder is enabled, or the servers configured on the "General" page.');
$section->add($group);
$section->addInput(new Form_Input('domain', 'Domain Name', 'text', $pconfig['domain']))->setHelp('The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here. ');
$section->addInput(new Form_Input('domainsearchlist', 'Domain search list', 'text', $pconfig['domainsearchlist']))->setHelp('The DHCP server can optionally provide a domain search list. Use the semicolon character as separator');
$section->addInput(new Form_Input('deftime', 'Default lease time', 'text', $pconfig['deftime']))->setHelp('Seconds . Used for clients that do not ask for a specific expiration time. ' . ' <br />' . 'The default is 7200 seconds.');
$section->addInput(new Form_Input('maxtime', 'Max lease time', 'text', $pconfig['maxtime']))->setHelp('Maximum lease time for clients that ask for a specific expiration time.' . ' <br />' . 'The default is 86400 seconds.');
        if (isset($id) && $a_secret[$id]) {
            $a_secret[$id] = $secretent;
        } else {
            $a_secret[] = $secretent;
        }
        l2tp_users_sort();
        write_config();
        $retval = vpn_l2tp_configure();
        pfSenseHeader("vpn_l2tp_users.php");
        exit;
    }
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section("User");
$section->addInput(new Form_Input('usernamefld', 'Username', 'text', $pconfig['usernamefld']));
$pwd = new Form_Input('passwordfld', 'Password', 'text', $pconfig['passwordfld']);
if (isset($id) && $a_secret[$id]) {
    $pwd->setHelp('If you want to change the users password, enter it here.');
}
$section->addPassword($pwd);
$section->addInput(new Form_IpAddress('ip', 'IP Address', $pconfig['ip']))->setHelp('If you want the user to be assigned a specific IP address, enter it here.');
$form->add($section);
if (isset($id) && $a_secret[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $i));
}
print $form;
include "foot.inc";
        if (isset($id) && $a_secret[$id]) {
            $a_secret[$id] = $secretent;
        } else {
            $a_secret[] = $secretent;
        }
        l2tp_users_sort();
        write_config();
        $retval = vpn_l2tp_configure();
        pfSenseHeader("vpn_l2tp_users.php");
        exit;
    }
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section("User");
$section->addInput(new Form_Input('usernamefld', 'Username', 'text', $pconfig['usernamefld']));
$pwd = new Form_Input('passwordfld', 'Password', 'text', $pconfig['passwordfld']);
if (isset($id) && $a_secret[$id]) {
    $pwd->setHelp('To change the users password, enter it here.');
}
$section->addPassword($pwd);
$section->addInput(new Form_IpAddress('ip', 'IP Address', $pconfig['ip']))->setHelp('To assign the user a specific IP address, enter it here.');
$form->add($section);
if (isset($id) && $a_secret[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $i));
}
print $form;
include "foot.inc";
}
if ($is_olsr_enabled) {
    $section->addInput(new Form_Select('netmask', 'Subnet Mask', $pconfig['netmask'], array_combine(range(128, 1, -1), range(128, 1, -1))));
}
$f1 = new Form_Input('range_from', null, 'text', $pconfig['range_from']);
$f1->setHelp('From');
$f2 = new Form_Input('range_to', null, 'text', $pconfig['range_to']);
$f2->setHelp('To');
$group = new Form_Group('Range');
$group->add($f1);
$group->add($f2);
$section->add($group);
$f1 = new Form_Input('prefixrange_from', null, 'text', $pconfig['prefixrange_from']);
$f1->setHelp('From');
$f2 = new Form_Input('prefixrange_to', null, 'text', $pconfig['prefixrange_to']);
$f2->setHelp('To');
$group = new Form_Group('Prefix Delegation Range');
$group->add($f1);
$group->add($f2);
$section->add($group);
$section->addInput(new Form_Select('prefixrange_length', 'Prefix Delegation Size', $pconfig['prefixrange_length'], array('48' => '48', '52' => '52', '56' => '56', '60' => '60', '62' => '62', '63' => '63', '64' => '64')))->setHelp('A Prefix range can be defined here for DHCP Prefix Delegation. This allows for assigning networks to subrouters. The start and end of the range must end on boundaries of the prefix delegation size.');
$group = new Form_Group('DNS Servers');
for ($i = 1; $i <= 4; $i++) {
    $group->add(new Form_input('dns' . $i, null, 'text', $pconfig['dns' . $i], ['placeholder' => 'DNS ' . $i]));
}
$group->setHelp('Leave blank to use the system default DNS servers, this interface\'s IP if DNS forwarder is enabled, or the servers configured on the "General" page.');
$section->add($group);
$section->addInput(new Form_Input('domain', 'Domain name', 'text', $pconfig['domain']))->setHelp('The default is to use the domain name of this system as the default domain name provided by DHCP. An alternate domain name may be specified here. ');
$section->addInput(new Form_Input('domainsearchlist', 'Domain search list', 'text', $pconfig['domainsearchlist']))->setHelp('The DHCP server can optionally provide a domain search list. Use the semicolon character as separator.');
$section->addInput(new Form_Input('deftime', 'Default lease time', 'text', $pconfig['deftime']))->setHelp('Lease time in seconds. Used for clients that do not ask for a specific expiration time. ' . ' <br />' . 'The default is 7200 seconds.');
$section->addInput(new Form_Input('maxtime', 'Max lease time', 'text', $pconfig['maxtime']))->setHelp('Maximum lease time for clients that ask for a specific expiration time.' . ' <br />' . 'The default is 86400 seconds.');