[imp] Sean D & Jason Lohrenz - revisiting imp on plesk?
Sean D.
mojospam at thegeekclub.net
Fri Jul 16 13:24:23 PDT 2004
>> // get hostname from http URL (patch for PSA) mojo wuz here
>> $headers = getallheaders();
>
>
> Is this variable actually used anywhere later?
which var? the $headers one? no thats not.. a relic of what plesk had in
there.. i changed it to what i pasted below.
>> $patterns[0] = "/^webmail\./";
>> $patterns[1] = "/^www\./";
>> $patterns[2] = "/^mail\./";
>> $vdomain = getenv('HTTP_HOST');
>> $vdomain = preg_replace($patterns, '', $vdomain);
>> $vdomain = strtolower($vdomain);
>>
>> $servers['imap'] = array(
>> 'name' => 'IMAP Server',
>> 'server' => 'localhost',
>> 'protocol' => 'imap/notls',
>> 'port' => 143,
>> 'folders' => 'INBOX.',
>> 'namespace' => '',
>> 'maildomain' => $vdomain,
>> 'smtphost' => 'localhost',
>> 'realm' => $vdomain,
>> 'preferred' => ''
>> );
>>
>> although you could probably just as easily use the
>> $_SERVER['SERVER_NAME'] bit
>> of code to set the domain. maybe Jan knows which way is more
>> efficient coding...?
>
>
> $_SERVER['HTTP_HOST'] actually, but looks good otherwise.
>
(i guess while i'm posting code for the world's consumption i might as well post
my complete virtual hosting setup.)
on my alpha install i removed the $vdomain var completely from servers.php,
leaving maildomain and realm empty, and modified the '_imp_hook_vinfo' function
in horde/config/hooks.php to look like this and return "user at domain.com" for the
username (and displays the "@domain.com" bit on the login page, i like that
extra touch).
if (!function_exists('_imp_hook_vinfo')) {
function _imp_hook_vinfo($type = 'username')
{
$vdomain = $_SERVER['HTTP_HOST'];
$patterns[0] = "/^webmail\./";
$patterns[1] = "/^www\./";
$patterns[2] = "/^mail\./";
$patterns[3] = "/^webmailbeta\./";
$vdomain = preg_replace($patterns, '', $vdomain);
$vdomain = String::lower($vdomain);
if ($type == 'username') {
return String::lower($_SESSION['imp']['user'] . '@' . $vdomain);
} elseif ($type == 'vdomain') {
return $vdomain;
} else {
return PEAR::raiseError('invalid type: ' . $type);
}
}
}
in registry.php i use it again to set the 'name' variable... my users are not
the brightest bunch and i got tired of getting asked "whats a horde?"
this brings up another Q if anyone has the time.. i added that 'domain_name' var
and was thinking maybe i should use it in any subsequent places i need that
$vdomain bit... would that make a difference at all besides making the code a
little cleaner? how would i call it up? getparam something i think it was?
$vdomain = $_SERVER['HTTP_HOST'];
$patterns[0] = "/^webmail\./";
$patterns[1] = "/^www\./";
$patterns[2] = "/^mail\./";
$patterns[3] = "/^webmailbeta\./";
$vdomain = preg_replace($patterns, '', $vdomain);
$vdomain = String::lower($vdomain);
$this->applications['horde'] = array(
'fileroot' => dirname(__FILE__) . '/..',
'webroot' => '',
'initial_page' => 'login.php',
'icon' => '/graphics/horde.gif',
'name' => _($vdomain),
'status' => 'active',
'templates' => dirname(__FILE__) . '/../templates',
'provides' => 'horde',
'domain_name' => $vdomain
);
thanks,
Sean D.
More information about the imp
mailing list