$raid['desc'] = "Software graid5 RAID 5";
        $raid['fullname'] = "/dev/raid5/{$raid['name']}";
        if (isset($id) && $a_raid[$id]) {
            $a_raid[$id] = $raid;
        } else {
            $a_raid[] = $raid;
        }
        $fd = @fopen("{$d_raidconfdirty_path}", "a");
        if (!$fd) {
            echo "ERR Could not save RAID configuration.\n";
            exit(0);
        }
        fwrite($fd, "{$raid['name']}\n");
        fclose($fd);
        write_config();
        pfSenseHeader("disks_raid_graid5.php");
        exit;
    }
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
Example #2
0
            }
            parse_package_templates();
            /* if start_command is defined, restart w/ this */
            if ($pkg['start_command'] != "") {
                exec($pkg['start_command'] . ">/dev/null 2&>1");
            }
            /* if restart_command is defined, restart w/ this */
            if ($pkg['restart_command'] != "") {
                exec($pkg['restart_command'] . ">/dev/null 2&>1");
            }
            if ($pkg['aftersaveredirect'] != "") {
                pfSenseHeader($pkg['aftersaveredirect']);
            } elseif (!$pkg['adddeleteeditpagefields']) {
                pfSenseHeader("pkg_edit.php?xml={$xml}&amp;id=0");
            } elseif (!$pkg['preoutput']) {
                pfSenseHeader("pkg.php?xml=" . $xml);
            }
            exit;
        } else {
            $get_from_post = true;
        }
    } elseif (!$input_errors) {
        exit;
    }
}
// Turn an embedded table into a bootstrap class table. This is for backward compatibility.
// We remove any table attributes in the XML and replace them with Bootstrap table classes
function bootstrapTable($text)
{
    $t = strpos($text, '<table') + strlen('<table');
    // Find the <table tag
if ($_GET['act'] == "delgroup") {
    if (!$a_group[$_GET['id']]) {
        pfSenseHeader("system_groupmanager.php");
        exit;
    }
    conf_mount_rw();
    local_group_del($a_group[$_GET['id']]);
    conf_mount_ro();
    $groupdeleted = $a_group[$_GET['id']]['name'];
    unset($a_group[$_GET['id']]);
    write_config();
    $savemsg = gettext("Group") . " {$groupdeleted} " . gettext("successfully deleted") . "<br />";
}
if ($_GET['act'] == "delpriv") {
    if (!$a_group[$_GET['id']]) {
        pfSenseHeader("system_groupmanager.php");
        exit;
    }
    $privdeleted = $priv_list[$a_group[$id]['priv'][$_GET['privid']]]['name'];
    unset($a_group[$id]['priv'][$_GET['privid']]);
    if (is_array($a_group[$id]['member'])) {
        foreach ($a_group[$id]['member'] as $uid) {
            $user = getUserEntryByUID($uid);
            if ($user) {
                local_user_set($user);
            }
        }
    }
    write_config();
    $_GET['act'] = "edit";
    $savemsg = gettext("Privilege") . " {$privdeleted} " . gettext("successfully deleted") . "<br />";
Example #4
0
            $secretent = $a_secret[$id];
        }
        $secretent['name'] = $_POST['usernamefld'];
        $secretent['ip'] = $_POST['ip'];
        if ($_POST['passwordfld']) {
            $secretent['password'] = $_POST['passwordfld'];
        }
        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";
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
?>

<?php 
Example #5
0
    $config['openvpn']['openvpn-csc'] = array();
}
$a_csc =& $config['openvpn']['openvpn-csc'];
if (is_numericint($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
    $id = $_POST['id'];
}
$act = $_GET['act'];
if (isset($_POST['act'])) {
    $act = $_POST['act'];
}
if ($_GET['act'] == "del") {
    if (!$a_csc[$id]) {
        pfSenseHeader("vpn_openvpn_csc.php");
        exit;
    }
    openvpn_delete_csc($a_csc[$id]);
    unset($a_csc[$id]);
    write_config();
    $savemsg = gettext("Client Specific Override successfully deleted");
}
if ($_GET['act'] == "edit") {
    if (isset($id) && $a_csc[$id]) {
        $pconfig['server_list'] = explode(",", $a_csc[$id]['server_list']);
        $pconfig['custom_options'] = $a_csc[$id]['custom_options'];
        $pconfig['disable'] = isset($a_csc[$id]['disable']);
        $pconfig['common_name'] = $a_csc[$id]['common_name'];
        $pconfig['block'] = $a_csc[$id]['block'];
        $pconfig['description'] = $a_csc[$id]['description'];
    }
    /* if this is an AJAX caller then handle via JSON */
    if (isAjax() && is_array($input_errors)) {
        input_errors2Ajax($input_errors);
        exit;
    }
    if (!$input_errors) {
        /* No errors detected, so update the config */
    }
}
if ($_GET['act'] == "del") {
    if ($a_disk_conf[$_GET['id']]) {
        unset($a_disk_conf[$_GET['id']]);
        write_config();
        touch($d_diskdirty_path);
        pfSenseHeader("disks_manage.php");
        exit;
    }
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
     $config['notifications']['smtp']['authentication_mechanism'] = $_POST['smtpauthmech'];
     $config['notifications']['smtp']['fromaddress'] = $_POST['smtpfromaddress'];
     if ($_POST['disable_smtp'] == "yes") {
         $config['notifications']['smtp']['disable'] = true;
     } else {
         unset($config['notifications']['smtp']['disable']);
     }
     // System Sounds
     if ($_POST['disablebeep'] == "yes") {
         $config['system']['disablebeep'] = true;
     } else {
         unset($config['system']['disablebeep']);
     }
     if (!$input_errors) {
         write_config();
         pfSenseHeader("system_advanced_notifications.php");
         return;
     }
 }
 if (isset($_POST['test-growl'])) {
     // Send test message via growl
     if ($config['notifications']['growl']['ipaddress'] && ($config['notifications']['growl']['password'] = $_POST['password'])) {
         unlink_if_exists($g['vardb_path'] . "/growlnotices_lastmsg.txt");
         register_via_growl();
         notify_via_growl(sprintf(gettext("This is a test message from %s.  It is safe to ignore this message."), $g['product_name']), true);
     }
 }
 if (isset($_POST['test-smtp'])) {
     // Send test message via smtp
     if (file_exists("/var/db/notices_lastmsg.txt")) {
         unlink("/var/db/notices_lastmsg.txt");
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            if (file_exists($d_raidconfdirty_path)) {
                unlink($d_raidconfdirty_path);
            }
        }
    }
}
if ($_GET['act'] == "del") {
    if ($a_raid[$_GET['id']]) {
        $raidname = $a_raid[$_GET['id']]['name'];
        disks_raid_gvinum_delete($raidname);
        unset($a_raid[$_GET['id']]);
        write_config();
        touch($d_raidconfdirty_path);
        pfSenseHeader("disks_raid_gvinum.php");
        exit;
    }
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            if (file_exists($d_raidconfdirty_path)) {
                unlink($d_raidconfdirty_path);
            }
        }
    }
}
if ($_GET['act'] == "del") {
    if ($a_raid[$_GET['id']]) {
        $raidname = $a_raid[$_GET['id']]['name'];
        disks_raid_gmirror_delete($raidname);
        unset($a_raid[$_GET['id']]);
        write_config();
        touch($d_raidconfdirty_path);
        pfSenseHeader("disks_raid_gmirror.php");
        exit;
    }
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
                $a_acls[$id]['aclid'] = $id;
            }
            if (isset($id) && $a_acls[$id]) {
                $a_acls[$id]['aclid'] = $pconfig['aclid'];
                $a_acls[$id]['aclname'] = $pconfig['aclname'];
                $a_acls[$id]['aclaction'] = $pconfig['aclaction'];
                $a_acls[$id]['description'] = $pconfig['description'];
                $a_acls[$id]['row'] = array();
                foreach ($networkacl as $acl) {
                    $a_acls[$id]['row'][] = $acl;
                }
                write_config();
                mark_subsystem_dirty("unbound");
                //unbound_reconfigure();
            }
            pfSenseHeader("/unbound_acls.php");
            exit;
        }
        if ($pconfig['apply']) {
            clear_subsystem_dirty("unbound");
            $retval = 0;
            $retval = unbound_reconfigure();
            $savemsg = get_std_save_message($retval);
        }
    }
}
$pgtitle = "Services: Unbound DNS Forwarder: Access Lists";
include "head.inc";
?>

