Commit 93db22e0 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(legacy) refactor system_usermanager_settings_test.php

(cherry picked from commit b57f2415)
parent 4127bac1
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
All rights reserved.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
......@@ -40,47 +40,65 @@ if (isset($config['system']['authserver'][0]['host'])) {
ldap_setup_caenv($authcfg);
$ldap_is_connected = $ldap_auth->connect($authcfg['ldap_full_url'], $authcfg['ldap_binddn'], $authcfg['ldap_bindpw']);
}
?>
<body>
<form method="post" name="iform" id="iform">
<html>
<body>
<table class='table table-striped'>
<?php
if (!$authcfg) {
printf(gettext("Could not find settings for %s%s"), htmlspecialchars($authserver), "<p/>");
} else {
echo "<table class='table table-striped'>";
echo "<tr><th colspan='2'>".gettext("Testing LDAP settings... One moment please...")."</th></tr>";
echo "<tr><td>" . gettext("Attempting connection to") . " " . $authserver . "</td>";
if ($ldap_is_connected) {
echo "<td><font color='green'>OK</font></td></tr>";
echo "<tr><td>" . gettext("Attempting to fetch Organizational Units from") . " " . $authserver . "</td>";
$ous = $ldap_auth->listOUs();
if (count($ous)>1) {
echo "<td><font color=green>OK</font></td></tr>";
echo "<tr><td>".gettext("Organization units found") . "</td><td><font color=green>".count($ous)."</font></td></tr>";
foreach ($ous as $ou) {
echo "<tr><td colspan='2'>" . $ou . "</td></tr>";
}
} else {
echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
}
} else {
echo "<td><font color='red'>" . gettext("failed") . "</font></td></tr>";
}
}
?>
<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>
if (empty($authcfg)):?>
<tr>
<td>
<?php
printf(gettext("Could not find settings for %s%s"), htmlspecialchars($authserver), "<p/>");?>
</td>
</tr>
<?php
else:?>
<tr>
<td colspan='2'>
<?=sprintf(gettext("Testing %s LDAP settings... One moment please..."), $g['product_name']);?>
</td>
</tr>
<tr>
<td><?=gettext("Attempting connection to") . " " . htmlspecialchars($authserver);?></td>
<?php
if ($ldap_is_connected):?>
<td>
<font color='green'><?=gettext("OK");?></font></td>
</tr>
<tr>
<td><?=gettext("Attempting to fetch Organizational Units from") . " " . htmlspecialchars($authserver);?></td>
<?php
$ous = $ldap_auth->listOUs();
if (count($ous)>1):?>
<td><font color=green><?=gettext("OK");?></font></td>
</tr>
<tr>
<td><?=gettext("Organization units found");?> </td>
<td><font color=green><?=count($ous);?></font></td>
</tr>
<?php
foreach($ous as $ou):?>
<tr><td colspan='2'><?=$ou;?></td></tr>
<?php
endforeach;
else:?>
<td><font color='red'><?=gettext("failed");?></font></td>
</tr>
<?php
endif;?>
<?php
else:?>
<td><font color='red'><?=gettext("failed");?></font></td>
</tr>
<?php
endif;
endif;?>
<tr>
<td colspan="2" align="right">
<input type="Button" value="<?=gettext("Close"); ?>" class="btn btn-default" onClick='Javascript:window.close();'>
</td>
</tr>
</table>
</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