summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 066388c)
raw | patch | inline | side by side (parent: 066388c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Sep 2009 12:36:36 +0000 (12:36 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Sep 2009 12:36:36 +0000 (12:36 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14252 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/functions.inc | patch | blob | history |
index 4962bb11f2eb1dec3bdb7459eadee2bed2de01e2..cfe1aa99ad8c8f1a6799fa0b6622407581e473b5 100644 (file)
$proposed= recurse($stripped, $variables);
# /* Get list of used ID's */
-# $used= array();
- $ldap= $config->get_ldap_link();
- $ldap->cd($config->current['BASE']);
-# $ldap->search('(uid=*)');
-#
-# while($attrs= $ldap->fetch()){
-# $used[]= $attrs['uid'][0];
-# }
+ $ldap= $config->get_ldap_link();
+ $ldap->cd($config->current['BASE']);
/* Remove used uids and watch out for id tags */
$ret= array();
$res= preg_replace('/{id:(\d+)}/', $number, $uid);
$ldap->search("uid={$res}",array('dn'));
- if(!count($ldap)){
+ if(!$ldap->count()){
$uid= $res;
break;
}
$number= sprintf("%0".$size."d", mt_rand(0, pow(10, $size)-1));
$res= preg_replace('/{id#(\d+)}/', $number, $uid);
$ldap->search("uid={$res}",array('dn'));
- if(!count($ldap)){
+ if(!$ldap->count()){
$uid= $res;
break;
}
/* Don't assign used ones */
$ldap->search("uid={$uid}",array('dn'));
- if(!count($ldap)){
+ if(!$ldap->count()){
/* Add uid, but remove {} first. These are invalid anyway. */
$ret[]= preg_replace('/[{}]/', '', $uid);
}