Example #1
0
                 shell_exec("/usr/bin/killall -HUP smartd");
             }
         }
     }
     // Was the config changed? if so, print the message
     if ($savemsg) {
         print_info_box($savemsg, $style);
     }
     // Get users email from the xml file
     $pconfig['smartmonemail'] = $config['system']['smartmonemail'];
     $form = new Form();
     $section = new Form_Section('Configuration');
     $section->addInput(new Form_Input('smartmonemail', 'Email Address', 'text', $pconfig['smartmonemail']));
     $form->add($section);
     if (!empty($pconfig['smartmonemail'])) {
         $form->addGlobal(new Form_Button('test', 'Send test email', null, 'fa-send'))->addClass('btn-info');
     }
     print $form;
     break;
     // Default page, prints the forms to view info, test, etc...
 // Default page, prints the forms to view info, test, etc...
 default:
     // Information
     $devs = get_smart_drive_list();
     $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('Information');
     $section->addInput(new Form_Input('action', null, 'hidden', 'info'))->setAttribute('id');
     $group = new Form_Group('Info type');
        $input_errors[] = gettext("The zone name can only contain letters, digits, and underscores ( _ ).");
    }
    foreach ($a_cp as $cpkey => $cpent) {
        if ($cpent['zone'] == $_POST['zone']) {
            $input_errors[] = sprintf(gettext("Zone [%s] already exists."), $_POST['zone']);
            break;
        }
    }
    if (!$input_errors) {
        $cpzone = strtolower($_POST['zone']);
        $a_cp[$cpzone] = array();
        $a_cp[$cpzone]['zone'] = str_replace(" ", "", $_POST['zone']);
        $a_cp[$cpzone]['descr'] = $_POST['descr'];
        $a_cp[$cpzone]['localauth_priv'] = true;
        write_config();
        header("Location: services_captiveportal.php?zone={$cpzone}");
        exit;
    }
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form(false);
$section = new Form_Section('Add Captive Portal Zone');
$section->addInput(new Form_Input('zone', 'Zone name'))->setPattern('[0-9A-Za-z_]+')->setHelp('Zone name. Can only contain letters, digits, and underscores (_).');
$section->addInput(new Form_Input('descr', 'Zone description'))->setHelp('A description may be entered here for administrative reference (not parsed).');
$form->add($section);
$form->addGlobal(new Form_Button('Submit', 'Save & Continue', null, 'fa-save'))->addClass('btn-primary');
print $form;
include "foot.inc";
Example #3
0
    $group->add(new Form_Input('auth_server_port', 'Port', 'number', $pconfig['auth_server_port']))->setHelp('Server port. Leave blank for the default port 1812');
    $group->add(new Form_Input('auth_server_shared_secret', 'Shared secret', 'number', $pconfig['auth_server_shared_secret']))->setHelp('Shared secret');
    $section->add($group);
    $group = new Form_Group('Secondary 802.1X server');
    $group->add(new Form_IpAddress('auth_server_addr2', 'IP Address', $pconfig['auth_server_addr2']))->setHelp('IP address.  (Commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)');
    $group->add(new Form_Input('auth_server_port2', 'Port', 'number', $pconfig['auth_server_port2']))->setHelp('Server port. Leave blank for the default port 1812');
    $group->add(new Form_Input('auth_server_shared_secret2', 'Shared secret', 'number', $pconfig['auth_server_shared_secret2']))->setHelp('Shared secret');
    $section->add($group);
    $section->addInput(new Form_Checkbox('rsn_preauth', 'Authentication Roaming Preauth', null, $pconfig['rsn_preauth'], 'yes'));
    $form->add($section);
}
$section = new Form_Section('Private networks');
$section->addInput(new Form_Checkbox('blockpriv', 'Block private networks', '', $pconfig['blockpriv'], 'yes'))->setHelp('Blocks traffic from IP addresses that are reserved for private networks per RFC 1918 (10/8, 172.16/12, 192.168/16) ' . ' as well as loopback addresses (127/8). You should generally leave this option turned on, unless your WAN network ' . 'lies in such a private address space, too.');
$section->addInput(new Form_Checkbox('blockbogons', 'Block bogon networks', '', $pconfig['blockbogons'], 'yes'))->setHelp('Blocks traffic from reserved IP addresses (but not RFC 1918) or not yet assigned by IANA. Bogons are prefixes that should ' . 'never appear in the Internet routing table, and so should not appear as the source address in any packets you receive.' . '<br />' . 'Note: The update frequency can be changed under System->Advanced Firewall/NAT settings');
$form->add($section);
$form->addGlobal(new Form_Input('if', null, 'hidden', $if));
if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
    $form->addGlobal(new Form_Input('ppp_port', null, 'hidden', $pconfig['port']));
}
$form->addGlobal(new Form_Input('ptpid', null, 'hidden', $pconfig['ptpid']));
print $form;
?>

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

	function updateType(t) {
		switch (t) {
			case "none": {
				$('.dhcpadvanced, .staticv4, .dhcp, .pppoe, .pptp, .ppp').hide();
    $section->addInput(new Form_Input('description', 'Description', 'text', $pconfig['description']))->setHelp('You may enter a description here for your reference.');
    $numrows = count($networkacl) - 1;
    $counter = 0;
    foreach ($networkacl as $item) {
        $network = $item['acl_network'];
        $cidr = $item['mask'];
        $description = $item['description'];
        $group = new Form_Group($counter == 0 ? 'Networks' : '');
        $group->add(new Form_IpAddress('acl_network' . $counter, null, $network))->addMask('mask' . $counter, $cidr)->setWidth(4)->setHelp($counter == $numrows ? 'Network/mask' : null);
        $group->add(new Form_Input('description' . $counter, null, 'text', $description))->setHelp($counter == $numrows ? 'Description' : null);
        $group->add(new Form_Button('deleterow' . $counter, 'Delete'))->removeClass('btn-primary')->addClass('btn-warning');
        $group->addClass('repeatable');
        $section->add($group);
        $counter++;
    }
    $form->addGlobal(new Form_Button('addrow', 'Add network'))->removeClass('btn-primary')->addClass('btn-success');
    $form->add($section);
    print $form;
} else {
    // NOT 'edit' or 'add'
    ?>
<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?php 
    echo gettext('Access Lists to control access to the DNS Resolver');
    ?>
</h2></div>
	<div class="panel-body">
		<div class="table-responsive">
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
				<thead>
					<tr>
Example #5
0
    if (!$resolved && $type) {
        print_info_box(sprintf(gettext('Host "%s" could not be resolved.'), $host), 'warning', false);
    }
}
if ($createdalias) {
    if ($alias_exists) {
        print_info_box(gettext("Alias was updated successfully."), 'success');
    } else {
        print_info_box(gettext("Alias was created successfully."), 'success');
    }
}
$form = new Form(false);
$section = new Form_Section('DNS Lookup');
$section->addInput(new Form_Input('host', 'Hostname', 'text', $host, ['placeholder' => 'Hostname to look up.']));
$form->add($section);
$form->addGlobal(new Form_Button('Submit', 'Lookup', null, 'fa-search'))->addClass('btn-primary');
if (!empty($resolved)) {
    if ($alias_exists) {
        $button_text = gettext("Update alias");
    } else {
        $button_text = gettext("Add alias");
    }
    $form->addGlobal(new Form_Button('create_alias', $button_text, null, 'fa-plus'))->removeClass('btn-primary')->addClass('btn-success');
}
print $form;
if (!$input_errors && $type) {
    if ($resolved) {
        ?>
<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?php 
        echo gettext('Results');
    $flagtable .= '<strong>' . gettext(" Any flags.") . '</strong>';
    return $flagtable;
}
$pgtitle = array(gettext("Firewall"), gettext("Rules"), gettext("Edit"));
$shortcut_section = "firewall";
$closehead = false;
$page_filename = "firewall_rules_edit.php";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
require_once 'classes/Form.class.php';
$form = new Form();
$section = new Form_Section('Edit Firewall rule');
if (isset($id)) {
    $form->addGlobal(new Form_Input('id', 'ID', 'hidden', $id));
}
if (isset($a_filter[$id])) {
    $form->addGlobal(new Form_Input('tracker', 'Tracker', 'hidden', $pconfig['tracker']));
}
$form->addGlobal(new Form_Input('after', 'After', 'hidden', $after));
$form->addGlobal(new Form_Input('ruleid', 'Ruleid', 'hidden', $pconfig['ruleid']));
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/htmlphpearly");
$values = array('pass' => 'Pass', 'block' => 'Block', 'reject' => 'Reject');
if ($if == "FloatingRules" || isset($pconfig['floating'])) {
    $values['match'] = 'Match';
}
$section->addInput(new Form_Select('type', 'Action', $pconfig['type'], $values))->setHelp('Choose what to do with packets that match the criteria specified ' . 'below.<br/>Hint: the difference between block and reject is that with ' . 'reject, a packet (TCP RST or ICMP port unreachable for UDP) is returned ' . 'to the sender, whereas with block the packet is dropped silently. In ' . 'either case, the original packet is discarded.');
$section->addInput(new Form_Checkbox('disabled', 'Disabled', 'Disable this rule', $pconfig['disabled']))->setHelp('Set this option to disable this rule without removing it from the ' . 'list.');
if ($if == "FloatingRules" || isset($pconfig['floating'])) {
if (empty($tab)) {
    if (preg_match("/url/i", $pconfig['type'])) {
        $tab = 'url';
    } else {
        if ($pconfig['type'] == 'host') {
            $tab = 'ip';
        } else {
            $tab = $pconfig['type'];
        }
    }
}
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$form->addGlobal(new Form_Input('tab', null, 'hidden', $tab));
$form->addGlobal(new Form_Input('tab', null, 'hidden', $tab));
$form->addGlobal(new Form_Input('origname', null, 'hidden', $pconfig['name']));
if (isset($id) && $a_aliases[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$section = new Form_Section('Properties');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']))->setPattern('[a-zA-Z0-9_]+')->setHelp('The name of the alias may only consist ' . 'of the characters "a-z, A-Z, 0-9 and _".');
$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_Select('type', 'Type', isset($pconfig['type']) ? $pconfig['type'] : $tab, $types));
$form->add($section);
$section = new Form_Section($section_str[$tab]);
// Make somewhere to park the help text, and give it a class so we can update it later
$section->addInput(new Form_StaticText('Hint', '<span class="helptext">' . $help[$tab] . '</span>'));
// If no addresses have been defined, we'll make up a blank set
if ($pconfig['address'] == "") {
Example #8
0
             // Send sig HUP to smartd, rereads the config file
             shell_exec("/usr/bin/killall -HUP smartd");
         }
     }
     // Was the config changed? if so, print the message
     if ($savemsg) {
         print_info_box($savemsg, $style);
     }
     // Get users email from the xml file
     $pconfig['smartmonemail'] = $config['system']['smartmonemail'];
     $form = new Form();
     $section = new Form_Section('Configuration');
     $section->addInput(new Form_Input('smartmonemail', 'Email Address', 'text', $pconfig['smartmonemail']));
     $form->add($section);
     if (!empty($pconfig['smartmonemail'])) {
         $form->addGlobal(new Form_Button('test', 'Send test email'))->removeClass('btn-primary')->addClass('btn-default');
     }
     print $form;
     break;
     // Default page, prints the forms to view info, test, etc...
 // Default page, prints the forms to view info, test, etc...
 default:
     // Information
     $devs = get_smart_drive_list();
     $form = new Form(false);
     $btnview = new Form_Button('submit', 'View');
     $section = new Form_Section('Information');
     $section->addInput(new Form_Input('action', null, 'hidden', 'info'));
     $group = new Form_Group('Info type');
     $group->add(new Form_Checkbox('type', null, 'Info', false, 'i'))->displayAsRadio();
     $group->add(new Form_Checkbox('type', null, 'Health', true, 'H'))->displayAsRadio();
        $pconfig = $_POST;
        if (empty($_POST['friendlyiface'])) {
            $pconfig['friendlyiface'] = $_POST['interface'];
        }
    }
}
$pgtitle = array(gettext("System"), gettext("Routing"), gettext("Gateways"), gettext("Edit"));
$shortcut_section = "gateways";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$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();
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'success');
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("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']);
$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);
Example #11
0
<!-- Draw a progress bar to show step progress -->
<div class="progress">
	<div class="progress-bar" role="progressbar" aria-valuenow="<?php 
echo $completion;
?>
" aria-valuemin="0" aria-valuemax="100" style="width:<?php 
echo $completion;
?>
%">
	</div>
</div>

<?php 
$form = new Form(false);
$form->addGlobal(new Form_Input('stepid', null, 'hidden', $stepid));
$form->addGlobal(new Form_Input('xml', null, 'hidden', $xml));
$section = new Form_Section(fixup_string($title));
if ($description) {
    $section->addInput(new Form_StaticText(null, fixup_string($description)));
}
$inputaliases = array();
if ($pkg['step'][$stepid]['fields']['field'] != "") {
    foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
        $value = $field['value'];
        $name = $field['name'];
        $name = preg_replace("/\\s+/", "", $name);
        $name = strtolower($name);
        if ($field['bindstofield'] != "") {
            $arraynum = "";
            $field_conv = "";
    print_info_box($savemsg, 'success');
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), true, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
$form = new Form();
$section = new Form_Section('User privileges');
$section->addInput(new Form_Select('sysprivs', 'Assigned privileges', null, 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);
if (isset($userid)) {
    $section->addInput(new Form_Input('userid', null, 'hidden', $userid));
}
$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() {
Example #13
0
}
$form->add($section);
$has_created_time = isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']);
$has_updated_time = isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['updated']);
if ($has_created_time || $has_updated_time) {
    $section = new Form_Section('Rule Information');
    if ($has_created_time) {
        $section->addInput(new Form_StaticText('Created', date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) . gettext(" by ") . $a_nat[$id]['created']['username']));
    }
    if ($has_updated_time) {
        $section->addInput(new Form_StaticText('Updated', date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) . gettext(" by ") . $a_nat[$id]['updated']['username']));
    }
    $form->add($section);
}
if (isset($id) && $a_nat[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$form->addGlobal(new Form_Input('after', null, 'hidden', $after));
print $form;
?>

<script type="text/javascript">
//<![CDATA[
events.push(function() {
	var portsenabled = 1;
	var dstenabled = 1;
	var showsource = 0;
	var iface_old = '';

	// ---------- jQuery functions, lovingly converted from the original javascript------------------------------------------
	function ext_change() {
    print_info_box($savemsg);
}
if ($save_and_test) {
    echo "<script>\n";
    echo "myRef = window.open('system_usermanager_settings_test.php?authserver=" . $pconfig['authmode'] . "','mywin','left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
    echo "if (myRef==null || typeof(myRef)=='undefined') alert('" . gettext("Popup blocker detected.  Action aborted.") . "');\n";
    echo "</script>\n";
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
/* Default to pfsense backend type if none is defined */
if (!$pconfig['backend']) {
    $pconfig['backend'] = "pfsense";
}
require_once 'classes/Form.class.php';
$form = new Form();
$section = new Form_Section('Settings');
$section->addInput(new Form_Input('session_timeout', 'Session timeout', 'number', $pconfig['session_timeout']))->setHelp('Time in minutes to expire idle management sessions. The default is 4 ' . 'hours (240 minutes).Enter 0 to never expire sessions. NOTE: This is a security ' . 'risk!');
$auth_servers = array();
foreach (auth_get_authserver_list() as $auth_server) {
    $auth_servers[$auth_server['name']] = $auth_server['name'];
}
$section->addInput(new Form_Select('authmode', 'Authentication Server', $pconfig['authmode'], $auth_servers));
$form->addGlobal(new Form_Button('savetest', 'Save & Test'))->removeClass('btn-primary')->addClass('btn-default');
$form->add($section);
print $form;
include "fend.inc";
Example #15
0
</nav>
</form>

<div class="infoblock">
	<?php 
    echo print_info_box(gettext("Additional users can be added here. User permissions for accessing " . "the webConfigurator can be assigned directly or inherited from group memberships. " . "An icon that appears grey indicates that it is a system defined object. " . "Some system object properties can be modified but they cannot be deleted.") . '<br /><br />' . gettext("Accounts added here are also used for other parts of the system " . "such as OpenVPN, IPsec, and Captive Portal."), 'info');
    ?>
</div>

<?php 
    include "foot.inc";
    exit;
}
$form = new Form();
if ($act == "new" || $act == "edit" || $input_errors) {
    $form->addGlobal(new Form_Input('act', null, 'hidden', ''));
    $form->addGlobal(new Form_Input('userid', null, 'hidden', isset($id) ? $id : ''));
    $form->addGlobal(new Form_Input('privid', null, 'hidden', ''));
    $form->addGlobal(new Form_Input('certid', null, 'hidden', ''));
    $ro = "";
    if ($pconfig['utype'] == "system") {
        $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();
    }
$section = new Form_Section('QinQ Configuration');
$section->addInput(new Form_Select('if', 'Parent interface', $pconfig['if'], build_parent_list()))->setHelp('Only QinQ capable interfaces will be shown.');
$section->addInput(new Form_Input('tag', 'First level tag', 'number', $pconfig['tag'], ['max' => '4094', 'min' => '1']))->setHelp('This is the first level VLAN tag. On top of this are stacked the member VLANs defined below.');
$section->addInput(new Form_Checkbox('autogroup', 'Option(s)', 'Adds interface to QinQ interface groups', $pconfig['autogroup']))->setHelp('Allows rules to be written more easily.');
$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_StaticText('Member(s)', 'Ranges can be specified in the inputs below. Enter a range (2-3) or individual numbers.' . '<br />' . 'Click "Duplicate" as many times as needed to add new inputs.'));
if (isset($id) && $a_qinqs[$id]) {
    $section->addInput(new Form_Input('id', null, 'hidden', $id));
}
$counter = 0;
$members = $pconfig['members'];
// List each of the member tags from the space-separated list
if ($members != "") {
    $item = explode(" ", $members);
} else {
    $item = array('');
}
foreach ($item as $ww) {
    $member = $item[$counter];
    $group = new Form_Group($counter == 0 ? 'Tag(s)' : '');
    $group->addClass('repeatable');
    $group->add(new Form_Input('members[]', null, 'text', $ww))->setWidth(6);
    // Width must be <= 8 to make room for the duplication buttons
    $group->add(new Form_Button('deleterow' . $counter, 'Delete', null, 'fa-trash'))->addClass('btn-warning');
    $counter++;
    $section->add($group);
}
$form->addGlobal(new Form_Button('addrow', 'Add Tag', null, 'fa-plus'))->addClass('btn-success addbtn');
$form->add($section);
print $form;
include "foot.inc";
    if (preg_match("/url/i", $pconfig['type'])) {
        $tab = 'url';
    } else {
        if ($pconfig['type'] == 'host') {
            $tab = 'ip';
        } else {
            $tab = $pconfig['type'];
        }
    }
}
if ($input_errors) {
    print_input_errors($input_errors);
}
require 'classes/Form.class.php';
$form = new Form();
$form->addGlobal(new Form_Input('tab', null, 'hidden', $tab));
$form->addGlobal(new Form_Input('tab', null, 'hidden', $tab));
$form->addGlobal(new Form_Input('origname', null, 'hidden', $pconfig['name']));
if (isset($id) && $a_aliases[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$section = new Form_Section('Properties');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']))->setPattern('[a-zA-Z0-9_]+')->setHelp('The name of the alias may only consist ' . 'of the characters "a-z, A-Z, 0-9 and _".');
$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_Select('type', 'Type', isset($pconfig['type']) ? $pconfig['type'] : $tab, $types));
$form->add($section);
$section = new Form_Section($section_str[$tab]);
// Make somewhere to park the help text, and give it a class so we can update it later
$section->addInput(new Form_StaticText('Hint', '<span class="helptext">' . $help[$tab] . '</span>'));
// If no addresses have been defined, we'll make up a blank set
if ($pconfig['address'] == "") {
Example #18
0
    if (!empty($_REQUEST['filter'])) {
        $netstat .= " | /usr/bin/sed -e '1,3d; 5,\$ { /" . escapeshellarg(htmlspecialchars($_REQUEST['filter'])) . "/!d; };'";
    } else {
        $netstat .= " | /usr/bin/sed -e '1,3d'";
    }
    if (is_numeric($_REQUEST['limit']) && $_REQUEST['limit'] > 0) {
        $netstat .= " | /usr/bin/head -n {$_REQUEST['limit']}";
    }
    echo htmlspecialchars_decode(shell_exec($netstat));
    exit;
}
$pgtitle = array(gettext("Diagnostics"), gettext("Routing tables"));
$shortcut_section = "routing";
include 'head.inc';
$form = new Form('Update');
$form->addGlobal(new Form_Input('isAjax', null, 'hidden', 1));
$section = new Form_Section('Routing Table Display Options');
$section->addInput(new Form_Checkbox('resolve', 'Resolve names', 'Enable', $resolve))->setHelp('Enabling name resolution may cause the query to take longer.' . ' You can stop it at any time by clicking the Stop button in your browser.');
$validLimits = array('10', '50', '100', '200', '500', '1000', 'all');
$section->addInput(new Form_Select('limit', 'Rows to display', $limit, array_combine($validLimits, $validLimits)));
$section->addInput(new Form_Input('filter', 'Filter', 'text', $host))->setHelp('Use a regular expression to filter IP address or hostnames');
$form->add($section);
print $form;
?>
<script>
function update_routes(section) {
	$.ajax(
		'/diag_routes.php',
		{
			type: 'post',
			data: $(document.forms[0]).serialize() +'&'+ section +'=true',
if ($input_errors) {
    print_input_errors($input_errors);
}
?>
<div id="inputerrors"></div>
<?php 
$tab_array = array();
$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
$tab_array[1] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
$tab_array[7] = array(gettext("GRE"), false, "interfaces_gre.php");
$tab_array[8] = array(gettext("GIF"), false, "interfaces_gif.php");
$tab_array[9] = array(gettext("Bridges"), false, "interfaces_bridge.php");
$tab_array[10] = array(gettext("LAGG"), false, "interfaces_lagg.php");
display_top_tabs($tab_array);
$form = new Form();
$section = new Form_Section('Interface Group Configuration');
$section->addInput(new Form_Input('ifname', 'Group Name', 'text', $pconfig['ifname'], ['placeholder' => 'Group Name']))->setWidth(6)->setHelp('No numbers or spaces are allowed. ' . 'Only characters in a-zA-Z');
$section->addInput(new Form_Input('descr', 'Group Description', 'text', $pconfig['descr'], ['placeholder' => 'Group Description']))->setWidth(6)->setHelp('You may enter a group decsription ' . 'here for your reference (not parsed)');
$section->addInput(new Form_Select('members', 'Group Members', explode(' ', $pconfig['members']), $interface_list, true))->setWidth(6)->setHelp('NOTE: Rules for WAN type ' . 'interfaces in groups do not contain the reply-to mechanism upon which ' . 'Multi-WAN typically relies. ' . '<a href="https://doc.pfsense.org/index.php/ifgroups">More Information</a>');
if (isset($id) && $a_ifgroups[$id]) {
    $form->addGlobal(new Form_Input('id', 'id', 'hidden', $id));
}
$form->add($section);
print $form;
unset($interface_list);
unset($interface_list_disabled);
include "foot.inc";
$tab_array = array();
$tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MACs"), false, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php?zone={$cpzone}");
$tab_array[] = array(gettext("File Manager"), true, "services_captiveportal_filemanager.php?zone={$cpzone}");
display_top_tabs($tab_array, true);
if ($_GET['act'] == 'add') {
    $form = new Form(false);
    $form->setMultipartEncoding();
    $section = new Form_Section('Upload a New File');
    $section->addInput(new Form_Input('zone', null, 'hidden', $cpzone));
    $section->addInput(new Form_Input('new', 'File', 'file'));
    $form->add($section);
    $form->addGlobal(new Form_Button('Submit', 'Upload', null, 'fa-upload'))->addClass('btn-primary');
    print $form;
}
if (is_array($a_cp[$cpzone]['element'])) {
    ?>
	<div class="panel panel-default">
		<div class="panel-heading"><h2 class="panel-title"><?php 
    echo gettext("Installed Files");
    ?>
</h2></div>
		<div class="panel-body">
			<div class="table-responsive">
				<table class="table table-striped table-hover table-condensed">
					<thead>
						<tr>
							<th><?php 
Example #21
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');
}
$js_array = array();
// Now loop through all of the fields defined in the XML
foreach ($pkg['fields']['field'] as $pkga) {
    $action = "";
    $uid = "";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, success);
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("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']);
$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;');
$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(){
Example #23
0
$form->add($section);
if ($pconfig['netboot']) {
    $sectate = COLLAPSIBLE | SEC_OPEN;
} else {
    $sectate = COLLAPSIBLE | SEC_CLOSED;
}
$section = new Form_Section("Network Booting", nwkbootsec, $sectate);
$section->addInput(new Form_Checkbox('netboot', 'Enable', 'Enables network booting', $pconfig['netboot']));
$section->addInput(new Form_IpAddress('nextserver', 'Next Server', $pconfig['nextserver']))->setHelp('Enter the IP address of the next server');
$section->addInput(new Form_Input('filename', 'Default BIOS file name', 'text', $pconfig['filename']));
$section->addInput(new Form_Input('filename32', 'UEFI 32 bit file name', 'text', $pconfig['filename32']));
$section->addInput(new Form_Input('filename64', 'UEFI 64 bit file name', 'text', $pconfig['filename64']))->setHelp('You need both a filename and a boot server configured for this to work! ' . 'You will need all three filenames and a boot server configured for UEFI to work! ');
$section->addInput(new Form_Input('rootpath', 'Root path', 'text', $pconfig['rootpath']))->setHelp('string-format: iscsi:(servername):(protocol):(port):(LUN):targetname ');
$form->add($section);
if ($act == "newpool") {
    $form->addGlobal(new Form_Input('act', null, 'hidden', 'newpool'));
}
if (is_numeric($pool)) {
    $form->addGlobal(new Form_Input('pool', null, 'hidden', $pool));
}
$form->addGlobal(new Form_Input('if', null, 'hidden', $if));
print $form;
// DHCP Static Mappings table
if (!is_numeric($pool) && !($act == "newpool")) {
    ?>

<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?php 
    echo gettext("DHCP Static Mappings for this Interface");
    ?>
</h2></div>
Example #24
0
<!-- Draw a progress bar to show step progress -->
<div class="progress">
	<div class="progress-bar" role="progressbar" aria-valuenow="<?php 
echo $completion;
?>
" aria-valuemin="0" aria-valuemax="100" style="width:<?php 
echo $completion;
?>
%">
	</div>
</div>

<?php 
$form = new Form(false);
$form->addGlobal(new Form_Input('stepid', null, 'hidden', $stepid));
$form->addGlobal(new Form_Input('xml', null, 'hidden', $xml));
$section = new Form_Section(fixup_string($title));
if ($description) {
    $section->addInput(new Form_StaticText(null, fixup_string($description)));
}
$inputaliases = array();
if ($pkg['step'][$stepid]['fields']['field'] != "") {
    foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
        $value = $field['value'];
        $name = $field['name'];
        $name = preg_replace("/\\s+/", "", $name);
        $name = strtolower($name);
        if ($field['bindstofield'] != "") {
            $arraynum = "";
            $field_conv = "";
Example #25
0
    $text = `/sbin/pfctl -vvsi`;
    $text .= "<p/>";
    $text .= `/sbin/pfctl -vvsm`;
    $text .= "<p/>";
    $text .= `/sbin/pfctl -vvst`;
    $text .= "<p/>";
    $text .= `/sbin/pfctl -vvsI`;
    echo $text;
    exit;
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form(false);
$form->addGlobal(new Form_Input('getactivity', null, 'hidden', 'yes'));
$section = new Form_Section('Auto Update Page');
$section->addInput(new Form_Checkbox('refresh', 'Refresh', 'Automatically refresh the output below', true));
$form->add($section);
print $form;
?>
<script type="text/javascript">
//<![CDATA[
	function getpfinfo() {
		if (!$('#refresh').is(':checked')) {
			return;
		}

		$.ajax(
			'/diag_pf_info.php',
			{
Example #26
0
$section->addInput(new Form_Select('interface', 'Interface', $selectedif, $interfaces))->setHelp('Select the interface on which to capture traffic. ');
$section->addInput(new Form_Checkbox('promiscuous', 'Promiscuous', 'Packet capture will be performed using promiscuous mode', $pconfig['promiscuous']))->setHelp('Note: Some network adapters do not support or work well in promiscuous mode.' . '<br />' . 'More: ' . '<a target="_blank" href="http://www.freebsd.org/cgi/man.cgi?query=tcpdump&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+8.3-stable&amp;arch=default&amp;format=html">' . 'Packet capture' . '</a>');
$section->addInput(new Form_Select('fam', 'Address Family', $fam, array('' => 'Any', 'ip' => 'IPv4 Only', 'ip6' => 'IPv6 Only')))->setHelp('Select the type of traffic to be captured');
$section->addInput(new Form_Select('proto', 'Protocol', $proto, $protocollist))->setHelp('Select the protocol to capture, or "Any". ');
$section->addInput(new Form_Input('host', 'Host Address', 'text', $host))->setHelp('This value is either the Source or Destination IP address or subnet in CIDR notation. The packet capture will look for this address in either field.' . '<br />' . 'Matching can be negated by preceding the value with "!". Multiple IP addresses or CIDR subnets may be specified. Comma (",") separated values perform a boolean "AND". ' . 'Separating with a pipe ("|") performs a boolean "OR".' . '<br />' . 'If you leave this field blank, all packets on the specified interface will be captured.');
$section->addInput(new Form_Input('port', 'Port', 'text', $port))->setHelp('The port can be either the source or destination port. The packet capture will look for this port in either field. ' . 'Leave blank if you do not want to filter by port.');
$section->addInput(new Form_Input('snaplen', 'Packet Length', 'text', $snaplen))->setHelp('The Packet length is the number of bytes of each packet that will be captured. Default value is 0, ' . 'which will capture the entire frame regardless of its size.');
$section->addInput(new Form_Input('count', 'Count', 'text', $count))->setHelp('This is the number of packets the packet capture will grab. Default value is 100.' . '<br />' . 'Enter 0 (zero) for no count limit.');
$section->addInput(new Form_Select('detail', 'Level of detail', $detail, array('normal' => 'Normal', 'medium' => 'Medium', 'high' => 'High', 'full' => 'Full')))->setHelp('This is the level of detail that will be displayed after hitting "Stop" when the packets have been captured.' . '<br />' . 'This option does not affect the level of detail when downloading the packet capture. ');
$section->addInput(new Form_Checkbox('dnsquery', 'Reverse DNS Lookup', 'Do reverse DNS lookup', $_POST['dnsquery']))->setHelp('This check box will cause the packet capture to perform a reverse DNS lookup associated with all IP addresses.' . '<br />' . 'This option can cause delays for large packet captures.');
$form->add($section);
/* check to see if packet capture tcpdump is already running */
$processcheck = trim(shell_exec("/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep {$fn} | /usr/bin/egrep -v '(pflog|grep)'"));
$processisrunning = $processcheck != "";
if (($action == gettext("Stop") or $action == "") and $processisrunning != true) {
    $form->addGlobal(new Form_Button('startbtn', 'Start'))->removeClass('btn-primary')->addClass('btn-success');
} else {
    $form->addGlobal(new Form_Button('stopbtn', 'Stop'))->removeClass('btn-primary')->addClass('btn-warning');
}
if (file_exists($fp . $fn) and $processisrunning != true) {
    $form->addGlobal(new Form_Button('viewbtn', 'View Capture'))->removeClass('btn-primary');
    $form->addGlobal(new Form_Button('downloadbtn', 'Download Capture'))->removeClass('btn-primary');
    $section->addInput(new Form_StaticText('Last capture', date("F jS, Y g:i:s a.", filemtime($fp . $fn))));
}
print $form;
if ($do_tcpdump) {
    $matches = array();
    if (in_array($fam, $fams)) {
        $matches[] = $fam;
    }
    if (in_array($proto, $protos)) {
<nav class="action-buttons">
	<a href="?act=new" class="btn btn-success btn-sm">
		<i class="fa fa-plus icon-embed-btn"></i>
		<?php 
    echo gettext("Add");
    ?>
	</a>
</nav>
<?php 
    include "foot.inc";
    exit;
}
$form = new Form();
//$form->setAction('system_camanager.php?act=edit');
if (isset($id) && $a_ca[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
if ($act == "edit") {
    $form->addGlobal(new Form_Input('refid', null, 'hidden', $pconfig['refid']));
}
$section = new Form_Section('Create / Edit CA');
$section->addInput(new Form_Input('descr', 'Descriptive name', 'text', $pconfig['descr']));
if (!isset($id) || $act == "edit") {
    $section->addInput(new Form_Select('method', 'Method', $pconfig['method'], $ca_methods))->toggles();
}
$form->add($section);
$section = new Form_Section('Existing Certificate Authority');
$section->addClass('toggle-existing collapse');
$section->addInput(new Form_Textarea('cert', 'Certificate data', $pconfig['cert']))->setHelp('Paste a certificate in X.509 PEM format here.');
$section->addInput(new Form_Textarea('key', 'Certificate Private Key (optional)', $pconfig['key']))->setHelp('Paste the private key for the above certificate here. This is ' . 'optional in most cases, but is required when generating a ' . 'Certificate Revocation List (CRL).');
$section->addInput(new Form_Input('serial', 'Serial for next certificate', 'number', $pconfig['serial']))->setHelp('Enter a decimal number to be used as the serial number for the next ' . 'certificate to be created using this CA.');
$dn_cc = array();
if (file_exists("/etc/ca_countries")) {
    $dn_cc_file = file("/etc/ca_countries");
    foreach ($dn_cc_file as $line) {
        if (preg_match('/^(\\S*)\\s(.*)$/', $line, $matches)) {
            $dn_cc[$matches[1]] = $matches[1];
        }
    }
}
if ($act == "new" || $_POST['save'] == gettext("Save") && $input_errors) {
    $form = new Form();
    if ($act == "csr" || $_POST['save'] == gettext("Update") && $input_errors) {
        $form->setAction('system_certmanager.php?act=csr');
        $section = new Form_Section('Complete Signing Request');
        if (isset($id) && $a_cert[$id]) {
            $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
        }
        $section->addInput(new Form_Input('descr', 'Descriptive name', 'text', $pconfig['descr']));
        $section->addInput(new Form_Textarea('csr', 'Signing request data', $pconfig['csr']))->setReadonly()->setHelp('Copy the certificate signing data from here and ' . 'forward it to your certificate authority for signing.');
        $section->addInput(new Form_Textarea('cert', 'Final certificate data', $pconfig["cert"]))->setHelp('Paste the certificate received from your certificate authority here.');
        $form->add($section);
        print $form;
        include "foot.inc";
        exit;
    }
    $form->setAction('system_certmanager.php?act=edit');
    if (isset($userid) && $a_user) {
        $form->addGlobal(new Form_Input('userid', null, 'hidden', $userid));
    }
    if (isset($id) && $a_cert[$id]) {
        $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
Example #29
0
    } else {
        $netstat .= " | /usr/bin/sed -e '1,3d'";
    }
    if (is_numeric($_REQUEST['limit']) && $_REQUEST['limit'] > 0) {
        $_REQUEST['limit']++;
        // Account for the header line
        $netstat .= " | /usr/bin/head -n {$_REQUEST['limit']}";
    }
    echo htmlspecialchars_decode(shell_exec($netstat));
    exit;
}
$pgtitle = array(gettext("Diagnostics"), gettext("Routes"));
$shortcut_section = "routing";
include 'head.inc';
$form = new Form(false);
$form->addGlobal(new Form_Input('isAjax', null, 'hidden', 1));
$section = new Form_Section('Routing Table Display Options');
$section->addInput(new Form_Checkbox('resolve', 'Resolve names', 'Enable', $resolve))->setHelp('Enabling name resolution may cause the query to take longer.' . ' It can be stopped at any time by clicking the Stop button in the browser.');
$validLimits = array('10', '50', '100', '200', '500', '1000', 'all');
$section->addInput(new Form_Select('limit', 'Rows to display', $limit, array_combine($validLimits, $validLimits)));
$section->addInput(new Form_Input('filter', 'Filter', 'text', $host))->setHelp('Use a regular expression to filter the tables.');
$form->add($section);
$form->addGlobal(new Form_Button('Submit', 'Update', null, 'fa-refresh'))->addClass('btn-primary');
print $form;
?>
<script type="text/javascript">
//<![CDATA[
function update_routes(section) {
	$.ajax(
		'/diag_routes.php',
		{
Example #30
0
/* Display any error messages resulting from user input */
if ($input_errors) {
    print_input_errors($input_errors);
} else {
    if (!$resolved && $type) {
        print '<div class="alert alert-warning" role="alert">' . gettext("Host") . ' "' . $host . '" ' . gettext("could not be resolved") . '</div>';
    }
}
if ($createdalias) {
    print '<div class="alert alert-success" role="alert">' . gettext("Alias was created/updated successfully") . '</div>';
}
$form = new Form('Lookup');
$section = new Form_Section('DNS Lookup');
$section->addInput(new Form_Input('host', 'Hostname', 'text', $host, ['placeholder' => 'Hostname to look up.']));
if (!empty($resolved)) {
    $form->addGlobal(new Form_Button('create_alias', 'Add alias'))->removeClass('btn-primary')->addClass('btn-success');
}
$form->add($section);
print $form;
if (!$input_errors && $type) {
    if ($resolved) {
        ?>
<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title">Results</h2></div>
	<div class="panel-body">
		<ul class="list-group">
<?php 
        foreach ((array) $resolved as $hostitem) {
            ?>
			<li class="list-group-item"><?php 
            echo $hostitem;