Code Duplication    Length = 17-18 lines in 2 locations

html/includes/authentication/ldap-authorization.inc.php 1 location

@@ 256-272 (lines=17) @@
253
}
254
255
256
function get_membername ($username) {
257
    global $config, $ds;
258
    if ($config['auth_ldap_groupmembertype'] == 'fulldn') {
259
        $membername = $config['auth_ldap_prefix'] . $username . $config['auth_ldap_suffix'];
260
    }
261
    elseif ($config['auth_ldap_groupmembertype'] == 'puredn') {
262
        $filter  = '(' . $config['auth_ldap_attr']['uid'] . '=' . $username . ')';
263
        $search  = ldap_search($ds, $config['auth_ldap_groupbase'], $filter);
264
        $entries = ldap_get_entries($ds, $search);
265
        $membername = $entries[0]['dn'];
266
    }
267
    else {
268
        $membername = $username;
269
    }
270
271
    return $membername;
272
}
273
274
275
function auth_ldap_session_cache_get ($attr) {

html/includes/authentication/ldap.inc.php 1 location

@@ 205-222 (lines=18) @@
202
}
203
204
205
function get_membername($username) {
206
    global $config, $ds;
207
    if ($config['auth_ldap_groupmembertype'] == 'fulldn') {
208
        $membername = $config['auth_ldap_prefix'].$username.$config['auth_ldap_suffix'];
209
    }
210
    elseif ($config['auth_ldap_groupmembertype'] == 'puredn') {
211
        $filter  = '('.$config['auth_ldap_attr']['uid'].'='.$username.')';
212
        $search  = ldap_search($ds, $config['auth_ldap_groupbase'], $filter);
213
        $entries = ldap_get_entries($ds, $search);
214
        $membername = $entries[0]['dn'];
215
    }
216
    else {
217
        $membername = $username;
218
    }
219
220
    return $membername;
221
222
}
223
224
225
function get_group_list() {