Merge pull request #1338 from SilvioGiunge/change_system_usermanager_settings_test_page

This commit is contained in:
Renato Botelho 2014-11-17 14:48:06 -02:00
commit d33e600840

View File

@ -4,6 +4,7 @@
part of pfSense (https://www.pfsense.org/)
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2013-2014 Electric Sheep Fencing, LP
Copyright (C) 2014 Silvio Giunge <desenvolvimento@bluepex.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -41,8 +42,11 @@
require("guiconfig.inc");
require_once("auth.inc");
$authserver = $_GET['authserver'];
$authcfg = auth_get_authserver($authserver);
if(isset($config['system']['authserver'][0]['host'])){
$auth_server = $config['system']['authserver'][0]['host'];
$authserver = $_GET['authserver'];
$authcfg = auth_get_authserver($authserver);
}
?>
@ -50,7 +54,7 @@ $authcfg = auth_get_authserver($authserver);
<HEAD>
<STYLE type="text/css">
TABLE {
border-width: 1px 1px 1px 1px;
border-width: 1px;
border-spacing: 0px;
border-style: solid solid solid solid;
border-color: gray gray gray gray;
@ -63,7 +67,7 @@ $authcfg = auth_get_authserver($authserver);
border-style: solid solid solid solid;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
background-color: #dddddd;
}
</STYLE>
</HEAD>
@ -71,32 +75,37 @@ $authcfg = auth_get_authserver($authserver);
<form method="post" name="iform" id="iform">
<?php
$theme = $config['theme'];
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/>";
if($theme != "" && file_exists("/usr/local/www/themes/{$theme}/images/logo.gif")){
echo "<p><img src='/themes/{$theme}/images/logo.gif' style='float: left'><br/><br/><br/></p>";
}
echo "<b>" . sprintf(gettext("Testing %s LDAP settings... One moment please..."), $g['product_name']) . "</b>";
echo "<table width='100%'>";
echo "<tr><td>" . gettext("Attempting connection to") . " " . $ldapserver . "</td><td>";
echo "<tr><td>" . gettext("Attempting connection to") . " " . "<td><center>$auth_server</b></center></td>";
if(ldap_test_connection($authcfg)) {
echo "<td><font color=green>OK</td></tr>";
echo "<td><center><font color=green>OK</center></td></tr>";
echo "<tr><td>" . gettext("Attempting bind to") . " " . $ldapserver . "</td><td>";
echo "<tr><td>" . gettext("Attempting bind to") . " " . "<td><center>$auth_server</b></center></td>";
if(ldap_test_bind($authcfg)) {
echo "<td><font color=green>OK</td></tr>";
echo "<td><center><font color=green>OK</center></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") . " " . "<td><center>$auth_server</b></center></td>";
$ous = ldap_get_user_ous(true, $authcfg);
if(count($ous)>1) {
echo "<td><font color=green>OK</td></tr>";
echo "<td><center><font color=green>OK</center></td></tr>";
echo "</table>";
if(is_array($ous)) {
echo gettext("Organization units found") . ":<p/>";
echo "<br/>";
echo "<b>" . gettext("Organization units found") . "</b>";
echo "<table width='100%'>";
foreach($ous as $ou) {
echo "<tr><td>" . $ou . "</td></tr>";
echo "<tr><td onmouseover=\"this.style.backgroundColor='#ffffff';\" onmouseout=\"this.style.backgroundColor='#dddddd';\">" . $ou . "</td></tr>";
}
}
} else