File: search_results_list.php

package info (click to toggle)
phpldapadmin 0.9.5-3sarge3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,052 kB
  • ctags: 2,526
  • sloc: php: 21,258; sh: 262; makefile: 132; xml: 42
file content (90 lines) | stat: -rw-r--r-- 2,638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php 

$friendly_attrs = process_friendly_attr_table();
$entry_id = ldap_first_entry( $ds, $results );

// Iterate over each entry
$i = 0;
while( $entry_id ) {
    $i++;
    if( $i <= $start_entry ) {
        $entry_id = ldap_next_entry( $ds, $entry_id );
        continue;
    }
    if( $i >= $end_entry )
        break;
    $dn = ldap_get_dn( $ds, $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( $server_id, $dn ); ?>" /></td>
              <td><a href="edit.php?server_id=<?php 
                 echo $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( $ds, $entry_id );
    $attr = ldap_first_attribute( $ds, $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( $server_id, $attr ) )
            $values = array( "(binary)" );
        else
            $values = ldap_get_values( $ds, $entry_id, $attr );
        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( $server_id, $attr ) )
                draw_jpeg_photos( $server_id, $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( $ds, $entry_id, $attrs );
    } // end while( $attr )

    ?>

        </table>

        <?php 

        $entry_id = ldap_next_entry( $ds, $entry_id );

    // flush every 5th entry (sppeds things up a bit)
    if( 0 == $i % 5 )
        flush();

} // end while( $entry_id )