From c77dea5328dae37363306bf1f912bae4a4b66f41 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 8 Feb 2002 06:07:46 +0000 Subject: [PATCH] Update get_account_id() --- setup/inc/functions.inc.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index 775d915217..e20f5cdb76 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -88,9 +88,19 @@ define('SEP',filesystem_separator()); + /*! + @function get_account_id + @abstract Return a properly formatted account_id. + @author skeeter + @discussion This function will return a properly formatted account_id. This can take either a name or an account_id as paramters. If a name is provided it will return the associated id. + @syntax get_account_id($accountid); + @example $account_id = get_account_id($accountid); + @param $account_id either a name or an id + @param $default_id either a name or an id + */ function get_account_id($account_id = '',$default_id = '') { - if (gettype($account_id) == 'integer') + if (is_int($account_id)) { return $account_id; } @@ -98,15 +108,15 @@ { if ($default_id == '') { - return $GLOBALS['phpgw_info']['user']['account_id']; + return (isset($GLOBALS['phpgw_info']['user']['account_id'])?$GLOBALS['phpgw_info']['user']['account_id']:0); } - elseif (gettype($default_id) == 'string') + elseif (is_string($default_id)) { return $GLOBALS['phpgw']->accounts->name2id($default_id); } return intval($default_id); } - elseif (gettype($account_id) == 'string') + elseif (is_string($account_id)) { if($GLOBALS['phpgw']->accounts->exists(intval($account_id)) == True) {