1,'dn'=>1);
$entries_display = array();
/* Iterate over each entry and store the whole dang thing in memory (necessary to extract
all attribute names and display in table format in a single pass) */
$i=0;
foreach ($results as $dn => $dndetails) {
$i++;
if ($i <= $start_entry)
continue;
if ($i >= $end_entry)
break;
$dn_display = strlen($dn) > 40 ?
sprintf('%s...',htmlspecialchars($dn),htmlspecialchars(substr($dn,0,40))) :
htmlspecialchars($dn);
$edit_url = sprintf('template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,rawurlencode($dn));
$attrs_display = array();
$attrs_display[''] = sprintf('
',$edit_url,get_icon($ldapserver,$dn));
$attrs_display['dn'] = sprintf('%s',$edit_url,$dn_display);
# Iterate over each attribute for this entry and store in associative array $attrs_display
foreach ($dndetails as $attr => $values) {
# Ignore DN, we've already displayed it.
if ($attr == 'dn')
continue;
# Clean up the attr name
if (isset($friendly_attrs[strtolower($attr)]))
$attr_display = sprintf('%s',
$attr,htmlspecialchars($friendly_attrs[strtolower($attr)]));
else
$attr_display = htmlspecialchars($attr);
if (! isset($all_attrs[$attr_display]))
$all_attrs[$attr_display] = 1;
# Get the values
$display = '';
if ($ldapserver->isJpegPhoto($attr)) {
ob_start();
draw_jpeg_photos($ldapserver,$dn,$attr,false,false,'align="center"');
$display = ob_get_contents();
ob_end_clean();
} elseif ($ldapserver->isAttrBinary($attr)) {
$display = array('(binary)');
} else {
if (! is_array($values))
$display .= str_replace(' ',' ',htmlspecialchars($values)).'
';
else
foreach ($values as $value )
$display .= str_replace(' ',' ',htmlspecialchars($value)).'
';
}
$attrs_display[$attr_display] = $display;
}
$entries_display[] = $attrs_display;
}
$all_attrs = array_keys($all_attrs);
# Store the header row so it can be repeated later
$header_row = '';
foreach ($all_attrs as $attr)
$header_row .= sprintf('%s | ',$attr);
$header_row .= '
';
# Begin drawing table
echo '
';
echo '';
echo '';
for ($i=0;$i';
else
echo '';
foreach ($all_attrs as $attr) {
echo '';
if (isset($entry[$attr]))
echo $entry[$attr];
echo ' | ';
}
echo '
';
}
echo '
';
echo '';
?>