diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php
index 25de376bb5..10408c3976 100644
--- a/phpgwapi/inc/functions.inc.php
+++ b/phpgwapi/inc/functions.inc.php
@@ -77,11 +77,57 @@
global $phpgw;
return $phpgw->common->check_code($code);
}
- /*!
- @function filesystem_separator()
- @abstract sets the file system seperator depending on OS
- @result file system separator
- */
+
+ /*!
+ @function get_account_id()
+ @abstract Return a properly formatted account_id.
+ @discussion Author: skeeter
+ 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);
+ Example1: $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 = '')
+ {
+ 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);
+ }
+ }
+ }
+
+ /*!
+ @function filesystem_separator()
+ @abstract sets the file system seperator depending on OS
+ @result file system separator
+ */
function filesystem_separator()
{
if (PHP_OS == 'Windows' || PHP_OS == 'OS/2') {
@@ -91,16 +137,16 @@
}
}
- function print_debug($text)
+ function print_debug($text='')
{
global $debugme;
- if ($debugme == "on") { echo 'debug: '.$text.'
'; }
+ if (isset($debugme) && $debugme == "on") { echo 'debug: '.$text.'
'; }
}
print_debug('core functions are done');
/****************************************************************************\
* Quick verification of sane environment *
\****************************************************************************/
- error_reporting(7);
+// error_reporting(7);
/* Make sure the header.inc.php is current. */
if ($phpgw_info["server"]["versions"]["header"] < $phpgw_info["server"]["versions"]["current_header"]){
echo "