diff --git a/lam/lib/modules/inetLocalMailRecipient.inc b/lam/lib/modules/inetLocalMailRecipient.inc index d410b258..15429e9e 100644 --- a/lam/lib/modules/inetLocalMailRecipient.inc +++ b/lam/lib/modules/inetLocalMailRecipient.inc @@ -227,14 +227,9 @@ class inetLocalMailRecipient extends baseModule { // check if address has correct format if (get_preg($_POST['localAdr'], 'mailLocalAddress')) { // check if new address is not already in database - $data = $_SESSION['cache']->get_cache('mailLocalAddress', 'inetLocalMailRecipient', 'user'); - $keys = array_keys($data); - for ($i = 0; $i < sizeof($keys); $i++) { - $adrList = $data[$keys[$i]]; - if (in_array_ignore_case($_POST['localAdr'], $adrList)) { - $errors[] = array('WARN', _('This mail address is already in use:') . " " . $_POST['localAdr'], $keys[$i]); - break; - } + $data = searchLDAPByAttribute('mailLocalAddress', $_POST['localAdr'], 'inetLocalMailRecipient', array('dn'), array('user')); + if (sizeof($data) > 0) { + $errors[] = array('WARN', _('This mail address is already in use:') . " " . $_POST['localAdr'], $data[0]['dn']); } $this->attributes['mailLocalAddress'][] = $_POST['localAdr']; } diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index ff0b73c8..b90df674 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -940,9 +940,10 @@ class inetOrgPerson extends baseModule implements passwordService { } if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideManager')) { // get list of existing users for manager attribute - $dnUsers = $_SESSION['cache']->get_cache('uid', 'inetOrgPerson', 'user'); - if (!is_array($dnUsers)) $dnUsers = array(); - $dnUsers = array_keys($dnUsers); + $dnUsers = searchLDAPByAttribute(null, null, 'inetOrgPerson', array('dn'), array('user')); + for ($i = 0; $i < sizeof($dnUsers); $i++) { + $dnUsers[$i] = $dnUsers[$i]['dn']; + } usort($dnUsers, array($_SESSION['ldap'], 'cmp_array')); array_unshift($dnUsers, '-'); $options = array();