[imp] Cyrus "realms" vs IMP "realms"
Edwin Culp
eculp@encontacto.net
Mon, 2 Sep 2002 07:05:08 -0700
Quoting "Marc G. Fournier" <scrappy@hub.org>:
| On Sun, 1 Sep 2002, Edwin Culp wrote:
|
| > Have you tried using the imp_get_vinfo() hook and setting back to
| > 'realm' >= '', ?
|
| Nope, but am now ... but I'm confused ... the comment states that it will
| be used to 'set the $imp['user'] at login time', yet the script uses
| $imp['user'], which doesn't appear to have been set yet ...
You have probably already taken a look at lib/Session.php about line 57 and
templates/login/login.inc at about line 77 but if not you might want to.
|
| Else I'm missing somethign ...
|
| For instance, I changed my conf.php file in imp/config to ignore the $type
| and set it to what I want:
|
| $conf['hooks']['vinfo'] = 'imp_get_vinfo';
|
| if (!function_exists('imp_get_vinfo')) {
| function imp_get_vinfo ($type) {
| global $conf, $imp;
|
| $vdomain = getenv('HTTP_HOST');
| $vdomain = preg_replace('|^webmail\.|i', '', $vdomain);
| $vdomain = strtolower($vdomain);
|
| return $imp['user'] . '@' . $vdomain;
| }
| }
|
| But when I try to login, it only gets the @$vdomain part:
|
| ...mail.pluto.hub.org:143[imap] as @pluto.hub.org ...
|
| So, what value should I be setting in there?
I use the following script that will hopefully help as it is a bit different,
has the vdomain type and has worked for months. As they say if it works
don't fix it.
$conf['hooks']['vinfo'] = 'imp_get_vinfo';
if (!function_exists('imp_get_vinfo')) {
function imp_get_vinfo ($type = 'username') {
global $conf, $imp;
$vdomain = strtolower(preg_replace('|^mail\.|i', '',
$_SERVER['HTTP_HOST']));
if ($type == 'username') {
return $_SESSION['imp']['user'] . '@' . $vdomain;
} elseif ($type == "vdomain") {
return $vdomain;
} else {
return new PEAR_Error('invalid type: ' . $type);
}
}
}
Hope this helps,
ed
--