コード例 #1
0
ファイル: Section.class.php プロジェクト: jefersonJim/pfsense
 public function addInput(Form_Input $input)
 {
     $group = new Form_Group($input->getTitle());
     $group->add($input);
     $this->add($group);
     return $input;
 }
コード例 #2
0
ファイル: Form_Upload.php プロジェクト: xafr/gallery3
 public function validate()
 {
     // The upload directory must always be set
     empty($this->directory) and $this->directory();
     // By default, there is no uploaded file
     $filename = '';
     if ($status = parent::validate() and $this->upload['error'] === UPLOAD_ERR_OK) {
         // Set the filename to the original name
         $filename = $this->upload['name'];
         if (Kohana::config('upload.remove_spaces')) {
             // Remove spaces, due to global upload configuration
             $filename = preg_replace('/\\s+/', '_', $this->data['value']);
         }
         if (file_exists($filepath = $this->directory . $filename)) {
             if ($this->filename !== TRUE or !is_writable($filepath)) {
                 // Prefix the file so that the filename is unique
                 $filepath = $this->directory . 'uploadfile-' . uniqid(time()) . '-' . $this->upload['name'];
             }
         }
         // Move the uploaded file to the upload directory
         move_uploaded_file($this->upload['tmp_name'], $filepath);
     }
     if (!empty($_POST[$this->data['name']])) {
         // Reset the POST value to the new filename
         $this->data['value'] = $_POST[$this->data['name']] = empty($filepath) ? '' : $filepath;
     }
     return $status;
 }
コード例 #3
0
    protected function _getInput()
    {
        $element = parent::_getInput();
        $options = '';
        foreach ($this->_values as $value => $name) {
            // Things can get weird if we have mixed types
            $sval = $this->_value;
            if (gettype($value) == "integer" && gettype($sval) == "string") {
                $value = strval($value);
            }
            if (isset($this->_attributes['multiple'])) {
                $selected = in_array($value, (array) $sval);
            } else {
                $selected = $sval == $value;
            }
            if (!empty(trim($name)) || is_numeric($name)) {
                $name_str = htmlspecialchars(gettext($name));
            } else {
                // Fixes HTML5 validation: Element option without attribute label must not be empty
                $name_str = " ";
            }
            $options .= '<option value="' . htmlspecialchars($value) . '"' . ($selected ? ' selected' : '') . '>' . $name_str . '</option>';
        }
        return <<<EOT
\t{$element}
\t\t{$options}
\t</select>
EOT;
    }
コード例 #4
0
ファイル: Select.class.php プロジェクト: ffdesousa/pfsense
    protected function _getInput()
    {
        $element = parent::_getInput();
        $options = '';
        foreach ($this->_values as $value => $name) {
            // Things can get wierd if we have mixed types
            $sval = $this->_value;
            if (gettype($value) == "integer" && gettype($sval) == "string") {
                $value = strval($value);
            }
            if (isset($this->_attributes['multiple'])) {
                $selected = in_array($value, (array) $sval);
            } else {
                $selected = $sval == $value;
            }
            if (!empty($name) || $name == '0') {
                $options .= '<option value="' . htmlspecialchars($value) . '"' . ($selected ? ' selected' : '') . '>' . htmlspecialchars(gettext($name)) . '</option>';
            }
        }
        return <<<EOT
\t{$element}
\t\t{$options}
\t</select>
EOT;
    }
