need to allow account_lid string as parameter for accounts::id2name(), it is used in many places

This commit is contained in:
Ralf Becker 2012-08-13 14:26:00 +00:00
parent 1d519c4834
commit 1d743830c9
2 changed files with 6 additions and 2 deletions

View File

@ -591,12 +591,16 @@ class accounts
* *
* Uses the read method to fetch all data. * Uses the read method to fetch all data.
* *
* @param int $account_id numerica account_id * @param int|string $account_id numeric account_id or account_lid
* @param string $which='account_lid' type to convert to: account_lid (default), account_email, ... * @param string $which='account_lid' type to convert to: account_lid (default), account_email, ...
* @return string|boolean converted value or false on error ($account_id not found) * @return string|boolean converted value or false on error ($account_id not found)
*/ */
static function id2name($account_id, $which='account_lid') static function id2name($account_id, $which='account_lid')
{ {
if (!is_numeric($account_id) && !($account_id = self::getInstance()->name2id($account_id)))
{
return false;
}
try { try {
if (!($data = self::cache_read($account_id))) return false; if (!($data = self::cache_read($account_id))) return false;
} }

View File

@ -285,7 +285,7 @@ class accounts_ldap
if (!$members) $members = $this->members($data['account_id']); if (!$members) $members = $this->members($data['account_id']);
$to_write[$forward] = array(); $to_write[$forward] = array();
foreach ($members as $member) foreach ($members as $member => $account_lid)
{ {
if (($email = $this->id2name($member,'account_email'))) if (($email = $this->id2name($member,'account_email')))
{ {