Added some comments about legecy code and started adding in debugging info into the API

This commit is contained in:
jengo 2001-03-18 05:16:00 +00:00
parent 40fb427d31
commit 5d7cb50e74

View File

@ -37,61 +37,70 @@
@class common @class common
@abstract common class that contains commonly used functions @abstract common class that contains commonly used functions
*/ */
class common class common
{ {
var $phpgw; var $phpgw;
var $iv = ''; var $iv = '';
var $key = ''; var $key = '';
var $crypto; var $crypto;
var $debug_info; // An array with debugging info from the API
// Convert an array into the format needed for the access column. // Convert an array into the format needed for the access column.
/*! /*!
@functionn array_to_string @functionn array_to_string
@abstract Convert an array into the format needed for the access column @abstract Convert an array into the format needed for the access column
@param $access @param $access
@param $array @param $array
*/ */
function array_to_string($access,$array) function array_to_string($access,$array)
{ {
$s = ''; $this->debug_info[] = 'array_to_string() is a depreciated function - use ACL instead';
if ($access == 'group' || $access == 'public' || $access == 'none') { $s = '';
if (count($array)) { if ($access == 'group' || $access == 'public' || $access == 'none')
while ($t = each($array)) { {
$s .= ',' . $t[1]; if (count($array))
} {
$s .= ','; while ($t = each($array)) {
} $s .= ',' . $t[1];
if (! count($array) && $access == 'none') { }
$s = ''; $s .= ',';
} }
} if (! count($array) && $access == 'none')
return $s; {
} $s = '';
}
}
return $s;
}
// This is used for searching the access fields // This is used for searching the access fields
/*! /*!
@function sql_search @function sql_search
@abstract this function is used for searching the access fields @abstract this function is used for searching the access fields
@param $table @param $table
@param $owner @param $owner
*/ */
function sql_search($table,$owner=0) function sql_search($table,$owner=0)
{ {
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
$s = ''; $this->debug_info[] = 'sql_search() is a depreciated function - use ACL instead';
if (!$owner) { $s = '';
$owner = $phpgw_info['user']['account_id']; if (!$owner)
} {
$groups = $phpgw->accounts->memberships(intval($owner)); $owner = $phpgw_info['user']['account_id'];
if (gettype($groups) == 'array') { }
while ($group = each($groups)) { $groups = $phpgw->accounts->memberships(intval($owner));
$s .= " or $table like '%," . $group[2] . ",%'"; if (gettype($groups) == 'array')
} {
} while ($group = each($groups))
return $s; {
} $s .= " or $table like '%," . $group[2] . ",%'";
}
}
return $s;
}
// return a array of installed languages // return a array of installed languages
/*! /*!
@ -251,6 +260,7 @@
} }
return $html_error . '</table>'; return $html_error . '</table>';
} }
/*! /*!
@function check_owner @function check_owner
@abstract none yet @abstract none yet
@ -259,23 +269,31 @@
@param $label ? @param $label ?
@param $extravars @param $extravars
*/ */
function check_owner($record,$link,$label,$extravars = '') // This is a depreciated function - use ACL instead (jengo)
{ function check_owner($record,$link,$label,$extravars = '')
global $phpgw, $phpgw_info; {
global $phpgw, $phpgw_info;
$s = '<a href="' . $phpgw->link($link,$extravars) . '"> ' . lang($label) . ' </a>'; $this->debug_info[] = 'check_owner() is a depreciated function - use ACL instead';
if (ereg("^[0-9]+$",$record)) { $s = '<a href="' . $phpgw->link($link,$extravars) . '"> ' . lang($label) . ' </a>';
if ($record != $phpgw_info['user']['account_id']) { if (ereg('^[0-9]+$',$record))
$s = "&nbsp;"; {
} if ($record != $phpgw_info['user']['account_id'])
} else { {
if ($record != $phpgw_info['user']['userid']) { $s = '&nbsp;';
$s = "&nbsp"; }
} }
} else
{
if ($record != $phpgw_info['user']['userid'])
{
$s = '&nbsp';
}
}
return $s;
}
return $s;
}
/*! /*!
@function display_fullname @function display_fullname
@abstract return the fullname of a user @abstract return the fullname of a user