<script type="text/javascript" src="/javascript/row_helper.js">
    if (isAjax() && is_array($error_bucket)) {
        input_errors2Ajax(NULL, $error_bucket);
        exit;
    }
    if (!$input_errors) {
        /* TODO: This logic needs to be tested! */
        if ($_POST['browseable'] == gettext("No")) {
            $freenas_config['samba']['hidemount'] = array_merge($freenas_config['samba']['hidemount'], array($freenas_config['mounts']['mount'][$id]['sharename']));
        } else {
            if (is_array($freenas_config['samba']['hidemount']) && in_array($freenas_config['mounts']['mount'][$id]['sharename'], $freenas_config['samba']['hidemount'])) {
                $freenas_config['samba']['hidemount'] = array_diff($freenas_config['samba']['hidemount'], array($freenas_config['mounts']['mount'][$id]['sharename']));
            }
        }
        touch($d_smbshareconfdirty_path);
        write_config();
        pfSenseHeader("services_samba_share.php");
        exit;
    }
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
    /* input validation */
    $reqdfields = explode(" ", "session_timeout");
    $reqdfieldsn = explode(",", "Session Timeout");
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
    if ($_POST['session_timeout'] != "" && !is_numeric($_POST['session_timeout'])) {
        $input_errors[] = gettext("Session timeout must be an integer with value 0 or greater.");
    }
    /* if this is an AJAX caller then handle via JSON */
    if (isAjax() && is_array($input_errors)) {
        input_errors2Ajax($input_errors);
        exit;
    }
    if (!$input_errors) {
        $pconfig['session_timeout'] = $_POST['session_timeout'];
        write_config();
        pfSenseHeader("system_usermanager_settings.php");
    }
}
include "head.inc";
echo $pfSenseHead->getHTML();
?>

