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

Several fixes, GUI and LDAP

parent c60d3f3e
...@@ -381,12 +381,12 @@ include("head.inc"); ...@@ -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"> <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"> <table class="table table-striped table-sort dragable">
<thead> <thead>
<tr id="frheader"> <tr id="frheader">
...@@ -821,12 +821,12 @@ include("head.inc"); ...@@ -821,12 +821,12 @@ include("head.inc");
<td class="list">&nbsp;</td> <td class="list">&nbsp;</td>
<td class="list"> <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): ?> <?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> <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> <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> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -282,7 +282,7 @@ include("head.inc"); ...@@ -282,7 +282,7 @@ include("head.inc");
?> ?>
<section class="col-xs-12"> <section class="col-xs-12">
<div class="content-box"> <div class="content-box table-responsive">
<form action="system.php" method="post"> <form action="system.php" method="post">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area" class="table table-striped"> <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area" class="table table-striped">
......
...@@ -134,7 +134,7 @@ include("head.inc"); ...@@ -134,7 +134,7 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<? include('system_advanced_tabs.php'); ?> <? 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" ): ?> <?php if ($act != "edit" ): ?>
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area" class="table table-striped"> <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area" class="table table-striped">
<thead> <thead>
......
...@@ -422,7 +422,7 @@ function select_clicked() { ...@@ -422,7 +422,7 @@ function select_clicked() {
url += '&cert='; url += '&cert=';
<?php endif; ?> <?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") if (oWin==null || typeof(oWin)=="undefined")
alert("<?=gettext('Popup blocker detected. Action aborted.');?>"); alert("<?=gettext('Popup blocker detected. Action aborted.');?>");
} }
...@@ -453,7 +453,7 @@ function select_clicked() { ...@@ -453,7 +453,7 @@ function select_clicked() {
display_top_tabs($tab_array); 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): ?> <?php if ($act == "new" || $act == "edit" || $input_errors): ?>
<form id="iform" name="iform" action="system_authservers.php" method="post"> <form id="iform" name="iform" action="system_authservers.php" method="post">
......
...@@ -347,7 +347,7 @@ function method_change() { ...@@ -347,7 +347,7 @@ function method_change() {
<? include('system_tabs.php'); ?> <? include('system_tabs.php'); ?>
<div class="content-box tab-content"> <div class="content-box tab-content table-responsive" style="overflow: auto;">
<?php <?php
......
...@@ -576,7 +576,7 @@ function internalca_change() { ...@@ -576,7 +576,7 @@ function internalca_change() {
<?php include('system_manager_tabs.php'); ?> <?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)): ?> <?php if ($act == "new" || (($_POST['save'] == gettext("Save")) && $input_errors)): ?>
......
...@@ -753,7 +753,7 @@ function enable_change() { ...@@ -753,7 +753,7 @@ function enable_change() {
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td> <td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td>
<td width="78%" class="vtable"> <td width="78%" class="vtable">
<select name='weight' class='formfldselect' id='weight'> <select name='weight' class='formfldselect selectpicker' id='weight' data-width="auto">
<?php <?php
for ($i = 1; $i < 6; $i++) { for ($i = 1; $i < 6; $i++) {
$selected = ""; $selected = "";
......
...@@ -229,22 +229,29 @@ include("head.inc"); ...@@ -229,22 +229,29 @@ include("head.inc");
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Destination network"); ?></td> <td width="22%" valign="top" class="vncellreq"><?=gettext("Destination network"); ?></td>
<td width="78%" class="vtable"> <td width="78%" class="vtable">
<table>
<tr>
<td width="348px">
<input name="network" type="text" class="formfldalias ipv4v6" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" /> <input name="network" type="text" class="formfldalias ipv4v6" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" />
/ </td>
<select name="network_subnet" class="formselect ipv4v6" id="network_subnet"> <td>
<select name="network_subnet" class="selectpicker ipv4v6" id="network_subnet" data-width="auto">
<?php for ($i = 128; $i >= 1; $i--): ?> <?php for ($i = 128; $i >= 1; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>> <option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>>
<?=$i;?> <?=$i;?>
</option> </option>
<?php endfor; ?> <?php endfor; ?>
</select> </select>
</td>
</tr>
</table>
<br /><span class="vexpl"><?=gettext("Destination network for this static route"); ?></span> <br /><span class="vexpl"><?=gettext("Destination network for this static route"); ?></span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td> <td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td>
<td width="78%" class="vtable"> <td width="78%" class="vtable">
<select name="gateway" id="gateway" class="form-control"> <select name="gateway" id="gateway" class="selectpicker">
<?php <?php
foreach ($a_gateways as $gateway) { foreach ($a_gateways as $gateway) {
?> ?>
...@@ -274,7 +281,7 @@ include("head.inc"); ...@@ -274,7 +281,7 @@ include("head.inc");
<tr> <tr>
<td width="22%"><?=gettext("Interface:"); ?></td> <td width="22%"><?=gettext("Interface:"); ?></td>
<td with="78%"> <td with="78%">
<select name="addinterfacegw" id="addinterfacegw"> <select name="addinterfacegw" id="addinterfacegw" class="selectpicker">
<?php $gwifs = get_configured_interface_with_descr(); <?php $gwifs = get_configured_interface_with_descr();
foreach($gwifs as $fif => $dif) foreach($gwifs as $fif => $dif)
echo "<option value=\"{$fif}\">{$dif}</option>\n"; echo "<option value=\"{$fif}\">{$dif}</option>\n";
...@@ -347,21 +354,25 @@ include("head.inc"); ...@@ -347,21 +354,25 @@ include("head.inc");
function show_add_gateway() { function show_add_gateway() {
document.getElementById("addgateway").style.display = ''; document.getElementById("addgateway").style.display = '';
document.getElementById("addgwbox").style.display = 'none'; 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("save").style.display = 'none';
document.getElementById("cancel").style.display = 'none'; document.getElementById("cancel").style.display = 'none';
document.getElementById("gwsave").style.display = ''; document.getElementById("gwsave").style.display = '';
document.getElementById("gwcancel").style.display = ''; document.getElementById("gwcancel").style.display = '';
//jQuery('.selectpicker').selectpicker('refresh');
jQuery('#notebox').html(""); jQuery('#notebox').html("");
} }
function hide_add_gateway() { function hide_add_gateway() {
document.getElementById("addgateway").style.display = 'none'; document.getElementById("addgateway").style.display = 'none';
document.getElementById("addgwbox").style.display = ''; 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("save").style.display = '';
document.getElementById("cancel").style.display = ''; document.getElementById("cancel").style.display = '';
document.getElementById("gwsave").style.display = ''; document.getElementById("gwsave").style.display = '';
document.getElementById("gwcancel").style.display = ''; document.getElementById("gwcancel").style.display = '';
//jQuery('.selectpicker').selectpicker('refresh');
} }
function hide_add_gatewaysave() { function hide_add_gatewaysave() {
document.getElementById("addgateway").style.display = 'none'; document.getElementById("addgateway").style.display = 'none';
...@@ -392,6 +403,7 @@ include("head.inc"); ...@@ -392,6 +403,7 @@ include("head.inc");
selectbox.append(optn); selectbox.append(optn);
selectbox.prop('selectedIndex',selectbox.children('option').length-1); 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('#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() { function report_failure() {
alert("<?=gettext("Sorry, we could not create your gateway at this time."); ?>"); alert("<?=gettext("Sorry, we could not create your gateway at this time."); ?>");
...@@ -403,6 +415,7 @@ include("head.inc"); ...@@ -403,6 +415,7 @@ include("head.inc");
hide_add_gateway(); hide_add_gateway();
var gwtext = escape(name) + " - " + gatewayip; var gwtext = escape(name) + " - " + gatewayip;
addOption(jQuery('#gateway'), gwtext, name); addOption(jQuery('#gateway'), gwtext, name);
jQuery('.selectpicker').selectpicker('refresh');
} else { } else {
report_failure(); report_failure();
} }
......
...@@ -451,7 +451,7 @@ function sshkeyClicked(obj) { ...@@ -451,7 +451,7 @@ function sshkeyClicked(obj) {
display_top_tabs($tab_array); 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 <?php
if ($_POST['act'] == "new" || $_POST['act'] == "edit" || $input_errors): if ($_POST['act'] == "new" || $_POST['act'] == "edit" || $input_errors):
......
...@@ -115,7 +115,7 @@ include("head.inc"); ...@@ -115,7 +115,7 @@ include("head.inc");
$pconfig['backend'] = "pfsense"; $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"> <form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
require("guiconfig.inc"); require("guiconfig.inc");
require_once("auth.inc"); require_once("auth.inc");
include('head.inc');
$ous = array(); $ous = array();
...@@ -47,76 +48,50 @@ if($_GET) { ...@@ -47,76 +48,50 @@ if($_GET) {
} }
?> ?>
<html>
<head> <body>
<STYLE type="text/css"> <script type="text/javascript">
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">
function post_choices() { function post_choices() {
var ous = <?php echo count($ous); ?>; var ous = <?php echo count($ous); ?>;
var i; var i;
opener.document.forms[0].ldapauthcontainers.value=""; var values = jQuery("#ou:checked").map(function(){
for (i = 0; i < ous; i++) { return jQuery(this).val();
if (document.forms[0].ou[i].checked) { }).get().join(';');
if (opener.document.forms[0].ldapauthcontainers.value != "") window.opener.document.getElementById('ldapauthcontainers').value=values;
opener.document.forms[0].ldapauthcontainers.value+=";";
opener.document.forms[0].ldapauthcontainers.value+=document.forms[0].ou[i].value;
}
}
window.close(); window.close();
-->
} }
</script> </script>
<body link="#000000" vlink="#000000" alink="#000000" >
<form method="post" action="system_usermanager_settings_ldapacpicker.php"> <form method="post" action="system_usermanager_settings_ldapacpicker.php">
<?php if (empty($ous)): ?> <?php if (empty($ous)): ?>
<p><?=gettext("Could not connect to the LDAP server. Please check your LDAP configuration.");?></p> <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: ?> <?php else: ?>
<b><?=gettext("Please select which containers to Authenticate against:");?></b> <table class="table table-striped">
<p/> <tbody>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <tr>
<td class="tabnavtbl"> <th>
<table width="100%"> <?=gettext("Please select which containers to Authenticate against:");?>
<?php </th>
</tr>
<?php
if(is_array($ous)) { if(is_array($ous)) {
foreach($ous as $ou) { foreach($ous as $ou) {
if(in_array($ou, $authcfg['ldap_authcn'])) if(in_array($ou, $authcfg['ldap_authcn']))
$CHECKED=" CHECKED"; $CHECKED=" CHECKED";
else else
$CHECKED=""; $CHECKED="";
echo " <tr><td><input type='checkbox' value='{$ou}' id='ou' name='ou[]'{$CHECKED}> {$ou}<br /></td></tr>\n"; echo " <tr><td><input type='checkbox' value='{$ou}' id='ou' name='ou[]'{$CHECKED}> {$ou}</td></tr>\n";
} }
} }
?> ?>
</table> <tr>
<td align="right">
<input type='button' class="btn btn-primary" value='<?=gettext("Save");?>' onClick="post_choices();">
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
<p/>
<input type='button' value='<?=gettext("Save");?>' onClick="post_choices();">
<?php endif; ?> <?php endif; ?>
</form> </form>
</body> </body>
......
...@@ -28,34 +28,17 @@ ...@@ -28,34 +28,17 @@
require("guiconfig.inc"); require("guiconfig.inc");
require_once("auth.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']; $authserver = $_GET['authserver'];
$authcfg = auth_get_authserver($authserver); $authcfg = auth_get_authserver($authserver);
}
?> ?>
<html> <body>
<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"> <form method="post" name="iform" id="iform">
<?php <?php
...@@ -63,49 +46,46 @@ $authcfg = auth_get_authserver($authserver); ...@@ -63,49 +46,46 @@ $authcfg = auth_get_authserver($authserver);
if (!$authcfg) { if (!$authcfg) {
printf(gettext("Could not find settings for %s%s"), htmlspecialchars($authserver), "<p/>"); printf(gettext("Could not find settings for %s%s"), htmlspecialchars($authserver), "<p/>");
} else { } 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)) { 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)) { 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); $ous = ldap_get_user_ous(true, $authcfg);
if(count($ous)>1) { if(count($ous)>1) {
echo "<td><font color=green>OK</td></tr>"; echo "<td><font color=green>OK</font></td></tr>";
echo "</table>";
if(is_array($ous)) { if(is_array($ous)) {
echo gettext("Organization units found") . ":<p/>"; echo "<tr><td colspan='2'>".gettext("Organization units found") . "</td></tr>";
echo "<table width='100%'>";
foreach($ous as $ou) { foreach($ous as $ou) {
echo "<tr><td>" . $ou . "</td></tr>"; echo "<tr><td colspan='2'>" . $ou . "</td></tr>";
} }
} }
} else } else
echo "<td><font color=red>" . gettext("failed") . "</td></tr>"; echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
echo "</table><p/>";
} else { } else {
echo "<td><font color=red>" . gettext("failed") . "</td></tr>"; echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
echo "</table><p/>";
} }
} else { } else {
echo "<td><font color=red>" . gettext("failed") . "</td></tr>"; echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
echo "</table><p/>";
} }
} }
?> ?>
<p/> <tr>
<input type="Button" value="<?=gettext("Close"); ?>" onClick='Javascript:window.close();'> <td colspan="2" align="right">
<input type="Button" value="<?=gettext("Close"); ?>" class="btn btn-default" onClick='Javascript:window.close();'>
</td>
</tr>
</table>
</form> </form>
</body> </body>
</html> </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