roundcubemail/program/lib/Roundcube/rcube_ldap_generic.php
public static function normalize_entry($entry, $flat = false)
    {
        if (!isset($entry['count'])) {
            return $entry;
        }

        $rec = array();

        for ($i=0; $i < $entry['count']; $i++) {
            $attr = $entry[$i];
            if ($entry[$attr]['count'] == 1) {
                switch ($attr) {
                    case 'objectclass':
                        $rec[$attr] = array(strtolower($entry[$attr][0]));
                        break;
                    default:
                        $rec[$attr] = $entry[$attr][0];
                        break;
                }
            }
            else {
                for ($j=0; $j < $entry[$attr]['count']; $j++) {
                    $rec[$attr][$j] = $entry[$attr][$j];
                }
            }
        }

        return $rec;
    }
public static function normalize_entry($entry, $flat = false)
    {
        if (!isset($entry['count'])) {
            return $entry;
        }

        $rec = array();

        for ($i=0; $i < $entry['count']; $i++) {
            $attr = $entry[$i];
            if ($entry[$attr]['count'] == 1) {
                switch ($attr) {
                    case 'objectclass':
                        $rec[$attr] = array(strtolower($entry[$attr][0]));
                        break;
                    default:
                        $rec[$attr] = $entry[$attr][0];
                        break;
                }
            }
            else {
                for ($j=0; $j < $entry[$attr]['count']; $j++) {
                    $rec[$attr][$j] = $entry[$attr][$j];
                }
            }
        }

        return $rec;
    }
public static function normalize_entry ( $ entry , $ flat = false ) { if ( ! isset ( $ entry [ 'count' ] ) ) { return $ entry ; } $ rec = array ( ) ; for ( $ i = 0 ; $ i < $ entry [ 'count' ] ; $ i ++ ) { $ attr = $ entry [ $ i ] ; if ( $ entry [ $ attr ] [ 'count' ] == 1 ) { switch ( $ attr ) { case 'objectclass' : $ rec [ $ attr ] = array ( strtolower ( $ entry [ $ attr ] [ 0 ] ) ) ; break ; default : $ rec [ $ attr ] = $ entry [ $ attr ] [ 0 ] ; break ; } } else { for ( $ j = 0 ; $ j < $ entry [ $ attr ] [ 'count' ] ; $ j ++ ) { $ rec [ $ attr ] [ $ j ] = $ entry [ $ attr ] [ $ j ] ; } } } return $ rec ; }
Turn an LDAP entry into a regular PHP array with attributes as keys.

@param array $entry Attributes array as retrieved from ldap_get_attributes() or ldap_get_entries()
@param bool  $flat  Convert one-element-array values into strings (not implemented)

@return array Hash array with attributes as keys
Turn an LDAP entry into a regular PHP array with attributes as keys .