<body link="#000000" vlink="#000000" alink="#000000" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
    }
    if (!$input_errors) {
        if (!is_array($pconfig['sysprivs'])) {
            $pconfig['sysprivs'] = array();
        }
        if (!count($a_user['priv'])) {
            $a_user['priv'] = $pconfig['sysprivs'];
        } else {
            $a_user['priv'] = array_merge($a_user['priv'], $pconfig['sysprivs']);
        }
        $a_user['priv'] = sort_user_privs($a_user['priv']);
        local_user_set($a_user);
        $retval = write_config();
        $savemsg = get_std_save_message($retval);
        conf_mount_ro();
        pfSenseHeader("system_usermanager.php?act=edit&id={$userid}");
        exit;
    }
    conf_mount_ro();
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
include "head.inc";
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
    POSSIBILITY OF SUCH DAMAGE.
*/
/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"), gettext("System logs"), gettext("Daemon"));
require_once "freenas_config.inc";
require_once "guiconfig.inc";
require_once "freenas_guiconfig.inc";
require_once "freenas_functions.inc";
$nentries = $config['syslog']['nentries'];
if (!$nentries) {
    $nentries = 50;
}
if ($_POST['clear']) {
    exec("/usr/sbin/clog -i -s 262144 /var/log/daemon.log");
    /* redirect to avoid reposting form data on refresh */
    pfSenseHeader("diag_fn_logs_daemon.php");
    exit;
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
}

$id = $_GET['id'];
if (isset($_POST['id']))
	$id = $_POST['id'];

