コード例 #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
        $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, ' ' . $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[
events.push(function() {
コード例 #3
0
$section->add($group);
# System General (main) Specific
if ($logfile == 'system') {
    $section->addInput(new Form_Checkbox('loglighttpd', 'Web Server Log', 'Log errors from the web server process', $pconfig['loglighttpd']))->setHelp('If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the system log.');
}
# Firewall Specific
if ($logfile == 'filter') {
    $section->addInput(new Form_Checkbox('logdefaultblock', 'Log firewall default blocks', 'Log packets matched from the default block rules in the ruleset', $pconfig['logdefaultblock']))->setHelp('Packets that are blocked by the implicit default block rule will not be logged if this option is unchecked. Per-rule logging options are still respected.');
    $section->addInput(new Form_Checkbox('logdefaultpass', null, 'Log packets matched from the default pass rules put in the ruleset', $pconfig['logdefaultpass']))->setHelp('Packets that are allowed by the implicit default pass rule will be logged if this option is checked. Per-rule logging options are still respected. ');
    $section->addInput(new Form_Checkbox('logbogons', null, 'Log packets blocked by \'Block Bogon Networks\' rules', $pconfig['logbogons']));
    $section->addInput(new Form_Checkbox('logprivatenets', null, 'Log packets blocked by \'Block Private Networks\' rules', $pconfig['logprivatenets']));
    $section->addInput(new Form_Select('filterdescriptions', 'Where to show rule descriptions', !isset($pconfig['filterdescriptions']) ? '0' : $pconfig['filterdescriptions'], array('0' => 'Dont load descriptions', '1' => 'Display as column', '2' => 'Display as second row')))->setHelp('Show the applied rule description below or in the firewall log rows' . '<br />' . 'Displaying rule descriptions for all lines in the log might affect performance with large rule sets');
}
$group = new Form_Group('Action');
$btnsavesettings = new Form_Button('save_settings', gettext('Save'), null);
$btnsavesettings->addClass('btn-sm');
$group->add(new Form_StaticText('', $btnsavesettings))->setHelp('Saves changed settings.');
$btnclear = new Form_Button('clear', ' ' . gettext('Clear log'), null, 'fa-trash');
$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
$group->add(new Form_StaticText('', $btnclear))->setHelp('Clears local log file and reinitializes it as an empty log. Save any settings changes first.');
$section->add($group);
$form->add($section);
print $form;
?>


<!-- AJAXY STUFF -->
<script type="text/javascript">
//<![CDATA[
function outputrule(req) {
	alert(req.content);
コード例 #4
0
$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>
					<tr>
コード例 #5
0
ファイル: diag_smart.php プロジェクト: NewEraCracker/pfsense
        $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";
コード例 #6
0
$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;
    $jdescs = "var descs = new Array();\n";
コード例 #7
0
ファイル: system_firmware.php プロジェクト: dariomas/pfsense
 " />
		<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));
                if (stristr($_FILES['ulfile']['name'], "nanobsd")) {
コード例 #8
0
        }
    }
}
$section->addInput(new Form_StaticText('Available range', $rangestr));
if ($is_olsr_enabled) {
    $section->addInput(new Form_Select('netmask', 'Subnet mask', $pconfig['netmask'], array_combine(range(32, 1, -1), range(32, 1, -1))));
}
$group = new Form_Group('Range');
$group->add(new Form_IpAddress('range_from', null, $pconfig['range_from']))->setHelp('From');
$group->add(new Form_IpAddress('range_to', null, $pconfig['range_to']))->setHelp('To');
$section->add($group);
$form->add($section);
if (!is_numeric($pool) && !($act == "newpool")) {
    $section = new Form_Section('Additional Pools');
    $btnaddpool = new Form_Button('btnaddpool', 'Add pool', 'services_dhcp.php?if=' . htmlspecialchars($if) . '&act=newpool', 'fa-plus');
    $btnaddpool->addClass('btn-success');
    $section->addInput(new Form_StaticText('Add', $btnaddpool))->setHelp('If additional pools of addresses are needed inside of this subnet outside the above Range, they may be specified here.');
    if (is_array($a_pools)) {
        $section->addInput(new Form_StaticText(null, build_pooltable()));
    }
    $form->add($section);
}
$section = new Form_Section('Servers');
$section->addInput(new Form_IpAddress('wins1', 'WINS servers', $pconfig['wins1']))->setPattern('[.a-zA-Z0-9_]+')->setAttribute('placeholder', 'WINS Server 1');
$section->addInput(new Form_IpAddress('wins2', null, $pconfig['wins2']))->setPattern('[.a-zA-Z0-9_]+')->setAttribute('placeholder', 'WINS Server 2');
for ($idx = 1; $idx <= 4; $idx++) {
    $section->addInput(new Form_IpAddress('dns' . $idx, $idx == 1 ? 'DNS servers' : null, $pconfig['dns' . $idx]))->setPattern('[.a-zA-Z0-9_]+')->setAttribute('placeholder', 'DNS Server ' . $idx)->setHelp($idx == 4 ? 'Leave blank to use the system default DNS servers: this interface\'s IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the System / General Setup page.' : '');
}
$form->add($section);
$section = new Form_Section('Other Options');
$section->addInput(new Form_IpAddress('gateway', 'Gateway', $pconfig['gateway']))->setPattern('[.a-zA-Z0-9_]+')->setHelp('The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for the network. Type "none" for no gateway assignment.');
コード例 #9
0
if (!$pconfig['numberoptions']) {
    $noopts = true;
    $pconfig['numberoptions']['item'] = array(0 => array('number' => "", 'value' => ""));
} else {
    $noopts = false;
}
$counter = 0;
$last = count($pconfig['numberoptions']['item']) - 1;
foreach ($pconfig['numberoptions']['item'] as $item) {
    $group = new Form_Group(null);
    $group->addClass('repeatable');
    $group->addClass('adnloptions');
    $group->add(new Form_Input('number' . $counter, null, 'text', $item['number']))->setHelp($counter == $last ? 'Number' : null);
    $group->add(new Form_Input('value' . $counter, null, 'text', base64_decode($item['value'])))->setHelp($counter == $last ? 'Value' : null);
    $btn = new Form_Button('deleterow' . $counter, 'Delete', null, 'fa-trash');
    $btn->addClass('btn-warning');
    $group->add($btn);
    $section->add($group);
    $counter++;
}
$btnaddopt = new Form_Button('addrow', 'Add Option', null, 'fa-plus');
$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm');
$section->addInput($btnaddopt);
$section->addInput(new Form_Input('if', null, 'hidden', $if));
print $form;
?>
<div class="infoblock blockopen">
<?php 
print_info_box(sprintf(gettext('The DNS servers entered in %1$sSystem: General Setup%3$s (or the %2$sDNS forwarder%3$s if enabled) will be assigned to clients by the DHCP server.'), '<a href="system.php">', '<a href="services_dnsmasq.php"/>', '</a>') . '<br />' . sprintf(gettext('The DHCP lease table can be viewed on the %1$sStatus: DHCPv6 leases%2$s page.'), '<a href="status_dhcpv6_leases.php">', '</a>'), 'info', false);
?>
</div>
コード例 #10
0
ファイル: pkg_edit.php プロジェクト: LFCavalcanti/pfsense
         }
     }
     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";
     if (is_array($config['schedules']['schedule'])) {
コード例 #11
0
);
$permbtn->addClass('btn-primary 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, null, 'fa-clone');
$dupbtn->addClass('btn-success btn-sm');
$section->addInput(new Form_StaticText('Duplicate boot slice', $dupbtn))->setHelp('This will duplicate the bootup slice to the alternate slice.  Use this 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', null, 'fa-file-text-o');
    $viewbtn->addClass('btn-primary 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"));