Fix: view LDAP attributes of entry

This commit is contained in:
Regis Houssin 2009-12-21 12:19:02 +00:00
parent 7a56617ecd
commit b56c3325a4

View File

@ -116,7 +116,7 @@ function show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass)
* @param unknown_type $hide * @param unknown_type $hide
* @return unknown * @return unknown
*/ */
function show_ldap_content($result,$level,$count,$var,$hide=0) function show_ldap_content($result,$level,$count,$var,$hide=0,$subcount=0)
{ {
global $bc, $conf; global $bc, $conf;
@ -129,9 +129,7 @@ function show_ldap_content($result,$level,$count,$var,$hide=0)
if ("$key" == "objectclass") continue; if ("$key" == "objectclass") continue;
if ("$key" == "count") continue; if ("$key" == "count") continue;
if ("$key" == "dn") continue; if ("$key" == "dn") continue;
if ("$val" == "objectclass") continue; if ("$val" == "objectclass") continue;
//if ("$val" == $lastkey[$level]) continue;
$lastkey[$level]=$key; $lastkey[$level]=$key;
@ -141,22 +139,23 @@ function show_ldap_content($result,$level,$count,$var,$hide=0)
if (! is_numeric($key)) if (! is_numeric($key))
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].' valign="top">';
print '<td>'; print '<td>';
print $key; print $key;
print '</td><td>'; print '</td><td>';
if (strtolower($key) == 'userpassword') $hide=1; if (strtolower($key) == 'userpassword') $hide=1;
} }
show_ldap_content($val,$level+1,$count,$var,$hide); show_ldap_content($val,$level+1,$count,$var,$hide,$val["count"]);
} }
else else if ($subcount)
{ {
$subcount--;
$newstring=@htmlentities($val,ENT_COMPAT,'UTF-8'); // Make entity encoding $newstring=@htmlentities($val,ENT_COMPAT,'UTF-8'); // Make entity encoding
if ($hide) print preg_replace('/./i','*',$newstring); if ($hide) print preg_replace('/./i','*',$newstring);
else print $newstring; else print $newstring;
if ("$val" == $lastkey[$level]) print '<br>'; print '<br>';
} }
if ("$val" != $lastkey[$level]) print '</td></tr>'; if ("$val" != $lastkey[$level] && !$subcount) print '</td></tr>';
} }
return 1; return 1;
} }