print '<span class="text-danger">Could not connect to the LDAP server. Please check the LDAP configuration.</span>';
    } else {
        $modal = new Modal("Select LDAP containers for authentication", "containers", true);
        $group = new Form_MultiCheckboxGroup('Containers');
        if (is_array($ous)) {
            $idx = 0;
            foreach ($ous as $ou) {
                $group->add(new Form_MultiCheckbox('ou' . $idx, '', $ou, in_array($ou, $authcfg['ldap_authcn']), $ou));
                $idx++;
            }
        }
        $modal->add($group);
        // Create a "Save button"
        $btnsv = new Form_Button('svcontbtn', 'Save', null, 'fa-save');
        $btnsv->removeClass("btn-default)")->addClass("btn-primary");
        $modal->addInput(new Form_StaticText('', $btnsv));
        print $modal;
    }
    exit;
}
if (is_numericint($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
    $id = $_POST['id'];
}
if (!is_array($config['system']['authserver'])) {
    $config['system']['authserver'] = array();
}
$a_servers = auth_get_authserver_list();
foreach ($a_servers as $servers) {
Esempio n. 2
0
$btncnxgw = new Form_Button('cnx', 'Cancel');
$btncnxgw->removeClass('btn-primary')->addClass('btn-default');
$modal->addInput(new Form_StaticText(null, $btnaddgw . $btncnxgw));
$form->add($modal);
$section = new Form_Section('Static IPv6 configuration');
$section->addClass('staticv6');
$section->addInput(new Form_IpAddress('ipaddrv6', 'IPv6 address', $pconfig['ipaddrv6']))->addMask('subnetv6', $pconfig['subnetv6'], 128);
$group = new Form_Group('IPv6 Upstream gateway');
$group->add(new Form_Select('gatewayv6', 'IPv4 Upstream Gateway', $pconfig['gatewayv6'], build_gatewayv6_list()));
$group->add(new Form_Button('addgw6', 'Add a new gateway'))->removeClass('btn-primary')->setAttribute('data-target', '#newgateway6')->setAttribute('data-toggle', 'modal');
$group->setHelp('If this interface is an Internet connection, select an existing Gateway from the list or add a new one using the "Add" button.' . '<br />' . 'On local LANs the upstream gateway should be "none". ');
$section->add($group);
$form->add($section);
// Add new gateway modal pop-up for IPv6
$modal = new Modal('New IPv6 gateway', 'newgateway6', 'large');
$modal->addInput(new Form_Checkbox('defaultgw6', 'Default', 'Default gateway', $if == "wan" || $if == "WAN"));
$modal->addInput(new Form_Input('name6', 'Gateway name', 'text', $wancfg['descr'] . "GWv6"));
$modal->addInput(new Form_IpAddress('gatewayip6', 'Gateway IPv6', null));
$modal->addInput(new Form_Input('gatewaydescr6', 'Description', 'text'));
$btnaddgw6 = new Form_Button('add6', 'Add');
$btnaddgw6->removeClass('btn-primary')->addClass('btn-success');
$btncnxgw6 = new Form_Button('cnx6', 'Cancel');
$btncnxgw6->removeClass('btn-primary')->addClass('btn-default');
$modal->addInput(new Form_StaticText(null, $btnaddgw6 . $btncnxgw6));
$form->add($modal);
// ==== DHCP client configuration =============================
$section = new Form_Section('DHCP client configuration');
$section->addClass('dhcp');
$group = new Form_Group('Options');
$group->add(new Form_Checkbox('dhcpadv', null, 'Show DHCP advanced options', false));
$group->add(new Form_Checkbox('dhcpovr', null, 'Config file override', false));
/* Default to pfsense backend type if none is defined */
if (!$pconfig['backend']) {
    $pconfig['backend'] = "pfsense";
}
$form = new Form();
$section = new Form_Section('Settings');
$section->addInput(new Form_Input('session_timeout', 'Session timeout', 'number', $pconfig['session_timeout'], [min => 0]))->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', null, 'fa-wrench'))->addClass('btn-info');
$form->add($section);
$modal = new Modal("LDAP settings", "testresults", true);
$modal->addInput(new Form_StaticText('Test results', '<span id="ldaptestop">Testing pfSense LDAP settings... One moment please...' . $g['product_name'] . '</span>'));
$form->add($modal);
print $form;
// If the user clicked "Save & Test" show the modal and populate it with the test results via AJAX
if ($save_and_test) {
    ?>
<script type="text/javascript">
//<![CDATA[
events.push(function() {

	function test_LDAP() {
		var ajaxRequest;
		var authserver = $('#authmode').val();

		ajaxRequest = $.ajax(
			{