Commit 96808b56 authored by Jos Schellevis's avatar Jos Schellevis

Several fixes, GUI and LDAP

parent c60d3f3e
......@@ -381,12 +381,12 @@ include("head.inc");
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12" style="overflow: auto;">
<form action="firewall_rules.php<? if (!empty($if)): ?>?if=<?=$if;?><? endif; ?>" method="post" name="iform" id="iform">
<div class="table-responsive">
<div class="table-responsive" >
<table class="table table-striped table-sort dragable">
<thead>
<tr id="frheader">
......@@ -821,12 +821,12 @@ include("head.inc");
<td class="list">&nbsp;</td>
<td class="list">
<?php if ($nrules): ?><button name="move_<?=$i;?>_x" type="submit" value="<?=$i;?>" title="<?=gettext("move selected rules to end");?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button><?php endif; ?>
<?php if ($nrules): ?>
<button name="del" type="submit" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></button>
<?php endif; ?>
<a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>" title="<?=gettext("add new rule");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
<?php if ($nrules): ?>
<button name="move_<?=$i;?>_x" type="submit" value="<?=$i;?>" title="<?=gettext("move selected rules to end");?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-arrow-left"></span></button>
<button name="del" type="submit" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></button>
<a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>" title="<?=gettext("add new rule");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span></a>
<?php endif; ?>
</td>
</tr>
</tbody>
......
......@@ -282,7 +282,7 @@ include("head.inc");
?>
<section class="col-xs-12">
<div class="content-box">
<div class="content-box table-responsive">
<form action="system.php" method="post">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area" class="table table-striped">
......
......@@ -134,7 +134,7 @@ include("head.inc");
<section class="col-xs-12">
<? include('system_advanced_tabs.php'); ?>
<div class="table-responsive content-box tab-content">
<div class="table-responsive content-box tab-content" style="overflow: auto;">
<?php if ($act != "edit" ): ?>
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area" class="table table-striped">
<thead>
......
......@@ -422,7 +422,7 @@ function select_clicked() {
url += '&cert=';
<?php endif; ?>
var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
var oWin = window.open(url,"OPNsense","width=620,height=400,top=150,left=150");
if (oWin==null || typeof(oWin)=="undefined")
alert("<?=gettext('Popup blocker detected. Action aborted.');?>");
}
......@@ -453,7 +453,7 @@ function select_clicked() {
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12 table-responsive">
<?php if ($act == "new" || $act == "edit" || $input_errors): ?>
<form id="iform" name="iform" action="system_authservers.php" method="post">
......
......@@ -347,7 +347,7 @@ function method_change() {
<? include('system_tabs.php'); ?>
<div class="content-box tab-content">
<div class="content-box tab-content table-responsive" style="overflow: auto;">
<?php
......
......@@ -576,7 +576,7 @@ function internalca_change() {
<?php include('system_manager_tabs.php'); ?>
<div class="content-box tab-content">
<div class="content-box tab-content table-responsive">
<?php if ($act == "new" || (($_POST['save'] == gettext("Save")) && $input_errors)): ?>
......
......@@ -753,7 +753,7 @@ function enable_change() {
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td>
<td width="78%" class="vtable">
<select name='weight' class='formfldselect' id='weight'>
<select name='weight' class='formfldselect selectpicker' id='weight' data-width="auto">
<?php
for ($i = 1; $i < 6; $i++) {
$selected = "";
......
......@@ -229,22 +229,29 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Destination network"); ?></td>
<td width="78%" class="vtable">
<input name="network" type="text" class="formfldalias ipv4v6" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" />
/
<select name="network_subnet" class="formselect ipv4v6" id="network_subnet">
<?php for ($i = 128; $i >= 1; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>>
<?=$i;?>
</option>
<?php endfor; ?>
</select>
<table>
<tr>
<td width="348px">
<input name="network" type="text" class="formfldalias ipv4v6" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" />
</td>
<td>
<select name="network_subnet" class="selectpicker ipv4v6" id="network_subnet" data-width="auto">
<?php for ($i = 128; $i >= 1; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>>
<?=$i;?>
</option>
<?php endfor; ?>
</select>
</td>
</tr>
</table>
<br /><span class="vexpl"><?=gettext("Destination network for this static route"); ?></span>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td>
<td width="78%" class="vtable">
<select name="gateway" id="gateway" class="form-control">
<select name="gateway" id="gateway" class="selectpicker">
<?php
foreach ($a_gateways as $gateway) {
?>
......@@ -274,7 +281,7 @@ include("head.inc");
<tr>
<td width="22%"><?=gettext("Interface:"); ?></td>
<td with="78%">
<select name="addinterfacegw" id="addinterfacegw">
<select name="addinterfacegw" id="addinterfacegw" class="selectpicker">
<?php $gwifs = get_configured_interface_with_descr();
foreach($gwifs as $fif => $dif)
echo "<option value=\"{$fif}\">{$dif}</option>\n";
......@@ -347,21 +354,25 @@ include("head.inc");
function show_add_gateway() {
document.getElementById("addgateway").style.display = '';
document.getElementById("addgwbox").style.display = 'none';
document.getElementById("gateway").style.display = 'none';
//document.getElementById("gateway").style.display = 'none';
jQuery('#gateway').selectpicker('hide');
document.getElementById("save").style.display = 'none';
document.getElementById("cancel").style.display = 'none';
document.getElementById("gwsave").style.display = '';
document.getElementById("gwcancel").style.display = '';
//jQuery('.selectpicker').selectpicker('refresh');
jQuery('#notebox').html("");
}
function hide_add_gateway() {
document.getElementById("addgateway").style.display = 'none';
document.getElementById("addgwbox").style.display = '';
document.getElementById("gateway").style.display = '';
//document.getElementById("gateway").style.display = '';
jQuery('#gateway').selectpicker('show');
document.getElementById("save").style.display = '';
document.getElementById("cancel").style.display = '';
document.getElementById("gwsave").style.display = '';
document.getElementById("gwcancel").style.display = '';
//jQuery('.selectpicker').selectpicker('refresh');
}
function hide_add_gatewaysave() {
document.getElementById("addgateway").style.display = 'none';
......@@ -392,6 +403,7 @@ include("head.inc");
selectbox.append(optn);
selectbox.prop('selectedIndex',selectbox.children('option').length-1);
jQuery('#notebox').html("<p><strong><?=gettext("NOTE:");?><\/strong> <?php printf(gettext("You can manage Gateways %shere%s."), "<a target='_blank' href='system_gateways.php'>", "<\/a>");?> <\/strong><\/p>");
jQuery('.selectpicker').selectpicker('refresh');
}
function report_failure() {
alert("<?=gettext("Sorry, we could not create your gateway at this time."); ?>");
......@@ -403,6 +415,7 @@ include("head.inc");
hide_add_gateway();
var gwtext = escape(name) + " - " + gatewayip;
addOption(jQuery('#gateway'), gwtext, name);
jQuery('.selectpicker').selectpicker('refresh');
} else {
report_failure();
}
......
......@@ -451,7 +451,7 @@ function sshkeyClicked(obj) {
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12 table-responsive">
<?php
if ($_POST['act'] == "new" || $_POST['act'] == "edit" || $input_errors):
......
......@@ -115,7 +115,7 @@ include("head.inc");
$pconfig['backend'] = "pfsense";
?>
<div class="tab-content content-box col-xs-12">
<div class="tab-content content-box col-xs-12 table-responsive">
<form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
<table class="table table-striped table-sort">
......
......@@ -28,6 +28,7 @@
require("guiconfig.inc");
require_once("auth.inc");
include('head.inc');
$ous = array();
......@@ -47,76 +48,50 @@ if($_GET) {
}
?>
<html>
<head>
<STYLE type="text/css">
TABLE {
border-width: 1px 1px 1px 1px;
border-spacing: 0px;
border-style: solid solid solid solid;
border-color: gray gray gray gray;
border-collapse: separate;
background-color: collapse;
}
TD {
border-width: 0px 0px 0px 0px;
border-spacing: 0px;
border-style: solid solid solid solid;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
}
</STYLE>
</head>
<script type="text/javascript">
<body>
<script type="text/javascript">
function post_choices() {
var ous = <?php echo count($ous); ?>;
var i;
opener.document.forms[0].ldapauthcontainers.value="";
for (i = 0; i < ous; i++) {
if (document.forms[0].ou[i].checked) {
if (opener.document.forms[0].ldapauthcontainers.value != "")
opener.document.forms[0].ldapauthcontainers.value+=";";
opener.document.forms[0].ldapauthcontainers.value+=document.forms[0].ou[i].value;
}
}
var values = jQuery("#ou:checked").map(function(){
return jQuery(this).val();
}).get().join(';');
window.opener.document.getElementById('ldapauthcontainers').value=values;
window.close();
-->
}
</script>
<body link="#000000" vlink="#000000" alink="#000000" >
<form method="post" action="system_usermanager_settings_ldapacpicker.php">
<?php if (empty($ous)): ?>
<p><?=gettext("Could not connect to the LDAP server. Please check your LDAP configuration.");?></p>
<input type='button' value='<?=gettext("Close"); ?>' onClick="window.close();">
<input type='button' class="btn btn-default" value='<?=gettext("Close"); ?>' onClick="window.close();">
<?php else: ?>
<b><?=gettext("Please select which containers to Authenticate against:");?></b>
<p/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabnavtbl">
<table width="100%">
<?php
if(is_array($ous)) {
foreach($ous as $ou) {
if(in_array($ou, $authcfg['ldap_authcn']))
$CHECKED=" CHECKED";
else
$CHECKED="";
echo " <tr><td><input type='checkbox' value='{$ou}' id='ou' name='ou[]'{$CHECKED}> {$ou}<br /></td></tr>\n";
}
}
?>
</table>
</td>
</tr>
<table class="table table-striped">
<tbody>
<tr>
<th>
<?=gettext("Please select which containers to Authenticate against:");?>
</th>
</tr>
<?php
if(is_array($ous)) {
foreach($ous as $ou) {
if(in_array($ou, $authcfg['ldap_authcn']))
$CHECKED=" CHECKED";
else
$CHECKED="";
echo " <tr><td><input type='checkbox' value='{$ou}' id='ou' name='ou[]'{$CHECKED}> {$ou}</td></tr>\n";
}
}
?>
<tr>
<td align="right">
<input type='button' class="btn btn-primary" value='<?=gettext("Save");?>' onClick="post_choices();">
</td>
</tr>
</tbody>
</table>
<p/>
<input type='button' value='<?=gettext("Save");?>' onClick="post_choices();">
<?php endif; ?>
</form>
</body>
......
......@@ -28,84 +28,64 @@
require("guiconfig.inc");
require_once("auth.inc");
include('head.inc');
if(isset($config['system']['authserver'][0]['host'])){
$auth_server = $config['system']['authserver'][0]['host'];
$authserver = $_GET['authserver'];
$authcfg = auth_get_authserver($authserver);
}
?>
<html>
<HEAD>
<STYLE type="text/css">
TABLE {
border-width: 1px 1px 1px 1px;
border-spacing: 0px;
border-style: solid solid solid solid;
border-color: gray gray gray gray;
border-collapse: separate;
background-color: collapse;
}
TD {
border-width: 1px 1px 1px 1px;
border-spacing: 0px;
border-style: solid solid solid solid;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
}
</STYLE>
</HEAD>
<body>
<form method="post" name="iform" id="iform">
<body>
<form method="post" name="iform" id="iform">
<?php
if (!$authcfg) {
printf(gettext("Could not find settings for %s%s"), htmlspecialchars($authserver), "<p/>");
} else {
echo sprintf(gettext("Testing %s LDAP settings... One moment please..."), $g['product_name']) . "<p/>";
echo "<table width='100%'>";
echo "<table class='table table-striped'>";
echo "<tr><td>" . gettext("Attempting connection to") . " " . $ldapserver . "</td><td>";
echo "<tr><th colspan='2'>".sprintf(gettext("Testing %s LDAP settings... One moment please..."), $g['product_name'])."</th></tr>";
echo "<tr><td>" . gettext("Attempting connection to") . " " . $authserver . "</td>";
if(ldap_test_connection($authcfg)) {
echo "<td><font color=green>OK</td></tr>";
echo "<td><font color='green'>OK</font></td></tr>";
echo "<tr><td>" . gettext("Attempting bind to") . " " . $ldapserver . "</td><td>";
echo "<tr><td>" . gettext("Attempting bind to") . " " . $authserver . "</td>";
if(ldap_test_bind($authcfg)) {
echo "<td><font color=green>OK</td></tr>";
echo "<td><font color='green'>OK</font></td></tr>";
echo "<tr><td>" . gettext("Attempting to fetch Organizational Units from") . " " . $ldapserver . "</td><td>";
echo "<tr><td>" . gettext("Attempting to fetch Organizational Units from") . " " . $authserver . "</td>";
$ous = ldap_get_user_ous(true, $authcfg);
if(count($ous)>1) {
echo "<td><font color=green>OK</td></tr>";
echo "</table>";
echo "<td><font color=green>OK</font></td></tr>";
if(is_array($ous)) {
echo gettext("Organization units found") . ":<p/>";
echo "<table width='100%'>";
echo "<tr><td colspan='2'>".gettext("Organization units found") . "</td></tr>";
foreach($ous as $ou) {
echo "<tr><td>" . $ou . "</td></tr>";
echo "<tr><td colspan='2'>" . $ou . "</td></tr>";
}
}
} else
echo "<td><font color=red>" . gettext("failed") . "</td></tr>";
echo "</table><p/>";
echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
} else {
echo "<td><font color=red>" . gettext("failed") . "</td></tr>";
echo "</table><p/>";
echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
}
} else {
echo "<td><font color=red>" . gettext("failed") . "</td></tr>";
echo "</table><p/>";
echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
}
}
?>
<p/>
<input type="Button" value="<?=gettext("Close"); ?>" onClick='Javascript:window.close();'>
<tr>
<td colspan="2" align="right">
<input type="Button" value="<?=gettext("Close"); ?>" class="btn btn-default" onClick='Javascript:window.close();'>
</td>
</tr>
</table>
</form>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment