phpldapadmin/lib/search_results_list.php

93 lines
2.4 KiB
PHP
Raw Normal View History

2009-06-30 09:29:51 +00:00
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/search_results_list.php,v 1.5 2005/04/29 11:24:15 wurley Exp $
/**
* @package phpLDAPadmin
*/
2009-06-30 09:22:30 +00:00
$friendly_attrs = process_friendly_attr_table();
2009-06-30 09:29:51 +00:00
$entry_id = ldap_first_entry( $ldapserver->connect(), $results );
2009-06-30 09:22:30 +00:00
// Iterate over each entry
$i = 0;
while( $entry_id ) {
2009-06-30 09:29:51 +00:00
$i++;
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
if( $i <= $start_entry ) {
$entry_id = ldap_next_entry( $ldapserver->connect(), $entry_id );
continue;
}
if( $i >= $end_entry )
break;
$dn = ldap_get_dn( $ldapserver->connect(), $entry_id );
$encoded_dn = rawurlencode( $dn );
$rdn = get_rdn( $dn ); ?>
<div class="search_result">
<table>
<tr>
<td><img src="images/<?php echo get_icon_use_cache( $ldapserver, $dn ); ?>" /></td>
<td><a href="edit.php?server_id=<?php echo $ldapserver->server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>"><?php echo htmlspecialchars($rdn); ?></a></td>
</tr>
</table>
</div>
<table class="attrs">
<?php $attrs = ldap_get_attributes( $ldapserver->connect(), $entry_id );
$attr = ldap_first_attribute( $ldapserver->connect(), $entry_id, $attrs );
// Always print out the DN in the attribute list
echo "<tr><td class=\"attr\" valign=\"top\">dn</td>";
echo "<td>" . htmlspecialchars($dn) . "</td></tr>\n";
// Iterate over each attribute for this entry
while( $attr ) {
if( is_attr_binary( $ldapserver, $attr ) )
$values = array( "(binary)" );
else
$values = ldap_get_values( $ldapserver->connect(), $entry_id, $attr );
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
if( isset( $values['count'] ) )
unset( $values['count'] );
if( isset( $friendly_attrs[ strtolower( $attr ) ] ) )
$attr = "<acronym title=\"Alias for $attr\">".htmlspecialchars( $friendly_attrs[ strtolower($attr) ] ) .
"</acronym>";
else
$attr = htmlspecialchars( $attr ); ?>
<tr>
<td class="attr" valign="top"><?php echo $attr; ?></td>
<td class="val">
<?php if( is_jpeg_photo( $ldapserver, $attr ) )
draw_jpeg_photos( $ldapserver, $dn, $attr, false, false, 'align="left"' );
else
foreach( $values as $value )
echo str_replace( ' ', '&nbsp;', htmlspecialchars( $value ) ) . "<br />\n"; ?>
</td>
</tr>
<?php $attr = ldap_next_attribute( $ldapserver->connect(), $entry_id, $attrs );
} // end while( $attr ) ?>
</table>
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
<?php $entry_id = ldap_next_entry( $ldapserver->connect(), $entry_id );
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
// flush every 5th entry (speeds things up a bit)
if( 0 == $i % 5 )
flush();
2009-06-30 09:22:30 +00:00
} // end while( $entry_id )
2009-06-30 09:29:51 +00:00
?>