Add get_account_id for ldap.php to use the accounts class

This commit is contained in:
Miles Lott 2001-03-21 23:28:57 +00:00
parent dab3d59f04
commit 32d5dec027

View File

@ -50,6 +50,39 @@
}
define('SEP',filesystem_separator());
function get_account_id($account_id = '',$default_id = '')
{
global $phpgw, $phpgw_info;
if (gettype($account_id) == 'integer')
{
return $account_id;
}
elseif ($account_id == '')
{
if ($default_id == '')
{
return $phpgw_info['user']['account_id'];
}
elseif (gettype($default_id) == 'string')
{
return $phpgw->accounts->name2id($default_id);
}
return intval($default_id);
}
elseif (gettype($account_id) == 'string')
{
if($phpgw->accounts->exists(intval($account_id)) == True)
{
return intval($account_id);
}
else
{
return $phpgw->accounts->name2id($account_id);
}
}
}
// Include to check user authorization against the
// password in ../header.inc.php to protect all of the setup
// pages from unauthorized use.