$act = $_GET['act'];
if (isset($_POST['act']))
	$act = $_POST['act'];

$error = false;

if(($act == "skconf") || ($act == "skzipconf")) {
	$srvid = $_GET['srvid'];
	if (($srvid === false) || ($config['openvpn']['openvpn-server'][$srvid]['mode'] != "p2p_shared_key")) {
		pfSenseHeader("vpn_openvpn_export.php");
		exit;
	}

	if (empty($_GET['useaddr'])) {
		$error = true;
		$input_errors[] = "You need to specify an IP or hostname.";
	} else
		$useaddr = $_GET['useaddr'];

	$proxy = "";
	if (!empty($_GET['proxy_addr']) || !empty($_GET['proxy_port'])) {
		$proxy = array();
		if (empty($_GET['proxy_addr'])) {
			$error = true;
			$input_errors[] = "You need to specify an address for the proxy port.";
    POSSIBILITY OF SUCH DAMAGE.
*/
/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"), gettext("System logs"), gettext("SMARTD"));
require_once "freenas_config.inc";
require_once "guiconfig.inc";
require_once "freenas_guiconfig.inc";
require_once "freenas_functions.inc";
$nentries = $config['syslog']['nentries'];
if (!$nentries) {
    $nentries = 50;
}
if ($_POST['clear']) {
    exec("/usr/sbin/clog -i -s 262144 /var/log/smartd.log");
    /* redirect to avoid reposting form data on refresh */
    pfSenseHeader("diag_fn_logs_smartd.php");
    exit;
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
    }
    if (!$input_errors && is_array($imported_ips)) {
        $alias = array();
        $alias['address'] = implode(" ", $imported_ips);
        $alias['detail'] = implode("||", $imported_descs);
        $alias['name'] = $_POST['name'];
        $alias['type'] = "network";
        $alias['descr'] = $_POST['descr'];
        unset($imported_ips, $imported_descs);
        $a_aliases[] = $alias;
        // Sort list
        $a_aliases = msort($a_aliases, "name");
        if (write_config()) {
            mark_subsystem_dirty('aliases');
        }
        pfSenseHeader("firewall_aliases.php");
        exit;
    }
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section('Alias Details');
$section->addInput(new Form_Input('name', 'Alias Name', 'text', $_POST['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', $_POST['descr']))->setHelp('You may enter a description here for your reference (not ' . 'parsed).');
$section->addInput(new Form_Textarea('aliasimport', 'Aliases to import', $_POST["aliasimport"]))->setHelp('Paste in the aliases to ' . 'import separated by a carriage return. Common examples are lists of IPs, ' . 'networks, blacklists, etc.The list may contain IP addresses, with or without ' . 'CIDR prefix, IP ranges, blank lines (ignored) and an optional description after ' . 'each IP. e.g.:<ul><li>172.16.1.2</li><li>172.16.0.0/24</li><li>10.11.12.100-' . '10.11.12.200</li><li>192.168.1.254 Home router</li><li>10.20.0.0/16 Office ' . 'network</li><li>10.40.1.10-10.40.1.19 Managed switches</li></ul>');
$form->add($section);
print $form;
include "foot.inc";
        $raid['desc'] = "Software gconcat JBOD";
        $raid['fullname'] = "/dev/concat/{$raid['name']}";
        if (isset($id) && $a_raid[$id]) {
            $a_raid[$id] = $raid;
        } else {
            $a_raid[] = $raid;
        }
        $fd = @fopen("{$d_raidconfdirty_path}", "a");
        if (!$fd) {
            echo "ERR Could not save RAID configuration.\n";
            exit(0);
        }
        fwrite($fd, "{$raid['name']}\n");
        fclose($fd);
        write_config();
        pfSenseHeader("disks_raid_gconcat.php");
        exit;
    }
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
Example #19
0
}
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
    $id = $_POST['id'];
}
$act = $_GET['act'];
if (isset($_POST['act'])) {
    $act = $_POST['act'];
}
if (isset($id) && $a_client[$id]) {
    $vpnid = $a_client[$id]['vpnid'];
} else {
    $vpnid = 0;
}
if ($_GET['act'] == "del") {
    if (!isset($a_client[$id])) {
        pfSenseHeader("vpn_openvpn_client.php");
        exit;
    }
    if (!empty($a_client[$id])) {
        openvpn_delete('client', $a_client[$id]);
    }
    unset($a_client[$id]);
    write_config();
    $savemsg = gettext("Client successfully deleted") . "<br />";
}
if ($_GET['act'] == "new") {
    $pconfig['autokey_enable'] = "yes";
    $pconfig['tlsauth_enable'] = "yes";
    $pconfig['autotls_enable'] = "yes";
    $pconfig['interface'] = "wan";
    $pconfig['server_port'] = 1194;
Example #20
0
}
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
    $id = $_POST['id'];
}
$act = $_GET['act'];
if (isset($_POST['act'])) {
    $act = $_POST['act'];
}
if (isset($id) && $a_server[$id]) {
    $vpnid = $a_server[$id]['vpnid'];
} else {
    $vpnid = 0;
}
if ($_GET['act'] == "del") {
    if (!isset($a_server[$id])) {
        pfSenseHeader("vpn_openvpn_server.php");
        exit;
    }
    if (!empty($a_server[$id])) {
        openvpn_delete('server', $a_server[$id]);
    }
    unset($a_server[$id]);
    write_config();
    $savemsg = gettext("Server successfully deleted") . "<br />";
}
if ($_GET['act'] == "new") {
    $pconfig['autokey_enable'] = "yes";
    $pconfig['tlsauth_enable'] = "yes";
    $pconfig['autotls_enable'] = "yes";
    $pconfig['dh_length'] = 1024;
    $pconfig['dev_mode'] = "tun";
    if (is_array($error_bucket)) {
        foreach ($error_bucket as $elem) {
            $input_errors[] =& $elem["error"];
        }
    }
    /* if this is an AJAX caller then handle via JSON */
    if (isAjax() && is_array($error_bucket)) {
        input_errors2Ajax(NULL, $error_bucket);
        exit;
    }
    if (!$input_errors) {
        $freenas_config['mounts']['mount'][$id]['nfs']['networks'] = implode(",", $osn);
        $freenas_config['mounts']['mount'][$id]['nfs']['mapall'] = $_POST['mapall'];
        touch($d_nfsexportconfdirty_path);
        write_config();
        pfSenseHeader("services_nfs_export.php");
        exit;
    }
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
$addressTransString = gettext("Address");
$plusimgDescTransString = gettext("add to network list");
$minusimgDescTransString = gettext("remove from network list");
$currentnetTransString = gettext("Current networks");
$networksTypehintTransString = gettext("Network that is authorised to access NFS shares");
$networkCount = count($freenas_config['nfs']['nfsnetwork']);
$generatedWANSubnet = gen_subnet($config['interfaces']['wan']['ipaddr'], $config['interfaces']['wan']['subnet']);
$generatedLANSubnet = gen_subnet($config['interfaces']['lan']['ipaddr'], $config['interfaces']['lan']['subnet']);
$jscriptstr = <<<EOD
    POSSIBILITY OF SUCH DAMAGE.
*/
/* ========================================================================== */
$pgtitle = array(gettext("Diagnostics"), gettext("System logs"), gettext("FTP"));
require_once "freenas_config.inc";
require_once "guiconfig.inc";
require_once "freenas_guiconfig.inc";
require_once "freenas_functions.inc";
$nentries = $config['syslog']['nentries'];
if (!$nentries) {
    $nentries = 50;
}
if ($_POST['clear']) {
    exec("/usr/sbin/clog -i -s 262144 /var/log/ftp.log");
    /* redirect to avoid reposting form data on refresh */
    pfSenseHeader("diag_fn_logs_ftp.php");
    exit;
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
echo $pfSenseHead->getHTML();
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
Example #23
0
                    break;
                }
            }
            $a_user[] = $userent;
        }
        /* Add user to groups so PHP can see the memberships properly or else the user's shell account does not get proper permissions (if applicable) See #5152. */
        local_user_set_groups($userent, $_POST['groups']);
        local_user_set($userent);
        /* Add user to groups again to ensure they are set everywhere, otherwise the user may not appear to be a member of the group. See commit:5372d26d9d25d751d16865ed9d46869d3b0ec5e1. */
        local_user_set_groups($userent, $_POST['groups']);
        write_config();
        if (is_dir("/etc/inc/privhooks")) {
            run_plugins("/etc/inc/privhooks");
        }
        conf_mount_ro();
        pfSenseHeader("system_usermanager.php");
    }
}
function build_priv_table()
{
    global $a_user, $id;
    $privhtml = '<div class="table-responsive">';
    $privhtml .= '<table class="table table-striped table-hover table-condensed">';
    $privhtml .= '<thead>';
    $privhtml .= '<tr>';
    $privhtml .= '<th>' . gettext('Inherited from') . '</th>';
    $privhtml .= '<th>' . gettext('Name') . '</th>';
    $privhtml .= '<th>' . gettext('Description') . '</th>';
    $privhtml .= '</tr>';
    $privhtml .= '</thead>';
    $privhtml .= '<tbody>';
            $input_errors[] = gettext("Both a name and a value must be specified.");
        } else {
            if (preg_match("/[^a-zA-Z0-9.\\-_%\\/]/", $_POST['value'])) {
                $input_errors[] = gettext("The value may only contain alphanumeric characters, -, _, %, and /.");
            } else {
                $tunableent['tunable'] = htmlspecialchars($_POST['tunable']);
                $tunableent['value'] = htmlspecialchars($_POST['value']);
                $tunableent['descr'] = strip_tags($_POST['descr']);
                if (isset($id) && isset($a_tunable[$id])) {
                    $a_tunable[$id] = $tunableent;
                } else {
                    $a_tunable[] = $tunableent;
                }
                mark_subsystem_dirty('sysctl');
                write_config();
                pfSenseHeader("system_advanced_sysctl.php");
                exit;
            }
        }
    }
}
$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("System Tunables"));
if ($act == "edit") {
    $pgtitle[] = gettext('Edit');
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'success');
        $priv['descr'] = $pconfig['descr'];
        if (isset($id) && $t_privs[$id]) {
            $t_privs[$id] = $priv;
        } else {
            $t_privs[] = $priv;
        }
        if ($priv['id'] == "hasshell") {
            assignUID($user['name']);
            assignGID($user['groupname']);
        }
        write_config();
        $retval = 0;
        config_lock();
        config_unlock();
        $savemsg = get_std_save_message($retval);
        pfSenseHeader("system_usermanager.php?id={$userid}&act={$useract}");
        exit;
    }
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
$jscriptstr = <<<EOD
<script type="text/javascript">
<!--

  var privs = new Array();
            $a_group['priv'] = $pconfig['sysprivs'];
        } else {
            $a_group['priv'] = array_merge($a_group['priv'], $pconfig['sysprivs']);
        }
        if (is_array($a_group['member'])) {
            foreach ($a_group['member'] as $uid) {
                $user = getUserEntryByUID($uid);
                if ($user) {
                    local_user_set($user);
                }
            }
        }
        admin_groups_sort();
        $retval = write_config();
        $savemsg = get_std_save_message($retval);
        pfSenseHeader("system_groupmanager.php?act=edit&groupid={$groupid}");
        exit;
    }
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
function build_priv_list()
{
    global $priv_list, $a_group;
    $list = array();
    foreach ($priv_list as $pname => $pdata) {
        if (in_array($pname, $a_group['priv'])) {
            continue;
        }
                    $acl_entry['aclname'] = $pconfig['aclname'];
                    $acl_entry['aclaction'] = $pconfig['aclaction'];
                    $acl_entry['description'] = $pconfig['description'];
                    $acl_entry['aclid'] = $pconfig['aclid'];
                    $acl_entry['row'] = array();
                    foreach ($networkacl as $acl) {
                        $acl_entry['row'][] = $acl;
                    }
                    if (isset($id) && $a_acls[$id]) {
                        $a_acls[$id] = $acl_entry;
                    } else {
                        $a_acls[] = $acl_entry;
                    }
                    mark_subsystem_dirty("unbound");
                    write_config();
                    pfSenseHeader("/services_unbound_acls.php");
                    exit;
                }
            }
        }
    }
}
$actionHelp = '<span class="text-success"><strong>Deny:</strong></span> Stops queries from hosts within the netblock defined below.' . '<br />' . '<span class="text-success"><strong>Refuse:</strong></span> Stops queries from hosts within the netblock defined below, but sends a DNS rcode REFUSED error message back to the client.' . '<br />' . '<span class="text-success"><strong>Allow:</strong></span> Allow queries from hosts within the netblock defined below.' . '<br />' . '<span class="text-success"><strong>Allow Snoop:</strong></span> Allow recursive and nonrecursive access from hosts within the netblock defined below. Used for cache snooping and ideally should only be configured for your administrative host.';
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Access Lists"));
$shortcut_section = "resolver";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'success');
            if ($pconfig['radius_srvcs'] == "auth") {
                $server['radius_auth_port'] = $pconfig['radius_auth_port'];
                unset($server['radius_acct_port']);
            }
            if ($pconfig['radius_srvcs'] == "acct") {
                $server['radius_acct_port'] = $pconfig['radius_acct_port'];
                unset($server['radius_auth_port']);
            }
        }
        if (isset($id) && $config['system']['authserver'][$id]) {
            $config['system']['authserver'][$id] = $server;
        } else {
            $config['system']['authserver'][] = $server;
        }
        write_config();
        pfSenseHeader("system_authservers.php");
    }
}
// On error, restore the form contents so the user doesn't have to re-enter too much
if ($_POST && $input_errors) {
    $pconfig = $_POST;
    $pconfig['ldap_authcn'] = $_POST['ldapauthcontainers'];
    $pconfig['ldap_template'] = $_POST['ldap_tmpltype'];
}
$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Authentication Servers"));
if ($act == "new" || $act == "edit" || $input_errors) {
    $pgtitle[] = gettext('Edit');
}
$shortcut_section = "authentication";
include "head.inc";
if ($input_errors) {
                            }
                        }
                    }
                }
            }
            error_reporting($old_err_level);
        }
        if (isset($id) && $a_ca[$id]) {
            $a_ca[$id] = $ca;
        } else {
            $a_ca[] = $ca;
        }
        if (!$input_errors) {
            write_config();
        }
        pfSenseHeader("system_camanager.php");
    }
}
$pgtitle = array(gettext("System"), gettext("Certificate Manager"), gettext("CAs"));
if ($act == "new" || $act == "edit" || $act == gettext("Save") || $input_errors) {
    $pgtitle[] = gettext('Edit');
}
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'success');
}
// Load valid country codes
$dn_cc = array();
                         if ($_GET['what'] == "header" && $t_headers[$_GET['id']]) {
                             unset($t_headers[$_GET['id']]);
                             write_config();
                             pfSenseHeader("dspam-settings.php");
                             exit;
                         } else {
                             if ($_GET['what'] == "bmta" && $t_bmtas[$_GET['id']]) {
                                 unset($t_bmtas[$_GET['id']]);
                                 write_config();
                                 pfSenseHeader("dspam-settings.php");
                                 exit;
                             } else {
                                 if ($_GET['what'] == "spwd" && $t_spwds[$_GET['id']]) {
                                     unset($t_spwds[$_GET['id']]);
                                     write_config();
                                     pfSenseHeader("dspam-settings.php");
                                     exit;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 /* if ajax is calling, give them an update message */
 if (isAjax()) {
     print_info_box_np($savemsg);
 }
 include "head.inc";