From afea2d7d565276f4448df3f3ca79bc039386f17f Mon Sep 17 00:00:00 2001 From: skeeter Date: Tue, 3 Apr 2001 03:08:50 +0000 Subject: [PATCH] Possible fix for error on line 53 of ->preferences when logging in. --- phpgwapi/inc/functions.inc.php | 76 +++++++++++++++++----------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index 6d01f4298c..85b594de2d 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -97,6 +97,44 @@ if ($debugme == "on") { echo 'debug: '.$text.'
'; } } + /************************************************************************\ + * This function will return a properly formatted account_id. * + * This needs to be placed here, or some classes will have a problem * + * on instantiation. * + \************************************************************************/ + 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); + } + } + } + print_debug('core functions are done'); /****************************************************************************\ * Quick verification of sane environment * @@ -389,42 +427,4 @@ } error_reporting(7); - - /************************************************************************\ - * This function will return a properly formatted account_id. * - * This needs to be placed here, or some classes will have a problem * - * on instantiation. * - \************************************************************************/ - 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); - } - } - }