[imp] IMP Abuse (was Howto remove client IP-Address)
Otto Stolz
Otto.Stolz at uni-konstanz.de
Thu Jan 31 14:00:18 UTC 2008
Dear MailingListe (or whatever your name sis),
you have written:
> I have tried to [write a pertinent hook function]
> but failed to pass a "enum" array to prefs.php.
> Here is what we use as hook.
>
> // database.
> if (!function_exists('_prefs_hook_tieto_addr')) {
> function _prefs_hook_tieto_addr($account = null)
> {
> global $conf;
>
> if (is_null($account)) {
> $name = Auth::getAuth();
> }
> if (!empty($account)) {
> include_once 'DB.php';
> $_db = &DB::connect($conf['sql2'], true);
> $query = 'SELECT username,alias FROM virtual WHERE username = ?';
> $values = array($account);
> $result = $_db->getOne($query, $values);
> if (!is_a($result, 'PEAR_Error') && $result > 0) {
> $enum_result = array($result);
> return ($enum_result);
> } else {
> return '';
> }
> }
> }
> }
>
>
> Jan 31 13:55:57 vx4 httpd2-prefork: PHP Notice: Undefined index:
> enum in /srv/www/horde/templates/prefs/enum.inc on line 3
> Jan 31 13:55:57 vx4 httpd2-prefork: PHP Warning: Invalid argument
> supplied for foreach() in /srv/www/horde/templates/prefs/enum.inc on
> line 3
Sorry, I have never used DB.php, nor needed to write a
_prefs_hook_tieto_addr function; and I have not the time
to research into these issues. So I cannot pursue your
case further; I hope, somebody else can jump in.
(However, I guess that the line
$enum_result = array($result)
is probably wrong: It assigns to $enum_result an array whose
only component is $result, probably an array already by itself.
But then I do not really know what $_db->getOne($query, $values)
will yield, at all.)
Good luck,
Otto Stolz
More information about the imp
mailing list