コード例 #5
0
ファイル: Form_File.class.php プロジェクト: Spuffynism/www
 public function is_valid($value)
 {
     $name = $this->attrs['name'];
     if (isset($_FILES[$name])) {
         $value = isset($_FILES[$name]) ? $_FILES[$name]['name'] : null;
         if (parent::is_valid($value)) {
             if (!$this->required) {
                 return true;
             }
             if (!empty($this->extensions)) {
                 $ext = pathinfo($value, PATHINFO_EXTENSION);
                 if (!in_array($ext, $this->extensions)) {
                     $this->_error('invalid_file_extension');
                     $valid = false;
                 }
             }
             if (0 < $this->max_size && $this->max_size < $_FILES[$name]['size']) {
                 $this->_error('file_too_big');
                 $valid = false;
             }
             return $_FILES[$name]['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES[$name]['tmp_name']);
         }
     }
     return false;
 }
コード例 #6
0
 protected function _getInput()
 {
     $input = parent::_getInput();
     if (!isset($this->_attributes['href'])) {
         return $input;
     }
     return $input . htmlspecialchars($this->_title) . '</a>';
 }
コード例 #7
0
 protected function _getInput()
 {
     $input = parent::_getInput();
     if (empty($this->_description)) {
         return '<label class="chkboxlbl">' . $input . '</label>';
     }
     return '<label class="chkboxlbl">' . $input . ' ' . htmlspecialchars(gettext($this->_description)) . '</label>';
 }
コード例 #8
0
 public function __get($key)
 {
     if ($key == 'value') {
         // Return the value if the checkbox is checked
         return $this->data['checked'] ? $this->data['value'] : NULL;
     }
     return parent::__get($key);
 }
コード例 #9
0
    protected function _getInput()
    {
        $element = parent::_getInput();
        $value = htmlspecialchars($this->_value);
        return <<<EOT
\t{$element}{$value}</textarea>
EOT;
    }
コード例 #10
0
 protected function _getInput()
 {
     $input = parent::_getInput();
     if (!isset($this->_description)) {
         return $input;
     }
     return '<label>' . $input . ' ' . htmlspecialchars(gettext($this->_description)) . '</label>';
 }
コード例 #11
0
ファイル: Form_Dateselect.php プロジェクト: JasonWiki/docs
 public function __call($method, $args)
 {
     if (isset($this->parts[substr($method, 0, -1)])) {
         // Set options for date generation
         $this->parts[substr($method, 0, -1)] = $args;
         return $this;
     }
     return parent::__call($method, $args);
 }
コード例 #12
0
 public function is_valid($value)
 {
     if (parent::is_valid($value)) {
         if ($this->required && !empty($this->value) && $value != $this->value) {
             $this->_error('incorrect_value');
             return false;
         }
         return true;
     }
     return false;
 }
コード例 #13
0
ファイル: Form_Select.class.php プロジェクト: Spuffynism/www
 public function is_valid($value)
 {
     if (parent::is_valid($value)) {
         if ($this->required && !in_array($value, $this->choices)) {
             $this->_error('incorrect_value');
             return false;
         }
         return true;
     }
     return false;
 }
コード例 #14
0
ファイル: Form_Checklist.php プロジェクト: JasonWiki/docs
 public function __get($key)
 {
     if ($key == 'value') {
         // Return the currently checked values
         $array = array();
         foreach ($this->data['options'] as $id => $opt) {
             // Return the options that are checked
             $opt[1] === TRUE and $array[] = $id;
         }
         return $array;
     }
     return parent::__get($key);
 }
コード例 #15
0
    protected function _getInput()
    {
        $input = parent::_getInput();
        if (!isset($this->_mask)) {
            return $input;
        }
        return <<<EOT
\t\t<div class="input-group">
\t\t\t{$input}
\t\t\t<span class="input-group-addon input-group-inbetween pfIpMask">/</span>
\t\t\t{$this->_mask}
\t\t</div>
EOT;
    }
コード例 #16
0
 public function validate()
 {
     // Validation has already run
     if (is_bool($this->is_valid)) {
         return $this->is_valid;
     }
     if ($this->input_value() == FALSE) {
         // No data to validate
         return $this->is_valid = FALSE;
     }
     // Load the submitted value
     $this->load_value();
     if (!array_key_exists($this->value, $this->data['options'])) {
         // Value does not exist in the options
         return $this->is_valid = FALSE;
     }
     return parent::validate();
 }
コード例 #17
0
 public function addPassword(Form_Input $input)
 {
     $group = new Form_Group($input->getTitle());
     if ($input->getValue() != "") {
         $input->setValue(DMYPWD);
     }
     $input->setType("password");
     $group->add($input);
     $confirm = clone $input;
     $confirm->setName($confirm->getName() . "_confirm");
     $confirm->setHelp("Confirm");
     $group->add($confirm);
     $this->add($group);
     return $input;
 }
コード例 #18
0
     $ro = "readonly";
 }
 $section = new Form_Section('User Properties');
 $section->addInput(new Form_StaticText('Defined by', strtoupper($pconfig['utype'])));
 $form->addGlobal(new Form_Input('utype', null, 'hidden', $pconfig['utype']));
 $section->addInput(new Form_Checkbox('disabled', 'Disabled', 'This user cannot login', $pconfig['disabled']));
 $section->addInput($input = new Form_Input('usernamefld', 'Username', 'text', $pconfig['usernamefld']));
 if ($ro) {
     $input->setReadonly();
 }
 $form->addGlobal(new Form_Input('oldusername', null, 'hidden', $pconfig['usernamefld']));
 $group = new Form_Group('Password');
 $group->add(new Form_Input('passwordfld1', 'Password', 'password'));
 $group->add(new Form_Input('passwordfld2', 'Confirm Password', 'password'));
 $section->add($group);
 $section->addInput($input = new Form_Input('descr', 'Full name', 'text', htmlspecialchars($pconfig['descr'])))->setHelp('User\'s full name, for your own information only');
 if ($ro) {
     $input->setDisabled();
 }
 $section->addInput(new Form_Input('expires', 'Expiration date', 'date', $pconfig['expires']))->setHelp('Leave blank if the account shouldn\'t expire, otherwise enter ' . 'the expiration date');
 // ==== Group membership ==================================================
 $group = new Form_Group('Group membership');
 // Make a list of all the groups configured on the system, and a list of
 // those which this user is a member of
 $systemGroups = array();
 $usersGroups = array();
 $usergid = [$pconfig['usernamefld']];
 foreach ($config['system']['group'] as $Ggroup) {
     if ($Ggroup['name'] != "all") {
         if ($act == 'edit' && $Ggroup['member'] && in_array($pconfig['uid'], $Ggroup['member'])) {
             $usersGroups[$Ggroup['name']] = $Ggroup['name'];
コード例 #19
0
ファイル: Form_Recaptcha.php プロジェクト: Joe7/gallery3
 public function __construct($name)
 {
     parent::__construct($name);
     $this->error_messages("incorrect-captcha-sol", t("The values supplied to reCAPTCHA are incorrect."));
     $this->error_messages("invalid-site-private-key", t("The site private key is incorrect."));
 }
コード例 #20
0
        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";
コード例 #21
0
ファイル: Form_Text.class.php プロジェクト: Spuffynism/www
 public function get_cleaned_value($value)
 {
     return parent::get_cleaned_value(preg_replace('`[\\x00-\\x19]`i', '', $value));
 }
コード例 #22
0
 public function __construct($title, $text)
 {
     parent::__construct(null, $title);
     $this->_text = $text;
 }
コード例 #23
0
        $list[$monthcounter] = date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
        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);
コード例 #24
0
}
$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');
コード例 #25
0
ファイル: Form_Hidden.class.php プロジェクト: Spuffynism/www
 public function __construct($name, $form)
 {
     parent::__construct($name, $form);
     $this->attrs['type'] = 'hidden';
 }
コード例 #26
0
ファイル: pkg_edit.php プロジェクト: nwholloway/pfsense
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;
    }
}
コード例 #27
0
<?php 
    include 'foot.inc';
    exit;
}
$form = new Form();
$form->setAction('system_groupmanager.php?act=edit');
$form->addGlobal(new Form_Input('groupid', null, 'hidden', $id));
if (isset($id) && $a_group[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
    $form->addGlobal(new Form_Input('gid', null, 'hidden', $pconfig['gid']));
}
$section = new Form_Section('Group Properties');
if ($_GET['act'] != "new") {
    $section->addInput(new Form_StaticText('Defined by', strtoupper($pconfig['gtype'])));
}
$section->addInput($input = new Form_Input('groupname', 'Group name', 'text', $pconfig['name']));
if ($pconfig['gtype'] == "system") {
    $input->setReadonly();
}
$section->addInput(new Form_Input('description', 'Description', 'text', $pconfig['description']))->setHelp('Group description, for your own information only');
$form->add($section);
if ($pconfig['gid'] != 1998) {
    // all users group
    // ==== Group membership ==================================================
    $group = new Form_Group('Group membership');
    // Make a list of all the groups configured on the system, and a list of
    // those which this user is a member of
    $systemGroups = array();
    $usersGroups = array();
    foreach ($config['system']['user'] as $user) {
        if (is_array($pconfig['members']) && in_array($user['uid'], $pconfig['members'])) {
コード例 #28
0
ファイル: services_dhcpv6.php プロジェクト: dariomas/pfsense
    $section->addInput(new Form_StaticText('Available Range', $range_from = gen_subnetv6($ifcfgip, $ifcfgsn) . ' to ' . gen_subnetv6_max($ifcfgip, $ifcfgsn)));
}
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.');
コード例 #29
0
ファイル: Form_Uploadify.php プロジェクト: Joe7/gallery3
 public function __construct($name)
 {
     parent::__construct($name);
     $this->data["script_data"] = array("g3sid" => Session::instance()->id(), "user_agent" => Input::instance()->server("HTTP_USER_AGENT"), "csrf" => access::csrf_token());
 }
コード例 #30
0
    $section->addInput(new Form_StaticText('Available Range', $range_from = gen_subnetv6($ifcfgip, $ifcfgsn) . ' to ' . gen_subnetv6_max($ifcfgip, $ifcfgsn)))->setHelp($trackifname ? 'Prefix Delegation subnet will be appended to the beginning of the defined range' : '');
}
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.');